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

SQLAlchemy 1.4 -> 2.0 Update #39

Open
16 tasks done
teald opened this issue Jun 26, 2024 · 0 comments · May be fixed by #43
Open
16 tasks done

SQLAlchemy 1.4 -> 2.0 Update #39

teald opened this issue Jun 26, 2024 · 0 comments · May be fixed by #43
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@teald
Copy link
Member

teald commented Jun 26, 2024

Info

This issue tracks update progress, tasks, and information w.r.t. updating SQLAlchemy. The TODO section has a checklist for specific items that are completed or need to be done.

Branch: sqlalchemy_update

TODO

  • Get tests running locally
  • Migration Guide steps with code_tests
    • Activate & Resolve RemovedIn20Warnings
      • (🤖) sqlalchemy.ext.declarative.declarative_base -> sqlalchemy.orm.declarative_base (imports, mostly)
      • (🤖) get from session queries is unsupported: session.query(TABLE).get(KEY) -> session.get(TABLE, KEY), for example
      • (🔧) sqlalchemy.orm.relation -> sqlalchemy.orm.relationship
    • Activate & resolve issues with adding future=True to instances of Engine
      • (🤖) Find all instances of engine instantiation.
        • It looks like there's just one in fits_storage.db.__init__.py that's saved. This doesn't cause any issues in the code tests with the future=True flag added to create_engine there.
        • More general search by eye (find fits* -type f -name "*.py" | xargs grep -ni -E "engine\W")
    • Use the future flag on Session
      • (🔧) Find all instances of Session without future=True
        • (🔧) This manifests in sessionmaker(..., future=True, ...).
      • Check for problems with Session instances and how they are invoked.
        • None, it seems like this is mostly enabling features on top of the pre-2.0 ones, beyond some esoteric cases not encountered in FitsStorage2.
    • Add __allow_unmapped__ to explicitly typed ORM models
      • This had no issues.
    • Test with SQLAlchemy 2

Misc. TODO

  • Add check for sqlalchemy version to automated script.

TODO Key

(🤖) - step automated for updates to the codebase
(🔧) - could be automated
(✍️) - in progress
(💥) - major problem

Notes

  • Both and environment variable SQLALCHEMY_WARN_20 and the -W always::DeprecationWarning test3.py flag must be used to actually coax out the RemovedIn20Warnings. Unfortunately, the errors will not always correctly report unless both of these are set.
@teald teald added the enhancement New feature or request label Jun 26, 2024
@teald teald self-assigned this Jun 26, 2024
@teald teald linked a pull request Jul 10, 2024 that will close this issue
@teald teald linked a pull request Jul 10, 2024 that will close this issue
@phirstgemini phirstgemini added this to the SQLAlchemy 2 milestone Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants