-
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
Check length of escaped strings in the adapter test #6567
Conversation
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.
LGTM, I like defining the tests and expected values in SQL.
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.
First, we really appreciate you made those validation PRs first.
Really intriguing! So, the adapter maintainer picked a macro quoting policy that did not coordinate to the realities of their database system? Curious!
I like how the tests are defined and the numeric confirmation is key.
My only concern is this absolutely insane case that does happen and might be important to clarify:
'{{ escape_single_quotes('they're') }}'
Double quotes really aren't that sacred and on first glance, it'd be hard to know this what (at least on Snowflake) the quoting policy function does.
^So like, this is a thing...that worksI figure we should add a case to account for this. What's your thought?
Oops didn't get my message in before you went on the merge |
Yep! In this case, it was us as the maintainers of dbt-spark 😅. Since it was so easy to accidentally overlook, it provided motivation to open #6566 to make it hard to get wrong. Based on our DM's, it seems like part of your concern is that we're covering test cases like: I tried the latter in my local environment, and it gave the following error:
I think the issue is that Based on my current understanding, I'm comfortable with the changes made by this PR. But I'm open to continued discussion if we're missing something important. |
Got it. So, on some db's (like Spark) it'll be a syntax error and on others (like Snowflake), both options will work -- what a nightmare hah.
My concern was around that last of the three. I hope we have literature or guidance somewhere that makes this clear, because otherwise, that's some deep arcane type magic that would have bothered (among others) early career data engineer me 😄 Agreed this Issue is resolved. Reclosing the issue. Thanks Doug! |
resolves #6566
See the following PRs for context and validation that it doesn't break any dbt Labs adapters:
Description
Adapter maintainers can choose to extend one of the following pytests (which are expected to be mutually exclusive):
We've observed at least one case where the adapter made the wrong choice but the test passed. This PR aims to trigger a CI failure if the wrong choice is made accidentally, and I validated that is does so here.
Checklist
changie new
to create a changelog entry