-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 1629/052 column quoting tests conversion #6652
Ct 1629/052 column quoting tests conversion #6652
Conversation
These tests do exist in our adapter plugins today, having been copy-pasted there from this repo back in 2021:
We should pursue one of the following options:
Let's make a call one way or the other. I do know that different databases have, at the very least, different characters used for quoting columns/identifiers (e.g. |
I'm opting for 2 here because if we really need to test those backticks, we can using tests specifically for that. Good catch on the strategy too. I'll chop that out. |
if this is postgres specific can we indicate that in some way? Either in the test file name or folder structure (that way we prevent having these be copy pasted again) |
I would vote the latter. If I understand correctly, we want to eventually create a dbt-postgres adapter that is separate from dbt-core. The migration will be easier to do if we isolate the postgres-specific items higher up in the directory structure. |
@colin-rogers-dbt Sorry if I'm misreading here, but I thought this specifically was not postgres-specific, rather this is a general test for column quoting functionality. My question was whether it was Postgres specific (and we decided it's not). |
My vote for the inherit-modify patternMy default opinion is for this option:
Reasons:
Inherit-modify is often simpleInheriting a test within an adapter is often as simple as this: from dbt.tests.adapter.utils.test_any_value import BaseAnyValue
class TestAnyValue(BaseAnyValue):
pass The inherit-modify pattern is a boon for adapter maintainers -- by doing very little, they can proactively see if there's a known issue (with their quoting logic, for example). Alternatives aren't greatIn the alternatives to the inherit-modify pattern, the maintainer(s) need to:
Both those options feel like a method of last resort rather than our best bet. This particular testLet's consider the following proposal for this particular test of enabling/disabling
Is the test written in an adapter-agnostic manner? Yeah! It looks like it would work across a wide variety of adapters, even if their quoting characters were single quotes, backticks, or the 🧠 emoji. Would the results of the test be adapter-specific / adapter-contingent? I suspect they would! Depending on all the various knobs and levers an adapter maintainer can turn and pull, inheriting this test could help them quickly see if they have an unintended consequence, like breaking ConclusionI'm happy to be wrong about if this test happens to have truly adapter-contingent results or not -- it's actually irrelevant to the crux of my opinion. My main point is that we want to do as much as possible to help maintainers see a potential problem that it would be hard for them to foresee on their own, and the inherit-modify pattern does just that. |
Chitchatted about this elsewhere. We're going to take this into a bigger convo since this is super important in designing out the adapter test suite. But for now, I'm going to merge this, and wrap up this conversion. |
resolves #6403
Description
Test conversion.
Do we want to see these quoting tests ported to any other DBs? I suspect "no" because they were quoting rules specifically for Postgres. We should instead go write quoting specific tests for adapters for which they don't already exist, right?
Also, just a lil' shoutout: On my last test conversion, @mikealfare suggested I look into thealas, this is not needed in the current circumstance, but the magic lives on in commit historyparameterize
decorator, which I was able to use in this PR to help things be morepytest
like. Just had to discover the nearly undocumented magic ofindirect=True
andrequest.param
Checklist