Skip to content

Commit 07518e8

Browse files
committed
add databricks support
1 parent dbad909 commit 07518e8

31 files changed

+3302
-3
lines changed

macros/hooks/clean_up_pits.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,15 @@ WHERE snap.{{ sdts }} IS NULL
123123
{{ log("PIT " ~ this ~ " successfully cleaned!", True) }}
124124
{%- endif -%}
125125

126+
{%- endmacro -%}
127+
128+
{%- macro databricks__clean_up_pit(snapshot_relation, snapshot_trigger_column, sdts) -%}
129+
130+
DELETE FROM {{ this }} pit
131+
WHERE pit.{{ sdts }} not in (SELECT {{ sdts }} FROM {{ ref(snapshot_relation) }} snap WHERE {{ snapshot_trigger_column }}=TRUE)
132+
133+
{%- if execute -%}
134+
{{ log("PIT " ~ this ~ " successfully cleaned!", True) }}
135+
{%- endif -%}
136+
126137
{%- endmacro -%}

macros/internal/metadata_processing/escape_column_names.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,16 @@
184184

185185
{%- do return(escaped_column_name) -%}
186186

187+
{%- endmacro -%}
188+
189+
190+
{%- macro databricks__escape_column_name(column) -%}
191+
192+
{%- set escape_char_left = var('escape_char_left', "") -%}
193+
{%- set escape_char_right = var('escape_char_right', "") -%}
194+
195+
{%- set escaped_column_name = escape_char_left ~ column | upper | replace(escape_char_left, '') | replace(escape_char_right, '') | trim ~ escape_char_right | indent(4) -%}
196+
197+
{%- do return(escaped_column_name) -%}
198+
187199
{%- endmacro -%}

0 commit comments

Comments
 (0)