-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLA20: Replace Session.query(...).get by Session.get #29205
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised there are so few!
@@ -3687,7 +3687,6 @@ def complete_one_dagrun(): | |||
for _ in range(5): | |||
self.scheduler_job._do_scheduling(session) | |||
complete_one_dagrun() | |||
model: DagModel = session.query(DagModel).get(dag.dag_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't need this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not, this model
not use later in the code, we just make a query to DB and that all.
This part unchanged since it added in the end if 2021: #19528
Yeah, mostly because we have so many composite PKs, and using (Plus for whatever reason historically Airflow never use it. I think either due to a dislike of it, a misunderstanding of the SQLA session model or simply not knowing it exists) |
Ok, lets do a full test. Just in case. |
(cherry picked from commit 264ace5)
related: #28723
Replace abstract
session.query(User).get(5)
bysession.get(User, 5)
(1.4/2.0 compatible). First from the list: 2.0 Migration - ORM UsageNote: most of the legacy usage found by regex:
query\(.*\.get\(
so there is possible that unchanged part still exists.