Skip to content

Commit

Permalink
fix: close session once, outside of for-loop
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Jan 12, 2024
1 parent 29ed193 commit 1ff7e99
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def upgrade():
result = db.session.execute(
sa.text(f"SELECT EXISTS (SELECT 1 FROM {table});")
).scalar_one_or_none()
db.session.close() # https://stackoverflow.com/a/26346280/13775459
if result:
tables_with_data += [table]
except ProgrammingError as exception:
print(f"Table {table} not found, continuing...")
print(exception)
db.session.close() # https://stackoverflow.com/a/26346280/13775459

if tables_with_data:
click.confirm(
Expand Down

0 comments on commit 1ff7e99

Please sign in to comment.