-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a86d2b9
commit 8379d10
Showing
63 changed files
with
1,947 additions
and
1,791 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% macro log_relation_sources(relation, source_count) %} | ||
{{ return(adapter.dispatch('log_relation_sources', 'dbtvault')(relation=relation, source_count=source_count)) }} | ||
{%- endmacro -%} | ||
|
||
{% macro default__log_relation_sources(relation, source_count) %} | ||
|
||
{%- if execute -%} | ||
|
||
{%- do dbt_utils.log_info('Loading {} from {} source(s)'.format("{}.{}.{}".format(relation.database, relation.schema, relation.identifier), | ||
source_count)) -%} | ||
{%- endif -%} | ||
{% endmacro %} | ||
|
||
{% macro databricks__log_relation_sources(relation, source_count) %} | ||
|
||
{%- if execute -%} | ||
|
||
{%- do dbt_utils.log_info('Loading {} from {} source(s)'.format("{}.{}".format(relation.schema, relation.identifier), | ||
source_count)) -%} | ||
{%- endif -%} | ||
{% endmacro %} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
38 changes: 38 additions & 0 deletions
38
macros/internal/metadata_processing/process_payload_column_excludes.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{%- macro process_payload_column_excludes(src_pk, src_hashdiff, src_payload, src_extra_columns, | ||
src_eff, src_ldts, src_source, source_model) -%} | ||
|
||
{%- if src_payload is not mapping -%} | ||
{%- do return(src_payload) -%} | ||
{%- endif -%} | ||
|
||
{%- set source_model_cols = adapter.get_columns_in_relation(ref(source_model)) -%} | ||
{%- set columns_in_metadata = dbtvault.expand_column_list(columns=[src_pk, src_hashdiff, | ||
src_payload, src_extra_columns, | ||
src_eff, src_ldts, src_source]) | map('lower') | list -%} | ||
|
||
{%- set payload_cols = [] -%} | ||
{%- for col in source_model_cols -%} | ||
{%- if col.column | lower not in columns_in_metadata -%} | ||
{%- do payload_cols.append(col.column) -%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
{%- if 'exclude_columns' in src_payload.keys() -%} | ||
{%- set table_excludes_columns = src_payload.exclude_columns -%} | ||
|
||
{%- if table_excludes_columns -%} | ||
|
||
{%- set excluded_payload = [] -%} | ||
{%- set exclude_columns_list = src_payload.columns | map('lower') | list -%} | ||
|
||
{%- for col in payload_cols -%} | ||
{%- if col | lower not in exclude_columns_list -%} | ||
{%- do excluded_payload.append(col) -%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
{%- endif -%} | ||
{%- endif -%} | ||
|
||
{%- do return(excluded_payload) -%} | ||
|
||
{%- endmacro -%} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% macro drop_temporary_special(tmp_relation) %} | ||
{# In databricks and sqlserver a temporary view/table can only be dropped by #} | ||
{# the connection or session that created it so drop it now before the commit below closes this session #} | ||
|
||
{%- set drop_query_name = 'DROP_QUERY-' ~ i -%} | ||
{% call statement(drop_query_name, fetch_result=True) -%} | ||
{% if target.type == 'databricks' %} | ||
DROP VIEW {{ tmp_relation }}; | ||
{% elif target.type == 'sqlserver' %} | ||
DROP TABLE {{ tmp_relation }}; | ||
{% endif %} | ||
{%- endcall %} | ||
|
||
{% endmacro %} |
This file contains 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
Oops, something went wrong.