Prab-27 commented on code in PR #59823:
URL: https://github.com/apache/airflow/pull/59823#discussion_r2648866509
##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -6289,7 +6272,10 @@ def
test_dag_file_processor_process_task_instances_depends_on_past(
ti.end_date = end_date
self.job_runner._schedule_dag_run(dr, session)
- assert
session.query(TaskInstance).filter_by(state=State.SCHEDULED).count() == 2
+ assert (
+
len(session.scalars(select(TaskInstance).where(TaskInstance.state ==
State.SCHEDULED)).all())
+ == 2
+ )
Review Comment:
Since here .`count() `can also be written like this -
`session.scalar(select(func.count(TaskInstance.id)).where(TaskInstance.state==State.SCHEDULED))
== 2`
or
`session.scalar(select(func.count()).select_from().where()) `
Helping docs -
[here](https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#migration-orm-usage)
What do you think ?
--
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]