Skip to content

Update declarative_base use for SQLAlchemy 2.0 - #1795

Open
BrianJKoopman wants to merge 8 commits into
masterfrom
koopman/declarative_base
Open

BrianJKoopman wants to merge 8 commits into
masterfrom
koopman/declarative_base

Conversation

@BrianJKoopman

Copy link
Copy Markdown
Member

This replaces the old declarative_base usage:

from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

for the preferred declarative mapping in SQLAlchemy 2.0.

25ce11b contains just the changes to resolve the warnings seen in socs. 4b183a8 covers the rest of the uses.

Several spots noted using the new 2.0 delcarative_base with handling for backwards compatibility, which I don't believe is needed anymore, as SQLAlchemy 2.0 is available for Python 3.10, which is the oldest supported version for sotodlib.

I've run the tests on a Python 3.10 install and all tests pass.

Resolves #1593.

@BrianJKoopman

Copy link
Copy Markdown
Member Author

Okay, it's not clear to me how to fix the docs build warning in https://app.readthedocs.org/projects/sotodlib/builds/36023821/, so I've excluded updating io/hkdb.py.

I noticed sqlalchemy was missing from the dependencies list -- I think we're just getting away with it being required by other dependencies, but it's imported directly by sotodlib, so makes sense to include. I've added it and put the requirement of >=2.0.0 on it.

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.

SQLAlchemy 2.0 migration of declarative_base

1 participant