Prab-27 commented on code in PR #59733:
URL: https://github.com/apache/airflow/pull/59733#discussion_r2644921619


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py:
##########
@@ -990,7 +991,7 @@ def test_update_mask_preserves_other_fields(self, 
test_client, session):
         assert response_data["update"]["success"] == ["pool1"]
 
         # Assert: fetch from DB and check only masked field changed
-        updated_pool = session.query(Pool).filter_by(pool="pool1").one()
+        updated_pool = session.execute(select(Pool).where(Pool.pool == 
"pool1")).scalar_one()

Review Comment:
   Yes, it works fine, and session.execute().scalar_one() and 
session.scalars().one() are the same as mentioned 
[here.](https://docs.sqlalchemy.org/en/14/core/connections.html#sqlalchemy.engine.Result.scalar_one)
 
   
   Since in the assert conditions we are only checking for a scalar value or 
None, I thought we could also use session.scalar() as mentioned 
[here.](https://docs.sqlalchemy.org/en/14/core/connections.html#sqlalchemy.engine.Result.scalar)
 (It's just my point of view )
   
   would love to hear your point of view on this.



-- 
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]

Reply via email to