-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⬆️ UPGRADE: sqlalchemy v1.4 (v1 API) (#5103)
This commit updates sqlalchemy to version 1.4, aldjemy to v2, disk-objectstore to v0.6, and adds the mypy plugin for sqlalchemy. It will also allow for a move to the [v2 API](https://docs.sqlalchemy.org/en/14/glossary.html#term-1), but this will be done in a subsequent PR. The existing `SqlaQueryBuilder._build` implementation included a number of "hacks" on protected attributes, which no longer work in v1.4 and had to be changed: Firstly, the query must be initialised with an entity/column, however, the first entity in the query path may not actually have any associated projections (e.g. `qb.append(Node).append(Node)` only projects the second entity). Previously, this was addressed by removing it from the entity list (`self._query._entities.pop(0)`), after constructing the query. `_entities` is no longer an attribute of the query and trying something equivalent in 1.4 leads to malformed SQL. Instead, we only add the `id` column as the initial column, then discard this when returning the results. This leads to a much cleaner solution, which should not break in the future Secondly, the query must be set to turn-off de-duplication (sqlalchemy/sqlalchemy#4395 (comment)). This again no longer works in 1.4. For this commit, a patch on `ORMCompileState` has been added to achieve this. Not ideal, but with the v2 API this is off by default and so the patch can be eventually removed. The upgrade to aldjemy v2 required one change: see aldjemy/aldjemy#188.
- Loading branch information
1 parent
42c5ab1
commit d33ae8a
Showing
25 changed files
with
247 additions
and
247 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.