You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current way of running tests is still a little more complex than I would like. We should have a simpler, more dbt-onic solution.
Specifically, one should:
Be able to define the entire unit test inline under the tests block for a model in schema.yml rather than relying on global variables
Be able to run unit tests alongside their other tests without having to materialize new models (other than the seeds)
Not have to use any additional flags unless desired
Practically, we can use a graph node's raw_sql property along with the replace() filter and the render() function to (1) grab the raw SQL for a model, (2) replace selected refs and sources with references to our mocks, and (3) compile the resulting JinjaSQL.
Describe alternatives you've considered
I considered keeping both the previous method and the new method in the package but decided that would be too confusing.
This should make it much easier for people to get started and run unit tests since they don't need to set up separate targets, runs, etc.
The main downside is that you now have to define mappings for each individual test, so it is somewhat less DRY (though there may be a way to use global variables still).
Are you interested in contributing this feature?
Yes
The text was updated successfully, but these errors were encountered:
Describe the feature
The current way of running tests is still a little more complex than I would like. We should have a simpler, more dbt-onic solution.
Specifically, one should:
tests
block for a model inschema.yml
rather than relying on global variablesPractically, we can use a graph node's
raw_sql
property along with thereplace()
filter and therender()
function to (1) grab the raw SQL for a model, (2) replace selected refs and sources with references to our mocks, and (3) compile the resulting JinjaSQL.Describe alternatives you've considered
I considered keeping both the previous method and the new method in the package but decided that would be too confusing.
Additional context
See discussion at dbt-labs/dbt-core#2354 and https://getdbt.slack.com/archives/C2JRRQDTL/p1623417748059300. I'm especially indebted to Josh D. and Mikael R. for these ideas and the
raw_sql
implementation.Who will this benefit?
This should make it much easier for people to get started and run unit tests since they don't need to set up separate targets, runs, etc.
The main downside is that you now have to define mappings for each individual test, so it is somewhat less DRY (though there may be a way to use global variables still).
Are you interested in contributing this feature?
Yes
The text was updated successfully, but these errors were encountered: