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 2.0 InitPluginProtocol implementation. #1395

Merged
merged 20 commits into from Mar 30, 2023

Conversation

peterschutt
Copy link
Contributor

@peterschutt peterschutt commented Mar 27, 2023

A plugin for automated SQLAlchemy application configuration.

Features in addition to the 1.x plugin:

  • separate configuration objects for sync and async
  • session and engine dependencies

Closes #983

Pull Request Checklist

  • New code has 100% test coverage
  • (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
  • (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR

By submitting this issue, you agree to:

Description

Close Issue(s)

@peterschutt peterschutt requested review from a team and JacobCoffee as code owners March 27, 2023 02:48
@provinzkraut
Copy link
Member

Looks good to me aside from the naming. Unless there's going to be another SQLAlchemyPlugin, SQLAlchemyInitPlugin feels a bit unnecessary as I don't see why this implementation detail needs to be reflected in the name.

Copy link
Member

@cofin cofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! I don't have anything to add here. LGTM

@peterschutt
Copy link
Contributor Author

Looks good to me aside from the naming. Unless there's going to be another SQLAlchemyPlugin, SQLAlchemyInitPlugin feels a bit unnecessary as I don't see why this implementation detail needs to be reflected in the name.

Once I work out what it looks like - there will also be a SQLAlchemySerializationPlugin and then SQLAlchemyPlugin would inherit from both to have both app config and serialization behavior, which is pretty much feature parity for the plugin in 1.x.

@provinzkraut
Copy link
Member

Once I work out what it looks like - there will also be a SQLAlchemySerializationPlugin and then SQLAlchemyPlugin would inherit from both

Okay, that makes perfect sense 👍

# Conflicts:
#	starlite/utils/dataclass.py
#	tests/utils/test_dataclass.py
Copy link
Member

@provinzkraut provinzkraut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few documentation comments

docs/reference/contrib/sqlalchemy/config/common.rst Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/asyncio.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/asyncio.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/common.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/common.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/common.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/common.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/common.py Outdated Show resolved Hide resolved
starlite/contrib/sqlalchemy/init_plugin/config/sync.py Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Mar 30, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@peterschutt peterschutt merged commit 2bbdfcc into main Mar 30, 2023
13 of 14 checks passed
@peterschutt peterschutt deleted the sqlalchemy-20-plugin branch March 30, 2023 05:44
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.

Enhancement: Update SQLAlchemy Plugin to use SQLA 2.0
3 participants