-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Jinja Comments included in dbt run SQL causing Database Error #2707
Comments
@bcolbert978 Thanks for raising this, it's definitely a bug. I noticed that this error only crops if there is no other Jinja code in the file. If there is other Jinja (set statements, macro calls, etc.) the comment is appropriate scrubbed from the compiled SQL. If the only Jinja code is Jinja comments, then the comment is included in the compiled code. That's likely why we didn't see this bug crop up sooner: most models have at least one of I confirmed that the Jinja comment is scrubbed out in v0.16.1, so this appears to be a v0.17 regression. I imagine the fix is straightforward, so I'd like to fit it in for v0.18.0 if possible. It's an awkward bug, even if it doesn't affect a lot of projects. |
Makes sense - yes, we came across it on our slow-moving Google Sheet imports which don't do any |
Thank you for narrowing it down Jeremy, that tells me exactly what's wrong. This is almost certainly caused by this regex, which is the basis for a performance optimization added on 0.17. We bypass rendering if there's no |
This may also be the cause of #2621 |
Describe the bug
In previous versions of dbt, Jinja comments were supported, allowing us to leave blocks of notes inside this templating pattern:
{# comment #}
and have those notes excluded from the compiled and executed SQL.The SQL output of
dbt compile
looks fine, but the output ofdbt run
ordbt run --full-refresh
both seem to include the comments, including the braces, which is resulting in Database errors.Steps To Reproduce
create a simple model with a Jinja comment, such as:
Expected behavior
DBT run should execute only
select * from source_data_raw.spreadsheet_data
and exclude the comment.Screenshots and log output
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
MacOS Catalina, 10.15.6 (19G2021)
The output of
python --version
:Python 3.6.6 :: Anaconda, Inc.
Additional context
originally posted in #support on dbt slack: link
The text was updated successfully, but these errors were encountered: