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

Wrap DBT models/tests in `{% model %}...{% endmodel %} blocks #1400

Closed
beckjake opened this issue Apr 15, 2019 · 0 comments · Fixed by #1407
Closed

Wrap DBT models/tests in `{% model %}...{% endmodel %} blocks #1400

beckjake opened this issue Apr 15, 2019 · 0 comments · Fixed by #1407

Comments

@beckjake
Copy link
Contributor

beckjake commented Apr 15, 2019

Feature

Wrap DBT models/tests in {% model %}...{% endmodel %} blocks

Feature description

When we read in a sql file that is a model, we should optionally wrap it in a {% model %} block. Then we should run dbt's top-level jinja block parser over it and make sure the output matches the contents of the sql file, and either raise or log a warning.

Model blocks should probably be named using the basename of the sql file they were found in just for coherency, but it doesn't really matter.

This should be behind a (hidden?) flag to dbt compile/run.

We should do the same when generating tests - after we build the string, wrap it in a block, extract that block, and make sure it matches.

Who will this benefit?

This will help us shake out any bugs around block parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant