Skip to content

Commit

Permalink
Merge pull request #272 from ScalefreeCOM/release-databricks-adapter
Browse files Browse the repository at this point in the history
Release databricks adapter
  • Loading branch information
tkirschke authored Oct 21, 2024
2 parents 5d88251 + ef72058 commit 48adcbf
Show file tree
Hide file tree
Showing 31 changed files with 3,302 additions and 3 deletions.
11 changes: 11 additions & 0 deletions macros/hooks/clean_up_pits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,15 @@ WHERE snap.{{ sdts }} IS NULL
{{ log("PIT " ~ this ~ " successfully cleaned!", True) }}
{%- endif -%}

{%- endmacro -%}

{%- macro databricks__clean_up_pit(snapshot_relation, snapshot_trigger_column, sdts) -%}

DELETE FROM {{ this }} pit
WHERE pit.{{ sdts }} not in (SELECT {{ sdts }} FROM {{ ref(snapshot_relation) }} snap WHERE {{ snapshot_trigger_column }}=TRUE)

{%- if execute -%}
{{ log("PIT " ~ this ~ " successfully cleaned!", True) }}
{%- endif -%}

{%- endmacro -%}
12 changes: 12 additions & 0 deletions macros/internal/metadata_processing/escape_column_names.sql
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,16 @@

{%- do return(escaped_column_name) -%}

{%- endmacro -%}


{%- macro databricks__escape_column_name(column) -%}

{%- set escape_char_left = var('escape_char_left', "") -%}
{%- set escape_char_right = var('escape_char_right', "") -%}

{%- set escaped_column_name = escape_char_left ~ column | upper | replace(escape_char_left, '') | replace(escape_char_right, '') | trim ~ escape_char_right | indent(4) -%}

{%- do return(escaped_column_name) -%}

{%- endmacro -%}
Loading

0 comments on commit 48adcbf

Please sign in to comment.