-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Bug] on-start-run executes during compilation #4445
Comments
@tekumara Thanks for opening! The We do need to update the docs for The good news is, in v1.0, there is now a context variable available from the {% macro run_start() %}
{% if execute and flags.WHICH in ('run', 'build') %}
{{ dbt_utils.log_info("🏁 \033[1m Let's go! 🏁 \033[0m")}}
{% set results = run_query('select 1 from foobar') %}
{% endif %}
{% endmacro %} Be advised, you should not use any values of |
Since there's a viable workaround in v1.0, I'm going to close this as a |
Thanks for the explanation and workaround @jtcohen6! If the |
That's fair! |
Or how about |
Is there an existing issue for this?
Current Behavior
on-start-run executes macros during
dbt docs
anddbt compile
even when inside anif execute
conditional.Expected Behavior
dbt docs and dbt compile don't run macro code inside an
if execute
conditionalSteps To Reproduce
macros/run_start.sql
dbt_project.yml
Relevant log output
Environment
What database are you using dbt with?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: