-
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
yaml quoting not working with NativeEnvironment jinja evaluator #2597
Comments
Is this a dupe of #2468 ? |
I don't think so -- the issue here is that strings like |
As I understand it, a resolution to #2468 could offer a resolution here too, if Cringe-y, but this does work: - relationships:
to: ref('my_first_dbt_model')
field: '''"MyId"''' |
yeah - I believe that this is a yaml/jinja parsing/rendering issue. If that's the case, we should fix this for 0.17.1. If not, then we can investigate other options. My instinct here is that this isn't directly related to the |
Well I'm not sure how we can handle that without customizing the yaml/jinja parsing stuff further. Yaml eats one level of quotes, jinja eats another. Neither part really "knows" about quoting. I think the best fix is to honor the |
These configs aren't typed as database identifiers -- I don't think the Didn't we take specific action to preserve these quotes? I see the |
It was removed as part of #2395 because (I thought) we were successfully avoiding calling the renderer on column names. We can put it back, I guess. |
Ok, thanks for the info. I just don't like the idea of dbt needing to be overly smart about where/when it chomps off wrapping quotes. The column name change in #2395 is a good one, but I'd hesitate to add similar logic for the
Do you recall if there were any specific drawbacks related to the addition of |
It was just another layer of difficult-to-predict behavior. It had some weird potential special-case behavior where we'd potentially requote things that shouldn't be requoted. I think something like |
Edit: this didn't work after all, so we've moved back to 16 for now 🙃 |
hey @dmarts - that's not good. I'm not sure what the right way to address this use-case is at present, but it's definitely something that should work in some way in dbt. Going to give this a think and follow back up here |
errr..... I might have misunderstood your use case! Are you just trying to supply a list of columns to That's a bit of a tricky concept. Let's consider the example:
In this example:
I think that if you're providing an identifier to a macro like The two sets of quotes are necessary because this file is first parsed by dbt's YAML parser. To YAML, So, we need to use two sets of quotes here, and the PR above does just that. I'm going to close this issue out, but I'm more than happy to continue the discussion. Please let me know if I missed anything or if you have any questions about the fix. |
Describe the bug
dbt's NativeEnvironment introduced a functional change to how Jinja strings are evaluated. In dbt v0.17.0, a schema test can no longer be configured with a quoted column name.
Steps To Reproduce
Results:
Expected behavior
I would expect the yaml/jinja string
'"MyId"'
to be resolved to the string"MyId"
, notMyId
.The output of
dbt --version
:The operating system you're using: macOS
The output of
python --version
: 3.7.7Additional context
Using
Jinja2==2.11.2
The text was updated successfully, but these errors were encountered: