-
Notifications
You must be signed in to change notification settings - Fork 14
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
[Feature] Support Unit Testing on Materialized Views #111
Labels
enhancement
New feature or request
materialized_views
unit tests
Issues related to built-in dbt unit testing functionality
Comments
Thank you so much for providing such an easy, reproducible example! We will take a look at this |
amychen1776
changed the title
[Bug] Unit tests don't work if referenced model is a materialized view
[Feature] Support Unit Testing on Materialized Views
Aug 28, 2024
amychen1776
added
enhancement
New feature or request
unit tests
Issues related to built-in dbt unit testing functionality
and removed
bug
Something isn't working
labels
Aug 28, 2024
1 task
matthewshaver
pushed a commit
to dbt-labs/docs.getdbt.com
that referenced
this issue
Aug 29, 2024
…ized view` materialization (#5986) [Preview](https://docs-getdbt-com-git-dbeatty10-patch-1-dbt-labs.vercel.app/docs/build/unit-tests#before-you-begin) ## What are you changing in this pull request and why? We currently don't support unit testing models that use the [`materialized view`](https://docs.getdbt.com/docs/build/materializations#materialized-view) materialization= See dbt-labs/dbt-postgres#111 ## Checklist - [x] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. --------- Co-authored-by: Mirna Wong <[email protected]>
Hi @amychen1776 , just making sure I'm following: The decision was not to support this functionality, but to document that it isn't supported? |
@bdewilde For the short term, we are going to document this limitation. But we do want to tackle this support and the core team is going to look into scoping this out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
materialized_views
unit tests
Issues related to built-in dbt unit testing functionality
Is this a new bug?
Current Behavior
As of dbt v1.8.1, if a model depends upon another model for which
materialized="materialized_view"
, any unit tests on the former model fail with a compilation error:Not able to get columns for unit test X from relation Y because the relation doesn't exist
. If the referenced model is materialized as a table, no error is raised; if the model being tested is a materialized view (and the reference model is a table), no error is raised.Expected Behavior
I would expect unit tests to function regardless of referenced model's materialization. I don't see this listed as a limitation here.
Steps To Reproduce
file:
model1.sql
file:
model2.sql
file:
_unit_tests.yml
$ dbt-postgres test --select test_matview
Relevant log output
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: