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

Removes sqlalchemy_utils dependency #356

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mfulgo
Copy link
Contributor

@mfulgo mfulgo commented Jul 30, 2024

Importing functions from slqalchemy_utils directly causes the entire library to get imported, even though many of the library's modules go unused. Porting only the necessary functions from that library into Continuum should provide improved initialization times.

Closes #357

mfulgo added 6 commits August 8, 2024 12:57
Updates sqlalchemy_utils imports to point at specific packages and
removes a few unused imports.

This was done in hope of not initializing the whole of SA-Utils, but
that requires a different approach.
This is a breaking change because classes copied from SQLAlchemy-Utils
but exposed through this library will have a new parent module.

Utility classes and methods from SQLAlchemy-Utils are all copied into
`sa_utils.py` with no functional changes. Only code required by
Continuum was ported.

Subsequent commits will implement cleanup and other changes discussed in
Updates the `get_primary_keys` method to only return the primary key
columns (without their values) in a list, since the values went unused.
The method is thus renamed to `get_primary_key_columns`.
Quite a bit of the code migrated in from SQLAlchemy-Utils only gets used
within the plugins module. There's no need for us to incur the
initialization expense if those classes and methods aren't needed or
used.

This will only actually have an initialization benefit if the plugins
module does not load every plugin upon import. However, having the code
co-located anyway makes sense.
The function only gets used in one place, so we can move it there and
mark it private.
The function only gets used in one place, so we can move it there and
mark it private.
@mfulgo mfulgo changed the title Optimizes sqlalchemy_utils imports Removes sqlalchemy_utils dependency Aug 8, 2024
Using a relative import allows the library to be more-easily vendored
without having to tweak the import line.
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.

Performance optimizations for imports of sqlalchemy_utils
1 participant