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

refactor: Ensure Flask-Migrate leverages the Flask-SQLAlchemy session #26172

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Dec 5, 2023

SUMMARY

Somewhat related to #26186 (though for Alembic migrations) this PR ensures that the remainder of the codebase (excluding tests and Alembic migrations) leverage the Flask-SQLAlchemy session (db.session).

This refactor helps to reduce the code complexity and ensures we're not generating any rouge sessions which are often not explicitly closed and can lead to connection pooling issues.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI.

ADDITIONAL INFORMATION

  • Has associated issue: [SIP-99A] Primer on managing SQLAlchemy sessions #25107
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@john-bodley john-bodley force-pushed the john-bodley--sip-99-alembic-session branch from 3609a02 to 8c652ff Compare December 5, 2023 05:08
@john-bodley john-bodley changed the title chore: Leverage Flask-SQLAlchemy session for Alembic migrations chore: Ensure Alembic migrations leverage Flask-SQLAlchemy session Dec 6, 2023
@john-bodley john-bodley force-pushed the john-bodley--sip-99-alembic-session branch 3 times, most recently from 731f304 to 9ff99f8 Compare December 7, 2023 06:00
@john-bodley john-bodley force-pushed the john-bodley--sip-99-alembic-session branch from 9ff99f8 to 1b22222 Compare December 7, 2023 16:06
@john-bodley john-bodley changed the title chore: Ensure Alembic migrations leverage Flask-SQLAlchemy session refactor: Ensure Alembic migrations leverage Flask-SQLAlchemy session Dec 8, 2023
@john-bodley john-bodley changed the title refactor: Ensure Alembic migrations leverage Flask-SQLAlchemy session refactor: Ensure Flask-Migrate migrations leverage Flask-SQLAlchemy session Dec 11, 2023
@john-bodley john-bodley changed the title refactor: Ensure Flask-Migrate migrations leverage Flask-SQLAlchemy session refactor: Ensure Flask-Migrate migrations leverage the Flask-SQLAlchemy session Dec 11, 2023
@john-bodley john-bodley changed the title refactor: Ensure Flask-Migrate migrations leverage the Flask-SQLAlchemy session refactor: Ensure Flask-Migrate leverages the Flask-SQLAlchemy session Dec 11, 2023
@john-bodley
Copy link
Member Author

Sadly I think this effort needs to be abandoned per miguelgrinberg/Flask-Migrate#534.

@john-bodley john-bodley deleted the john-bodley--sip-99-alembic-session branch June 28, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant