Skip to content

Commit

Permalink
initial push to fix dynamic tables now that they have BASE TABLE as o…
Browse files Browse the repository at this point in the history
…bject type
  • Loading branch information
McKnight-42 committed Mar 19, 2024
1 parent bc24f49 commit a35b9cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dbt/include/snowflake/macros/catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
table_catalog as "table_database",
table_schema as "table_schema",
table_name as "table_name",
coalesce(table_type, 'DYNAMIC TABLE') as "table_type",
case
when target_lag not null and table_type = 'BASE TABLE' THEN 'DYNAMIC TABLE'
else coalesce(table_type, 'BASE TABLE')
end as "table_type",
comment as "table_comment",

-- note: this is the _role_ that owns the table
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/adapter/dynamic_table_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def query_relation_type(project, relation: SnowflakeRelation) -> Optional[str]:
sql = f"""
select
case
when table_type = 'BASE TABLE' and target_lag is not null then 'dynamic_table'
when table_type = 'BASE TABLE' then 'table'
when table_type = 'VIEW' then 'view'
when table_type = 'EXTERNAL TABLE' then 'external_table'
when table_type is null then 'dynamic_table'
end as relation_type
from information_schema.tables
where table_name like '{relation.identifier.upper()}'
Expand Down

0 comments on commit a35b9cc

Please sign in to comment.