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
Iterating over the results of a missing macro results in an unhelpful error
Issue description
Iterating over the result of a macro that's missing causes dbt to fail during parsing (eek) with a TypeError (double eek).
This is pretty common when users are using macros in an external package that return iterables (like dbt_utils.group_by()) and forget to run dbt deps.
The core problem is that our ParserMacroCapture override for Undefined during parsing has this:
def __call__(self, *args,**kwargs):
return True
So any missing macros return True during parsing, and you can't iterate over that!
As a workaround, users can intuit that they need to run dbt deps, and then everything will work. But we should really make this error message less awful, and not require a deep understanding of jinja/dbt's internals to figure out what's happening.
Results
What I got:
$ dbt compile
Running with dbt=0.13.0
Encountered an error:
'bool' object is not iterable
What I expected:
Running with dbt=0.13.0
Found 1 models, 0 tests, 1 archives, 0 analyses, 101 macros, 0 operations, 0 seed files, 1 sources
07:50:51 | Concurrency: 2 threads (target='default')
07:50:51 |
Encountered an error:
Runtime Error
Compilation Error in model x (models/x.sql)
'missing_macro' is undefined
System information
dbt: Happens on 0.13.0, I assume most earlier versions as well.
OS/Python version agnostic.
Steps to reproduce
$ cat models/x.sql
{% for x in missing_macro() %}
{% endfor %}
$ dbt compile
Running with dbt=0.13.0
Encountered an error:
'bool' object is not iterable
The text was updated successfully, but these errors were encountered:
Issue
Iterating over the results of a missing macro results in an unhelpful error
Issue description
Iterating over the result of a macro that's missing causes dbt to fail during parsing (eek) with a
TypeError
(double eek).This is pretty common when users are using macros in an external package that return iterables (like
dbt_utils.group_by()
) and forget to rundbt deps
.The core problem is that our
ParserMacroCapture
override forUndefined
during parsing has this:So any missing macros return
True
during parsing, and you can't iterate over that!As a workaround, users can intuit that they need to run
dbt deps
, and then everything will work. But we should really make this error message less awful, and not require a deep understanding of jinja/dbt's internals to figure out what's happening.Results
What I got:
What I expected:
System information
dbt: Happens on 0.13.0, I assume most earlier versions as well.
OS/Python version agnostic.
Steps to reproduce
The text was updated successfully, but these errors were encountered: