mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
a couple more
also, print a message whenever we flush the row queue
This commit is contained in:
parent
c0e588df88
commit
99fa70de41
1 changed files with 4 additions and 3 deletions
|
@ -156,8 +156,8 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
|||
|
||||
# SQLite speed tweaks
|
||||
if not safe and engine.dialect.name == 'sqlite':
|
||||
session.execute("PRAGMA synchronous=OFF")
|
||||
session.execute("PRAGMA journal_mode=OFF")
|
||||
session.execute("PRAGMA synchronous=OFF").close()
|
||||
session.execute("PRAGMA journal_mode=OFF").close()
|
||||
|
||||
# Drop all tables if requested
|
||||
if drop_tables:
|
||||
|
@ -180,7 +180,7 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
|||
|
||||
print_start('Creating tables')
|
||||
for n, table in enumerate(table_objs):
|
||||
table.create()
|
||||
table.create(bind=engine)
|
||||
print_status('%s/%s' % (n, len(table_objs)))
|
||||
print_done()
|
||||
|
||||
|
@ -312,6 +312,7 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
|||
# Remembering some zillion rows in the session consumes a lot of
|
||||
# RAM. Let's not do that. Commit every 1000 rows
|
||||
if len(new_rows) >= 1000:
|
||||
print("flushing")
|
||||
insert_and_commit()
|
||||
|
||||
insert_and_commit()
|
||||
|
|
Loading…
Reference in a new issue