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

Upgrade SQLAlchemy to the latest 2.0.x release #825

Closed
6 tasks done
ccostino opened this issue Feb 28, 2024 · 1 comment
Closed
6 tasks done

Upgrade SQLAlchemy to the latest 2.0.x release #825

ccostino opened this issue Feb 28, 2024 · 1 comment
Assignees
Labels
dependencies Pull requests that update a dependency file engineering python Pull requests that update Python code

Comments

@ccostino
Copy link
Contributor

ccostino commented Feb 28, 2024

The Notify.gov API is still running SQLAlchemy 1.4.x, which is the legacy version; we'd like to upgrade to the latest 2.0.x release to take advantage of the new features, improvements, and security updates. Dependabot continues to try and update this for us, but the PR tests fail because we have to go through a whole migration to get there.

There is a SQLAlchemy 2.0 migration guide that we ought to go through to get a sense of the things we need to look at and double check to make sure we're set. Furthermore, we'll also need keep the Flask-SQLAlchemy dependency in mind as we use that too, since the API is a Flask-based app.

Lastly, we have some current work taking place that will have an impact and should make this a bit easier. @xlorepdarkhelm has been working on swapping out string constants and other custom values to be proper Enums throughout the code base in this pull request, which includes swapping to db.enum fields at the model layer.

We also have @samathad2023 looking at the Python 3.12 upgrade for Notify.gov, which may dovetail with this work as well.

Implementation Sketch and Acceptance Criteria

There are a couple of phases involved with this as we're treating it as a standalone project. First is getting a plan together:

  • Review the SQLAlchemy 2.0 migration guide to note the steps we need to take and what to be on watch fore
  • Check if there are any parts of the 'Flask-SQLAlchemy' plugin that we'll also have to account for
  • Update this issue or create a separate document (especially if there is sensitive information to share) with proposed next steps

If we have more time to go beyond a proposed plan, the next steps would be to get the changes in place and the migration done.

  • Make the necessary adjustments to update our code to work with SQLAlchemy 2.0.x
  • Update SQLAlchemy and any underlying dependencies it also relies on to their latest stable releases
  • Update tests as necessary

Security Considerations

  • We'd like to keep our dependencies up-to-date to stay on top of security updates; this will ensure we can keep other critical components of the application updated (e.g., Flask itself due to the tie with the Flask-SQLAlchemy plugin).
  • We need to make sure that we're mindful of any sensitive configuration pieces (e.g., connection strings, account credentials, etc.) and not committing them to code or sharing them publicly.
@ccostino
Copy link
Contributor Author

ccostino commented May 6, 2024

@aanand-gsa wrote up a great and thorough SQLAlchemy migration guide for our project and worked through these items in PR #946, which is now ready for final review.

The final review and any further updates/improvements will be tracked in this issue: #960

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 engineering python Pull requests that update Python code
Projects
Status: Done
Development

No branches or pull requests

2 participants