The problem I’m having
I am using Snowflake as a DWH and during a dbt run
I want to set the USE_CACHED_RESULT
parameter to false for the whole run.
I already put it under the on-run-start
dbt_project.yml
on-run-start:
- "alter session set use_cached_result = false"
But when I look into the query history of Snowflake, I see different session ids in the whole run so I guess the parameter is not set for the whole dbt run
I can use it in a pre-hook also so that for every model it unset the parameter before running it but it’s a lot of queries.
Is there a way to set it only once ?
I am wondering how dbt uses the session in Snowflake, is it
- one session per model
- one session per statement (but I see several statements with the same session id)
Edit
I tried using the ALTER statement in the pre-hook key.
- the ALTER statement is executed in the same session as the subsequent model
- but the query still fetches results from cache anyway
Thanks for your help.