john-bodley commented on code in PR #26200:
URL: https://github.com/apache/superset/pull/26200#discussion_r1440981079
##########
scripts/benchmark_migration.py:
##########
@@ -174,10 +172,9 @@ def main(
models = find_models(module)
model_rows: dict[type[Model], int] = {}
for model in models:
- rows = session.query(model).count()
+ rows = db.session.query(model).count()
print(f"- {model.__name__} ({rows} rows in table
{model.__tablename__})")
model_rows[model] = rows
- session.close()
Review Comment:
There is no need to explicitly close the session as this is handled by
Flask-SQLAlchemy when the session is [torn
down](https://github.com/pallets-eco/flask-sqlalchemy/blob/main/src/flask_sqlalchemy/extension.py#L441-L448)—be
that at the end of request or when a script/shell terminates.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]