Skip to content
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

[CT-1409] [Bug] when there's a variable being called in a jinja block that is not defined in dbt_project.yml, there's an compile error #6145

Closed
2 tasks done
bossnunta opened this issue Oct 26, 2022 · 4 comments
Labels
bug Something isn't working spike stale Issues that have gone stale

Comments

@bossnunta
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Not 100% sure what about this code block causes the error. Possible there's a variable being called inside a jinja block
https://www.loom.com/share/eb8a9d3b57e24e588c5fa8b96e9d13cf

Expected Behavior

We shouldn't show any error here (?) -- see Loom for more info

Steps To Reproduce

  1. Start with an existing project in the Cloud IDE
  2. Choose any existing sql data model
  3. add this block of code
{% if var('random_var_name') != [] %}
,
{{ var('random_var_name') | join (", ")}}

{% endif %}
  1. Save file
  2. Notice the error state from RPC
  3. If you go into dbt_project.yml and define random_var_name, then the error goes away

Relevant log output

No response

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

No response

Additional Context

No response

@bossnunta bossnunta added bug Something isn't working triage labels Oct 26, 2022
@github-actions github-actions bot changed the title [Bug] when there's a variable being called in a jinja block that is not defined in dbt_project.yml, there's an compile error [CT-1409] [Bug] when there's a variable being called in a jinja block that is not defined in dbt_project.yml, there's an compile error Oct 26, 2022
@leahwicz leahwicz added Team:Language support_rotation A good task to pick up during support rotation labels Oct 27, 2022
@jtcohen6
Copy link
Contributor

jtcohen6 commented Nov 3, 2022

After a little digging, there's more history here:

Big idea: At parse time, a missing var actually returns None (to avoid raising errors due to missing vars in disabled models). That works fine sometimes, but not if the variable is expected to support __iter__ type operations. Hence, 'NoneType' object is not iterable.

Going to re-label this one as a spike, to understand what's possible here as far as better UX.

@jtcohen6 jtcohen6 added spike and removed support_rotation A good task to pick up during support rotation labels Nov 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

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 comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label May 3, 2023
@github-actions
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
@jatkins23
Copy link

Wanted to follow up that this is still not resolved if its possible to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working spike stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

5 participants