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
| -- 1) summary output below across all tables | |
| with dbt_objects as ( | |
| -- get list of tables maintained by dbt | |
| SELECT | |
| t.source_table_full_name, | |
| count(distinct h.statement_id) as dbt_query_count | |
| FROM system.query.history AS h | |
| LEFT JOIN system.access.table_lineage AS t | |
| ON t.statement_id = h.cache_origin_statement_id |
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
| {% macro xref() %} | |
| -- extract user-provided positional and keyword arguments | |
| {% set version = kwargs.get('version') %} | |
| {% if (varargs | length) == 1 %} | |
| {% set modelname = varargs[0] %} | |
| {% else %} | |
| {% set packagename = varargs[0] %} | |
| {% set modelname = varargs[1] %} | |
| {% endif %} |
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
| {%- materialization test, adapter='synapse' -%} | |
| {% set relations = [] %} | |
| {% if should_store_failures() %} | |
| {% set identifier = model['alias'] %} | |
| {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %} | |
| {% set store_failures_as = config.get('store_failures_as') %} |
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
| {%- materialization test, adapter='fabric' -%} | |
| {% set relations = [] %} | |
| {% set limit = config.get('limit') %} | |
| {% set fail_calc = config.get('fail_calc') %} | |
| {% set warn_if = config.get('warn_if') %} | |
| {% set error_if = config.get('error_if') %} | |
| {% set number_of_errors = 0 %} | |
| {% if should_store_failures() %} |
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
| {{ | |
| config( | |
| materialized='table' | |
| ) | |
| }} | |
| with | |
| source as ( |
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
| {{ config( | |
| tags=["finance"] | |
| ) }} | |
| {% macro centralize_test_failures(results) %} | |
| {# --add "{{ centralize_test_failures(results) }}" to an on-run-end: block in dbt_project.yml #} | |
| {# --run with dbt build --store-failures. #} | |
| {%- set test_results = [] -%} | |
| {%- for result in results -%} |
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
| with campaigns as ( | |
| select * from {{ ref('stg_campaigns') }} | |
| ), | |
| campaign_sequence as ( | |
| select * from {{ ref('stg_campaign_sequence') }} | |
| ), | |
| final as ( | |
| select | |
| campaign_sequence.campaign_id, |
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
| version: 2 | |
| sources: | |
| - name: csv_load | |
| database: adinsmoor_sandbox_dev | |
| schema: loading_layer | |
| tables: | |
| - name: sw_line_input | |
| - name: recipe |
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
| -- Exercise 1: Define a staging model (stg_player.sql) | |
| with player as ( | |
| select * from {{ source('fifa', 'player') }} | |
| ) | |
| select | |
| id as player_id | |
| , affiliation_id | |
| , concat(player_first_name, ' ', player_last_name) as player_name |
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
| -- Exercise 1: Define a staging model (stg_player.sql) | |
| with player as ( | |
| select * from {{ source('fifa', 'player') }} | |
| ) | |
| select | |
| id as player_id | |
| , affiliation_id | |
| , concat(player_first_name, ' ', player_last_name) as player_name |
NewerOlder