Conversation
c869f7b to
4dbeba3
Compare
|
|
||
| # Add debug function conditionally both with dbt or sqlmesh equivalent flag | ||
| if os.environ.get("DBT_MACRO_DEBUGGING") or debug_mode_enabled(): | ||
| BUILTIN_GLOBALS["debug"] = debug |
There was a problem hiding this comment.
What does dbt do with a debug() call where DBT_MACRO_DEBUGGING is not set?
Does it just no-op, or does it throw an error? Because if it no-op's then wouldnt we need to always include it in the builtin globals and move the "is enabled?" check to within the implementation of debug()?
There was a problem hiding this comment.
yes the latter, they have it under a conditional as well so that it throws an error (maybe since they warn "Do not deploy code to production that uses the debug macro" to ensure this is only for debugging. This is why I wanted to exactly mirror their approach to get the same result.
so running dbt when the flag is not set you get an error it is undefined:
06:44:48 Encountered an error:
Compilation Error in operation jaffle_shop-on-run-end-0 (./dbt_project.yml)
'debug' is undefinedand for sqlmesh you'd get similarly the undefined error:
Error: An error occurred during rendering of the 'after_all' statements:
Could not render or parse jinja at 'None'.
'debug' is undefined4dbeba3 to
3788630
Compare
3788630 to
bff4d90
Compare
This adds support for dbt's debug macro in a dbt project which opens an iPython debugger in the context of a macro
{% macro my_macro() %} {% set something_complex = my_complicated_macro() %} {{ debug() }} {% endmacro %}This is enabled both by using the dbt
DBT_MACRO_DEBUGGINGenvironment variable or the sqlmesh native:SQLMESH_DEBUGor running with--debugflag.