boxwise / boxtribute

The code base for Boxtribute 2.0, a humanitarian aid web application making it easy to source, store and distribute goods to people in need in a fair and dignified way
https://www.boxtribute.org/
Apache License 2.0
31 stars 12 forks source link

Use peewee iterator in loaders #1495

Open pylipp opened 3 weeks ago

pylipp commented 3 weeks ago

cf. http://docs.peewee-orm.com/en/latest/peewee/querying.html#iterating-over-large-result-sets

To reduce the amount of memory used by peewee when iterating over a query, use the iterator() method. This method allows you to iterate without caching each model returned, using much less memory when iterating over large result sets.