pierrejeambrun commented on code in PR #59508:
URL: https://github.com/apache/airflow/pull/59508#discussion_r2631596993
##########
airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py:
##########
@@ -250,7 +253,7 @@ def test_sync_bundles_to_db_with_template(clear_db,
session):
manager.sync_bundles_to_db()
# Check that the template and parameters were stored
- bundle_model =
session.query(DagBundleModel).filter_by(name="template-bundle").first()
+ bundle_model =
session.scalars(select(DagBundleModel).filter_by(name="template-bundle").limit(1)).first()
Review Comment:
More info here:
-
https://docs.sqlalchemy.org/en/20/core/connections.html#sqlalchemy.engine.Result.first
-
https://docs.sqlalchemy.org/en/20/orm/queryguide/query.html#sqlalchemy.orm.Query.first
##########
airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py:
##########
@@ -250,7 +253,7 @@ def test_sync_bundles_to_db_with_template(clear_db,
session):
manager.sync_bundles_to_db()
# Check that the template and parameters were stored
- bundle_model =
session.query(DagBundleModel).filter_by(name="template-bundle").first()
+ bundle_model =
session.scalars(select(DagBundleModel).filter_by(name="template-bundle").limit(1)).first()
Review Comment:
Legacy API (query) will apply the server side limit. (it was correct).
Indeed on a result the `first` method will only filter the client side
result, so the '2.0' equivalent is to add explicitly the limit.
That looks good to me.
--
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]