-
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
preserve empty strings in native env templating #2608
Conversation
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test this, of course...
Do we want to further restrict the set of types that dbt will convert to? The docs say that
So, I'd be ok with documenting and supporting this behavior if we're happy living with it for the foreseeable future. If we have any reservations about something like this though, it could be a good idea to remove support today and consider explicit ways to support these container types in a native env in the future |
so, I know earlier I said that I thought it would be hard to add an as_bool that's the reverse of the default, but maybe I was wrong. What about something like this?
|
That's kind of a reset to the 0.16 behavior, but it makes the native rendering sort of opt-in at the jinja level, with some caveats around the native code generator behaving slightly differently from the standard code generator. Maybe that's what we always wanted? |
You could pretty easily extend this with filters that assert the type, too. so we could implement an It does suck for anyone who was using |
cool, that approach is broadly aligned with how I was thinking about this too. There's a lot to like about the 0.17.0 behavior, but it has too many quirks to be a sane default. I just keep coming back to the case of We're going to need to write something up about this change to make sure folks understand why we changed the behavior in 0.17.0 and why we're changing it back in 0.17.1 (or does this make our next release 0.18.0??). I think most folks would agree that making native env rendering explicit is the right decision long-term, and if that's the case, then it will benefit everyone to make this change as soon as possible. |
Do not merge this PR
Just wanted to call out another issue we're seeing with the Jinja NativeEnv implementation introduced in 0.17.1. This PR fixes a problem where the empty string
''
is converted toNone
.Example:
Here, the test compiles to
....where id not in ('None', 'a')
.I think the number of holes to plug in our current approach to native env rendering is exceeding the number of thumbs we have available to us. Let's regroup and figure out a long-term sustainable approach to type inference for yaml+jinja.