dbt-redshift
dbt-redshift copied to clipboard
lazy load `agate`
resolves #745
Problem
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.
Already implemented in dbt-adapters and dbt-core.
- https://github.com/dbt-labs/dbt-adapters/pull/126
- https://github.com/dbt-labs/dbt-core/pull/9744
Check performed (should return empty list):
import sys
import dbt.adapters.redshift.impl
print([i for i in sys.modules if "agate" in i])
Solution
from typing import TYPE_CHECKING
Checklist
- [x] I have read the contributing guide and understand what's expected of me
- [x] I have run this code in development and it appears to resolve the stated issue
- [x] This PR includes tests, or tests are not required/relevant for this PR
- [x] 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