Add Semantic View as Materialization#7
Open
sfc-gh-yutliu wants to merge 12 commits into
Open
Conversation
|
Thank you for your pull request! We could not find a changelog entry for this change in the dbt-snowflake package. For details on how to document a change, see the Contributing Guide. |
993aeff to
611fb1a
Compare
006f465 to
c6124be
Compare
sfc-gh-yutliu
commented
Aug 25, 2025
| {%- set _sql_norm = _sql_norm[:-1] if _sql_norm[-1:] == ';' else _sql_norm -%} | ||
| {%- set _sql_norm = _sql_norm | trim -%} | ||
| {%- set _ends = (_sql_norm | lower)[-11:] -%} | ||
| {%- if _ends != 'copy grants' -%} |
Author
There was a problem hiding this comment.
Check if 'copy grant' before comment works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 dbt-labs#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.pytest_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 viewcommand.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