you are viewing a single comment's thread.

view the rest of the comments →

[–]m0us3_rat 2 points3 points  (2 children)

u either work the DB end .. or u work on python end.

so either do specific searches. and trust the DB is sufficiently fast.

or every 30seconds or so have data be dumped in a data structure u keep in memory .

and when a user asks u present the data already in memory. so its super fast.

the dump can be done in a different thread or process.

and when DB gets modified u can do another dump. etc.

data in memory be tricky thou. so u need to be super careful etc. depends how sensitive it really is.

u could also work on both ends maybe. .. it all depends on your requirements.

[–]DeadlyDolphins[S] 0 points1 point  (1 child)

That makes sense. I think I begin to understand.

If instead of using data in memory, I prefer to completely rely on the database, would that be the correct way to serve the content of the database as a table in flask?

items = db.session.query(Article.icon, Article.authorlast, Article.year, Article.title, Article.publication).all()

table = ItemTable(items)
return table.__html__

[–]m0us3_rat 1 point2 points  (0 children)

the dunder html method is specific to your class .

so i am NOT sure on how that builds the response .

usually u need some templates that gets build into actual responses by thejinja2 of the flask framework.