[Flask] temporary database

Benjamin Ziirish SANS ziirish at ziirish.info
Mon Apr 11 10:13:33 EDT 2022


* On Monday, April 11, 2022 at 10:07 AM -0400, Corey Boyle <coreybrett at gmail.com> wrote:
> Curious if anyone has any suggestions for the following.
> 
> I have a "database" of about 96k rows that I want to dump from an old
> legacy business system and import into my Flask app.
> 
> The data is approximately 5MB when stored as a CSV.
> 
> I would like to do this dump once a day (maybe more often if practical).
> 
> Users of the Flask app will only need to read/search the data.
> 
> I already have a Postgres DB (using SQLAlchemy) that I could use, but
> that doesn't seem like the best option, since I would be clearing the
> entire table, and reloading all the data every time I run an update.
> 
> Redis seems like a good idea, but if I'm not mistaken, I could only
> search the keys, not the values.
> 
> Would something like MongoDB be a good fit?
> 
> Something where all the data is stored in-memory instead of disk would be ideal.

Well, if the data fits in 5MB and you'd like some kind of in-memory database,
you might have a look at SQLite's in-memory databases:
https://www.sqlite.org/inmemorydb.html

If you don't need any RDBMS feature, why not playing with a good old Python dict
that you would populate from your dump above as a JSON or something like that?


More information about the Flask mailing list