if a package name shadows internal context members, terrible things happen #1696
Closed
5 tasks done
Labels
bug
Something isn't working
Milestone
Describe the bug
If you run
dbt compile
,dbt run
, you may get a message like this back:I think we can all agree that this is a very bad error message!
Steps To Reproduce
source
,ref
,log
, ...dbt compile
Various built-in context members might result in similar messages with
function
replaced by another type (also bad) or even silently corrupt dbt internal behavior (much worse)Expected behavior
A clear and concise description of what you expected to happen.
I expect dbt to give me a good error message. Something like
package names may not shadow builtin context members: "log" is not a valid value for package name
is probably fine. This will be annoying when we add new things to contexts and users upgrade, but basically nothing will be as annoying as the current behavior.Screenshots and log output
There's a big long stack trace in the debug log that points to the culprit (see
Additional context
for more on that), but nothing else useful.System information
Which database are you using dbt with?
The output of
dbt --version
:Any >= 0.13.0
The operating system you're using:
Any
The output of
python --version
:Any
Additional context
Some thoughts on fixing this:
dbt.context.common._add_macro_map
via_add_macros
modify_generated_context
, which is what calls_add_macros
, andgenerate_model
(which callsmodify_generated_context
) make this not very straightforward, as we'll also want to explicitly blacklist the following keywords that aren't in the context yet at_add_macros
time:write
,render
,var
,context
,this
,pre_hooks
,post_hooks
,sql
.dbt debug
/dbt ls
/similar as well, which seems like a big upside.The text was updated successfully, but these errors were encountered: