mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
remove the other explicit .close() calls
This commit is contained in:
parent
bf1044a9ce
commit
c9855a2282
1 changed files with 3 additions and 3 deletions
|
@ -254,7 +254,7 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
||||||
def insert_and_commit():
|
def insert_and_commit():
|
||||||
if not new_rows:
|
if not new_rows:
|
||||||
return
|
return
|
||||||
session.execute(insert_stmt, new_rows).close()
|
session.execute(insert_stmt, new_rows)
|
||||||
session.commit()
|
session.commit()
|
||||||
new_rows[:] = []
|
new_rows[:] = []
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
||||||
|
|
||||||
session.execute(
|
session.execute(
|
||||||
insert_stmt.values(**row_data)
|
insert_stmt.values(**row_data)
|
||||||
).close()
|
)
|
||||||
seen_ids.add(row_data['id'])
|
seen_ids.add(row_data['id'])
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
@ -341,7 +341,7 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
||||||
table_obj = translation_class.__table__
|
table_obj = translation_class.__table__
|
||||||
if table_obj in table_objs:
|
if table_obj in table_objs:
|
||||||
insert_stmt = table_obj.insert()
|
insert_stmt = table_obj.insert()
|
||||||
session.execute(insert_stmt, rows).close()
|
session.execute(insert_stmt, rows)
|
||||||
session.commit()
|
session.commit()
|
||||||
# We don't have a total, but at least show some increasing number
|
# We don't have a total, but at least show some increasing number
|
||||||
new_row_count += len(rows)
|
new_row_count += len(rows)
|
||||||
|
|
Loading…
Reference in a new issue