Var does not exist exception not being caught
See original GitHub issueDescribe the bug
Var does not exist exception not being caught when var being directly referenced in a loop
Steps To Reproduce
For a given example model Example 1
select {{ var('var_that_doesnt_exist') }} as example_field
will raise an exception: Required var 'var_that_doesnt_exist' not found in config:
,
followed by a list of all the vars supplied to that model.
Example 2
{% for items in var('var_that_doesnt_exist') %}
select {{loop.index}} as example_field_{{loop.index}}
{% endfor %}
will raise an exception: 'NoneType' object is not iterable
. This is typically found in YAML config issues and such can be confusing in many cases as it’s not a typical var style exception.
Expected behavior
Examples 1 and 2 to raise the same error (Required var 'var_that_doesnt_exist' not found in config:
etc). Example 2 is currently failing during the dbt compile
.
I’m happy to fix this up if someone points me in the right direction!
System information
Which database are you using dbt with?
- postgres
- redshift
- bigquery
- snowflake
- other (specify: ____________)
The output of dbt --version
:
installed version: 0.18.1
latest version: 0.19.1
Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation
Plugins:
- snowflake: 0.18.1
- bigquery: 0.18.1
- postgres: 0.18.1
- redshift: 0.18.1
The operating system you’re using: Mac
The output of python --version
: Python 3.7.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Hey @jtcohen6 sorry for slow response on this one. I’m not going quiet deliberately, i’ll try to follow up with some context of how I’m seeing users getting this issue (hint - i’m developing packages)
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.