You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before running models, dbt runs an adapter-specified "hook." Note that this is different from user-configured model hooks. In dbt-snowflake, this is the mechanism we use for calling use warehouse {snowflake_warehouse}, and it's what we should also use for custom secondary roles (and other things in the future).
@jtcohen6@McKnight-42 I'm not sure it resolved the issue with tests using pre/post hooks. When I configure +snowflake_warehouse under tests, it does not seem to take affect. Tests are still being executed with default WH set in the environment. I'm using the latest version.
Housekeeping
Short description
Before running models, dbt runs an adapter-specified "hook." Note that this is different from user-configured model hooks. In
dbt-snowflake
, this is the mechanism we use for callinguse warehouse {snowflake_warehouse}
, and it's what we should also use for custom secondary roles (and other things in the future).Here's where that happens within RunTask:
dbt-core/core/dbt/task/run.py
Lines 285 to 291 in 09243d1
We want the same thing to happen within
TestTask
, for both data + unit tests:dbt-core/core/dbt/task/test.py
Lines 143 to 146 in 09243d1
dbt-core/core/dbt/task/test.py
Lines 216 to 225 in 09243d1
This way, unit + data tests can use custom Snowflake warehouses.
Acceptance criteria
adapter.pre_model_hook
+adapter.post_model_hook
are being called withinTestTask
for unit + data tests.Suggested Tests
I don't think we're doing a great job of testing that
pre_model_hook
andpost_model_hook
are called today.Ideas:
pre_model_hook
andpost_model_hook
that logs, and ensure it logs during test execution.dbt-snowflake
here here. A test configured with asnowflake_warehouse
that does not exist should fail. Today, it doesn't, because it doesn't actually use this config.Impact to Other Teams
Impact: Adapters
Will backports be required?
no
Context
Original issue:
However, compilation is out of scope. This issue is focused only on adding these hook calls to
TestTask
.The text was updated successfully, but these errors were encountered: