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
- name: orders_summary | |
columns: | |
- name: customer_key | |
tests: | |
- not_null |
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 clone_prod_to_target(from_schema, from_database='analytics') -%} | |
{# The role that executes these statements will be the owner of the created schema and objects #} | |
{%- set sql -%} | |
create schema if not exists {{ target.database }}.{{ target.schema }} clone {{ from_database }}.{{ from_schema }} with managed access; | |
{%- endset -%} | |
{{ log("Cloning schema " ~ from_database ~ "." ~ from_schema ~ " into " ~ target.database | lower ~ "." ~ target.schema, info = true) }} | |
{%- do run_query(sql) -%} |
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 source as ( | |
select * from {{ source('jaffle_shop', 'customers') }} | |
), | |
renamed as ( | |
select | |
id as customer_id, | |
first_name, | |
last_name | |
from source |
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
/* | |
--add "{{ store_test_results(results) }}" to an on-run-end: block in dbt_project.yml | |
--The next v.1.0.X release of dbt will include post run hooks for dbt test! | |
*/ | |
{% macro store_test_results(results) %} | |
{%- set test_results = [] -%} | |
{%- for result in results if result.node.resource_type == 'test' -%} | |
{%- set test_results = test_results.append(result) -%} | |
{%- endfor -%} |