Skip to content

Refactor Sqlalchemy queries to 2.0 styles (Part 2)#31772

Merged
ephraimbuddy merged 17 commits into
apache:mainfrom
astronomer:sqlalchemy-20-query-style2
Jun 27, 2023
Merged

Refactor Sqlalchemy queries to 2.0 styles (Part 2)#31772
ephraimbuddy merged 17 commits into
apache:mainfrom
astronomer:sqlalchemy-20-query-style2

Conversation

@ephraimbuddy

Copy link
Copy Markdown
Contributor

This is a continuation of the effort to refactor the queries to sqlalchemy 2.0

@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Jun 7, 2023
@ephraimbuddy
ephraimbuddy force-pushed the sqlalchemy-20-query-style2 branch 6 times, most recently from 174adae to ce9a926 Compare June 7, 2023 18:07
Comment thread airflow/api_connexion/endpoints/task_instance_endpoint.py Outdated
Comment thread airflow/api_connexion/endpoints/xcom_endpoint.py Outdated
Comment thread airflow/api_connexion/endpoints/user_endpoint.py Outdated
Comment thread airflow/api_connexion/endpoints/log_endpoint.py Outdated
@ephraimbuddy
ephraimbuddy force-pushed the sqlalchemy-20-query-style2 branch 3 times, most recently from 0e1c5d6 to 878d9b1 Compare June 9, 2023 14:08
@ephraimbuddy
ephraimbuddy marked this pull request as ready for review June 9, 2023 14:08
@ephraimbuddy

Copy link
Copy Markdown
Contributor Author

Marking this PR ready for review, there's still a lot of work to be done and this is already getting big, so shifting the work to the next PR.

Comment thread airflow/models/dag.py Outdated
Comment thread airflow/models/dag.py Outdated
@ephraimbuddy
ephraimbuddy force-pushed the sqlalchemy-20-query-style2 branch 2 times, most recently from 9e8dea4 to 52aa81c Compare June 15, 2023 14:25
Comment thread airflow/models/pool.py Outdated
@ephraimbuddy
ephraimbuddy force-pushed the sqlalchemy-20-query-style2 branch from 52aa81c to acb30f1 Compare June 16, 2023 08:07
Comment thread airflow/models/dag.py Outdated
@uranusjr

Copy link
Copy Markdown
Member

Is this one missed? #31772 (comment)

Comment thread airflow/models/pool.py Outdated
Comment thread airflow/models/dagrun.py Outdated
Comment thread airflow/models/dag.py Outdated
Comment thread airflow/models/dag.py Outdated
Comment thread airflow/models/dag.py Outdated
Comment thread airflow/models/dag.py Outdated
@ephraimbuddy

Copy link
Copy Markdown
Contributor Author

What do you think about this latest commit: cad7874

@ephraimbuddy
ephraimbuddy force-pushed the sqlalchemy-20-query-style2 branch from cad7874 to 3e31197 Compare June 27, 2023 07:35
Comment thread airflow/models/pool.py Outdated
Comment thread airflow/models/pool.py Outdated
Comment thread airflow/models/dagrun.py Outdated
Comment thread airflow/models/dagrun.py Outdated
Comment thread airflow/models/dag.py Outdated
Comment thread airflow/models/dag.py Outdated
Comment thread airflow/models/dag.py Outdated
@ephraimbuddy
ephraimbuddy force-pushed the sqlalchemy-20-query-style2 branch from e153b1d to 844deeb Compare June 27, 2023 11:42
@ephraimbuddy
ephraimbuddy merged commit 83f5950 into apache:main Jun 27, 2023
@ephraimbuddy
ephraimbuddy deleted the sqlalchemy-20-query-style2 branch June 27, 2023 14:09
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 27, 2023
* Refactor Sqlalchemy queries to 2.0 styles (Part 2)

This is a continuation of the effort to refactor the queries to sqlalchemy 2.0 style

* Fix total_entries counting logic

The count should happen *after* we apply the filters, and is (slightly)
different from the automatic 404 case.

* Update queries in models/

* fixup! Update queries in models/

* Add triggerer_job in query

* fixup! fixup! Update queries in models/

* Revert changes to dagwarning.py

* Use session.scalar

* Convert DagWarning to SQLAlchemy 2.x syntax

* Fix dagwarning

* fix typing and remove todo comment

* Apply suggestions from code review

Co-authored-by: Tzu-ping Chung <[email protected]>

* Use scalars instead of execute and fix typing

* Apply suggestions from code review

Co-authored-by: Tzu-ping Chung <[email protected]>

* Apply suggestions from code review

Co-authored-by: Tzu-ping Chung <[email protected]>

* remove all

* Remove one_or_none where possible

---------

Co-authored-by: Tzu-ping Chung <[email protected]>
@ephraimbuddy ephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Jul 6, 2023
@ephraimbuddy ephraimbuddy added this to the Airflow 2.7.0 milestone Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API type:misc/internal Changelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants