File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
visualize/streamlit/loans-example Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -135,13 +135,16 @@ models:
135135 +transient : " {{ 'false' if target.name == 'prd' else 'true' }}"
136136 copy_grants : true
137137
138+ # This creates a view in snowflake that will track failures. Usefull for dynamic tables dbt isnt refreshing
139+ # Run dbt with: --vars '{"persist_tests": "true", "tests_model": "test_failures"}'
138140on-run-end :
139141 - " {{ create_test_failure_view(results) }}"
140142
141-
143+ # In development, this will be created in your user schema
142144data_tests :
143145 +store_failures : true
144146 +schema : DBT_TEST__AUDIT
147+ +store_failures_as : view
145148
146149vars :
147150 ' dbt_date:time_zone ' : ' America/Los_Angeles'
Original file line number Diff line number Diff line change 1414 where 1 = 0
1515# }
1616
17+ {# dbt must be wirh with --vars '{"persist_tests": "true", "tests_model": "test_failures"}' #}
18+
1719{% macro create_test_failure_view(results) - %}
18- {%- if execute - %}
20+ {% if execute and var( ' persist_tests ' , ' false ' ) == ' true ' %}
1921 {% set test_failures_unique_id = " model." ~ project_name ~ " .stg_test_failures" %}
2022 {% set test_selects = [] %}
2123 {% set test_failures_node = graph .nodes [test_failures_unique_id] %}
Original file line number Diff line number Diff line change @@ -80,3 +80,17 @@ select * from balboa.l3_loan_analytics.loans_by_state order by NUMBER_OF_LOANS d
8080
8181select * from balboa_dev .gomezn .loans_by_state__standard;
8282select * from balboa_dev .gomezn .loans_by_state__dynamic;
83+
84+
85+ SELECT table_catalog,
86+ table_schema,
87+ table_name,
88+ is_dynamic
89+ FROM BALBOA .INFORMATION_SCHEMA .TABLES
90+ WHERE is_dynamic = ' YES' ;
91+
92+ -- Grant access to all existing dynamic tables in a schema
93+ GRANT SELECT ON ALL DYNAMIC TABLES IN DATABASE BALBOA TO ROLE CATALOG;
94+
95+ -- For future dynamic tables, you'll want to grant future privileges
96+ GRANT SELECT ON FUTURE DYNAMIC TABLES IN DATABASE BALBOA TO ROLE CATALOG;
You can’t perform that action at this time.
0 commit comments