Skip to content
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

Use adapter macro pattern for core schema tests #2415

Closed
drewbanin opened this issue May 7, 2020 · 3 comments · Fixed by #2684
Closed

Use adapter macro pattern for core schema tests #2415

drewbanin opened this issue May 7, 2020 · 3 comments · Fixed by #2684
Labels
adapter_plugins Issues relating to third-party adapter plugins enhancement New feature or request

Comments

@drewbanin
Copy link
Contributor

Describe the feature

Let's use the adapter macro pattern to implement dbt's core schema tests. This will allow package maintainers to override the mechanics of the SQL for their plugin if need be.

Describe alternatives you've considered

Change macro loading precedence to allow plugin maintainers to override the macros directly? That feels worse.

Who will this benefit?

  • helpful for community contributed plugin maintainers
@drewbanin drewbanin added the enhancement New feature or request label May 7, 2020
@drewbanin drewbanin added this to the dbt-next milestone May 7, 2020
@jtcohen6
Copy link
Contributor

jtcohen6 commented May 7, 2020

The thing that will be less good about this—until we have a better answer (#2301, #2302)—is that it wouldn't be possible to override a builtin schema test from the root project.

The ability to change the behavior of the unique test by creating a local macro test_unique is something we mention frequently, especially when teaching about Jinja + dbt. That's not to say we couldn't teach it differently.

@beckjake
Copy link
Contributor

beckjake commented May 7, 2020

@jtcohen6 I think you still could! The macro from the project can just override the base macro name. This issue is only a problem for plugins, because plugin macros live in the dbt namespace.

@jtcohen6
Copy link
Contributor

jtcohen6 commented May 7, 2020

Oh, you're right! So even though you couldn't override default__test_unique, or (e.g.) sqlserver__test_unique, you could just override test_unique itself. Objection withdrawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter_plugins Issues relating to third-party adapter plugins enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants