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

Avoid loading the schema from db #242

Closed
wants to merge 1 commit into from
Closed

Conversation

MatBarba
Copy link
Contributor

@MatBarba MatBarba commented Dec 6, 2023

DBConnection loads the whole schema in its init, which takes a lot of time and is not actually needed apart from getting meta data. In this PR I override the init without the schema loading (that does make the pylint fail obviously).

NB: this is mostly to accelerate the db_factory (which needs to get metadata for all the databases it lists). Without this fix, the db_factory takes minutes to run (instead of seconds) when it tries to read lots of dbs.

That means the meta checks (schema_type) can't be done that readily, so I've overriden that part for the purpose of my script (that said it should probably not even use the SQLalchemy Meta model here: a raw SQL query might actually be better in the initial code).

This PR is not meant to be merged as is as it is probably not the best solution (though it does work).

DBConnection loads the whole schema in its __init__, which takes a lot
of time and is not actually needed apart from getting meta data.

Though that means the meta checks (schema_type) can't be done that
readily, so I've overriden that part for the purpose of my script.
@MatBarba MatBarba self-assigned this Dec 6, 2023
@MatBarba MatBarba mentioned this pull request Feb 14, 2024
@MatBarba MatBarba closed this Feb 14, 2024
@MatBarba
Copy link
Contributor Author

Better version: #295

@MatBarba MatBarba deleted the mbarba/faster_core branch February 14, 2024 16:48
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.

1 participant