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

lazy load agate and add TYPE_CHECKING #126

Merged
merged 6 commits into from
Mar 26, 2024

Conversation

dwreeves
Copy link
Contributor

@dwreeves dwreeves commented Mar 9, 2024

resolves #125

This PR is related to the following open PR in dbt-core: #9744

TLDR: lazy-loading agate speeds up the load time of dbt by about 3.5%. Most instances of agate are unnecessary as dbt only uses it in a select few situations, and most instances of agate can be placed behind TYPE_CHECKING.

You can check that this works as intended by doing the following:

import sys
import dbt.adapters.base.impl
print([i for i in sys.modules if "agate" in i])

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development, and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX

@colin-rogers-dbt
Copy link
Contributor

Thanks for raising this! Really interesting, we will probably want to cascade out to our implementing adapters as well

@dwreeves
Copy link
Contributor Author

Yep, that will be the next step.

I'll get to your comment re: formatting changes, I think that must have been something with the pre-commit setup.

@dwreeves dwreeves force-pushed the speed-up-cli branch 2 times, most recently from f3f927c to b930829 Compare March 26, 2024 03:51
@dwreeves
Copy link
Contributor Author

Fixed

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.

[Feature] Lazy load agate to improve dbt-core performance
2 participants