fix: benchmark_migration.py needs to close sssion (#15822)

This commit is contained in:
Beto Dealmeida 2021-07-21 11:16:46 -07:00 committed by GitHub
parent 32a5680510
commit d26254099e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -172,6 +172,7 @@ def main(
rows = session.query(model).count()
print(f"- {model.__name__} ({rows} rows in table {model.__tablename__})")
model_rows[model] = rows
session.close()
print("Benchmarking migration")
results: Dict[str, float] = {}

View File

@ -32,8 +32,10 @@ from sqlalchemy_utils import UUIDType
def upgrade():
op.add_column("report_execution_log", sa.Column("uuid", UUIDType(binary=True)))
with op.batch_alter_table("report_execution_log") as batch_op:
batch_op.add_column(sa.Column("uuid", UUIDType(binary=True)))
def downgrade():
op.drop_column("report_execution_log", "uuid")
with op.batch_alter_table("report_execution_log") as batch_op:
batch_op.drop_column("uuid")