-
Notifications
You must be signed in to change notification settings - Fork 1k
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
SQLAlchemy 2.0 compatibility #12541
Comments
Running |
So, we are switching to Alembic before this can be completed. I tried fixing the bound metadata issue (one of the "things" that are removed in 2.0), and that appears to be not possible with our current migration provider (e.g. a bound engine is assumed when SA Migrate executes |
In 2.0 there will be no backref/back-populates cascading of child objects into the session (ref). In particular: "In 2.0, the default behavior will be that “cascade_backrefs” is False, and additionally there will be no “True” behavior as this is not generally a desirable behavior." This, potentially could wreak havoc on a running Galaxy. To address this, I will try adding an explicit Once we get to Step Four and enable the |
This builds on #10892 (SQLAlchemy 1.4 compatibility) and details the specific steps required for preparing Galaxy's codebase for migrating to SQLAlchemy's upcoming 2.0 release. The steps are documented here.
First Prerequisite, step one:
First Prerequisite, step two:
Migration to 2.0 Step One:
Migration to 2.0 Step Two Prerequisites (Galaxy-specific)
Migration to 2.0 Step Two - Use RemovedIn20Warnings (ref)(Enable setting SQLALCHEMY_WARN_20 #13171)
(To enable warnings, set
GALAXY_CONFIG_SQLALCHEMY_WARN_20=1
)Migration to 2.0 Step Three - Resolve all RemovedIn20Warnings (ref)
(Helpful documentation on how to filter warnings: sqlalchemy, pytest, python)
See these examples of changes that may potentially have a significant impact on a running Galaxy:
Migration to 2.0 Step Four - Use the future flag on Engine (ref)
future=True
flag to thecreate_engine()
function (there are multiple places where we call that function: check entire code base: lib/, scripts/, test/)connection.commit()
where applicableMigration to 2.0 Step Four - Use the future flag on Session (ref)
future=True
flag to Session wherever we are creating an instance (direct instantiation of Session or calling the sessionmaker factory)Once all of the above is complete and no RemovedIn20Warning are emitted:
Enable SA 2.0:
pyproject.toml
, relevant packages (setup.cfg
files)Cleanup:
Next steps:
UPDATE: Keeping track of fixing RemovedIn20Warnings:
Number of distinct warnings per github workflow (each may be triggered multiple times by different tests):
(last updated/corrected: Dec 11, 2023)
UPDATE: Keeping track of fixing test failures on the SQLAlchemy-2.0 PR (#17180):
(last updated/corrected: Feb 23, 2024)
The text was updated successfully, but these errors were encountered: