From 60619c9d9ca83e753f4d8a808f64749209faa960 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sun, 22 Nov 2020 00:30:51 +1100 Subject: [PATCH] previous commit was by accident was testing speed of not using ORM for all books, it is still a bit slow, but much faster... I wonder whether I load in increments with ORM and ajax append them to the list, just need first 20, then add... OR, just load the lot without an ORM... oddly, cant just do this because both author/publisher would need to be fixed, AND I cant seem to change books[0].parent if I do that, it complains --- main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.py b/main.py index c061751..0c13e41 100644 --- a/main.py +++ b/main.py @@ -122,8 +122,7 @@ books_schema = BookSchema(many=True) ####################################### ROUTES ####################################### @app.route("/books", methods=["GET"]) def books(): -# books = Book.query.all() - books = db.engine.execute ( "select * from book" ) + books = Book.query.all() # ignore ORM, its too slow. Just select sub_book data and hand add it to # the books object, and use it in jinja2 to indent/order the books/sub books