Skip to content

Update SQLAlchemy to version 1.4.x#147

Draft
liZe wants to merge 8 commits intomasterfrom
lize/sqlalchemy14
Draft

Update SQLAlchemy to version 1.4.x#147
liZe wants to merge 8 commits intomasterfrom
lize/sqlalchemy14

Conversation

@liZe
Copy link
Contributor

@liZe liZe commented Mar 25, 2021

Fix #146.

Before merging this pull request, we have to solve 3 problems:

  • Typing is not yet handled correctly, we have to wait for a new version of sqlalchemy-stubs (see support for sqlalchemy version 1.4 and 2.0 dropbox/sqlalchemy-stubs#184).
  • Conflicts are not triggered by INSERT … ON CONFLICT … when None is set for a column with a default value set on the server (see a703487). It could be a bug in SQLAlchemy or a normal behavior. Removing the key from the request fixes the problem, but changes may also be needed somewhere else (where this corner case may not be tested).
  • Identities are now correctly handled by SQLAlchemy and Alembic (see d3577e6). In Azafea, PostgreSQL uses them when new tables are created with integer primary keys, instead of "SERIAL" (see model.py). As Alembic misses identities in the model but has them in the created table, it adds the identity in future migrations. That’s at least right for migration_event (which is created during tests and thus needs a fix to make them pass), but probably right for other tables too. Explicitly using identities everywhere should fix the problem, if we ever really need to fix it.

liZe added 8 commits March 25, 2021 13:49
Inspector.from_engine is deprecated since 1.4.
URL() is deprecated since SQLAlchemy 1.4.
For unknown reasons, SQLAlchemy 1.4 doesn’t trigger the conflict when "None" is
set as dualboot value. Explicitely removing the column gives the expected
behavior back.
Thanks to SQLAlchemy 1.4, Alembic now knows how to handle identities (see
sqlalchemy/alembic#730).

For unknown reasons, identities are now detected as server default values for
the Event table, and are put in database migrations. Explicitely setting the
default value fixes the new alembic migrations, at least for tests.
@liZe liZe self-assigned this Mar 25, 2021
@liZe liZe added the dependencies Pull requests that update a dependency file label Mar 25, 2021
@dbnicholson dbnicholson mentioned this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update SQLAlchemy to 1.4.x

1 participant