Skip to content
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

Support SQLAlchemy 1.4 #361

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Parnassius
Copy link
Contributor

  • The do_orm_execute event is now used to set the default value for _default_language_id, since the old method (subclassing Query._execute_and_instances) is no longer supported. The old method is still there to maintain compatibility with 1.0-1.3.
  • A couple of double relationships referring to one another are now simply one relationship with backref=True.
  • Every relationship in pokedex/db/tables.py now has the attribute viewonly=True: this is required to silence many warnings added in 1.4, and it shouldn't do any harm since as far as I know beside the setup/load/dump functions nothing writes stuff into the database, and those don't really use the ORM to do so. If the SQLAlchemy version is at least 1.3.17 but less than 1.4 sync_backref=False is used as well (since 1.4 it defaults to False).
  • SQLAlchemy 1.4 now implements a warning about potential cartesian products in select statements. In pokedex/db/load.py there's an intentional cartesian product, adding q = q.filter(true()) is enough to silence the warning.

Closes #330

@giginet
Copy link

giginet commented Jul 21, 2022

Great job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors with SQLAlchemy 1.4
2 participants