X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/7d2a18f84eedde0f6fe76e1886c5cf1974dc1909..8fe37d81796a530d355a5f0bb5a7932472f258d1:/pokedex/db/load.py?ds=sidebyside diff --git a/pokedex/db/load.py b/pokedex/db/load.py index 7f8824a..044d15c 100644 --- a/pokedex/db/load.py +++ b/pokedex/db/load.py @@ -175,6 +175,11 @@ def load(session, directory=None, drop_tables=False, verbose=False): session.add(row) + # Remembering some zillion rows in the session consumes a lot of + # RAM. Let's not do that. Commit every 1000 rows + if len(session.new) > 1000: + session.commit() + session.commit() # Attempt to add any spare rows we've collected