-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor sqlalchemy queries to 2.0 style (Part 1) (#31569)
* Refactor sqlalchemy queries to 2.0 style (Part 1) This commit updates the sqlalchemy queries to adopt the 2.0 query style, which is compatible with version 1.4. The changes involve updating the engine with the future=True flag to indicate the execution of queries using the 2.0 style. As a result, textual SQL statements are wrapped with the text function. In addition, queries that previously used delete and update operations have been modified to utilize the new delete/update construct. Furthermore, all queries within the jobs/ and api/ directories have been thoroughly updated to employ the new style queries. Please note that this commit intentionally stops at this point to ensure ease of review for the pull request. The only test change is the addition of the future flag to the create_engine function. * Apply suggestions from code review Co-authored-by: Tzu-ping Chung <[email protected]> * Use session.scalar() * Fix typing and remove unique() * fixup! Apply suggestions from code review * revert session.scalar() * use session.scalars where possible * Use session.scalar() with limit * Fix pre-commit * fixup! Use session.scalar() with limit --------- Co-authored-by: Tzu-ping Chung <[email protected]>
- Loading branch information
1 parent
0cbc0dc
commit 0f1cef2
Showing
39 changed files
with
443 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.