Add semantic view as materialization #1312
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #1260
dbt-labs/docs.getdbt.com/#
Problem
dbt-snowflake did not support the new Snowflake "semantic view" relation type, so dbt users could not create or manage semantic views as first-class dbt resources or materializations. There was no materialization, build support, or test coverage for semantic views.
Solution
Snowflake Semantic Views in DBT
This pr adds support for "semantic view" as a new materialization in the dbt-snowflake adapter. It introduces the necessary logic, macros, SQL generation, and tests to enable creating, dropping, and renaming semantic views in Snowflake via dbt.
Test
tests/functional/semantic_view/test_semantic_view_basic.py
passedtest_create_semantic_view
: semantic view model refers to raw table (usesource(<raw_table>)
) and table model (useref(<table_model>)
).test_table_refer_to_semantic_view
: table model refers to a semantic view model (useref(<semantic_view_model>)
).test_table_refer_to_raw_semantic_view
: table model refers to raw semantic view (use source(<semantic_view>))test_semantic_view_comment
: test description is recorded bycomment on semantic view
command.test_semantic_view_copy_grants_logic
: test copy grants configuration is properly handled.test_semantic_view_with_ca_extension
: test Cortex Analyst Extension query is properly handled in DBT.Checklist