Skip to content

Commit

Permalink
Release 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Higgs committed Jan 26, 2021
1 parent 7ce6cd3 commit 425bc81
Show file tree
Hide file tree
Showing 32 changed files with 762 additions and 370 deletions.
16 changes: 7 additions & 9 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: 'dbtvault'
version: '0.7.0'
version: '0.7.2'
require-dbt-version: [">=0.18.0", "<0.19.0"]
config-version: 2

profile: 'dbtvault'

source-paths: ["models", "models_test"]
source-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
data-paths: ["data"]
Expand All @@ -13,9 +12,8 @@ docs-paths: ["docs"]

target-path: "target"
clean-targets:
- "target"
- "dbt_modules"
- "target"
- "dbt_modules"

models:
vars:
hash: MD5
vars:
hash: MD5
2 changes: 1 addition & 1 deletion docs/materialisations/helpers/get_period_filter_sql.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% docs macro__get_period_filter_sql %}

A wrapper around the `replace_placeholder_with_filter` macro which creates a query designed to
A wrapper around the `replace_placeholder_with_period_filter` macro which creates a query designed to
build a temporary table, to select the necessary records for the given load cycle.

{% enddocs %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% docs macro__replace_placeholder_with_filter %}
{% docs macro__replace_placeholder_with_period_filter %}

Replace the `__PERIOD_FILTER__` string present in the given SQL, with a `WHERE` clause which filters data by a
specific `period` of time, `offset` from the `start_date`.

{% enddocs %}


{% docs arg__replace_placeholder_with_filter__core_sql %}
{% docs arg__replace_placeholder_with_period_filter__core_sql %}

SQL string containing the `__PERIOD_FILTER__` string.

Expand Down
2 changes: 1 addition & 1 deletion docs/staging.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A macro to aid in generating a staging layer for the raw vault. Allows users to:

- Create new columns from already existing columns (Derived columns)
- Create new hashed columns from already existing columns (Hashed columns)
- Create new hashed columns from already existing columns and provided derived columns (Hashed columns)

[Read more online](https://dbtvault.readthedocs.io/en/latest/macros/#stage)

Expand Down
6 changes: 3 additions & 3 deletions macros/internal/alias.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{%- macro alias(alias_config=none, prefix=none) -%}

{{- adapter.dispatch('alias', packages = var('adapter_packages', ['dbtvault']))(alias_config=alias_config, prefix=prefix) -}}
{{- adapter.dispatch('alias', packages = dbtvault.get_dbtvault_namespaces())(alias_config=alias_config, prefix=prefix) -}}

{%- endmacro %}

{%- macro default__alias(alias_config=none, prefix=none) -%}

{%- if alias_config -%}
{%- if alias_config is defined and alias_config is not none and alias_config -%}

{%- if alias_config is iterable and alias_config is not string -%}
{%- if alias_config is mapping -%}

{%- if alias_config['source_column'] and alias_config['alias'] -%}

Expand Down
12 changes: 9 additions & 3 deletions macros/internal/alias_all.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{%- macro alias_all(columns=none, prefix=none) -%}

{{- adapter.dispatch('alias_all', packages = var('adapter_packages', ['dbtvault']))(columns=columns, prefix=prefix) -}}
{{- adapter.dispatch('alias_all', packages = dbtvault.get_dbtvault_namespaces())(columns=columns, prefix=prefix) -}}

{%- endmacro %}

{%- macro default__alias_all(columns, prefix) -%}

{%- if columns is iterable and columns is not string -%}
{%- if dbtvault.is_list(columns) -%}

{%- for column in columns -%}
{{ dbtvault.alias(alias_config=column, prefix=prefix) }}
Expand All @@ -17,6 +17,12 @@

{{ dbtvault.alias(alias_config=columns, prefix=prefix) }}

{%- endif -%}
{%- else -%}

{%- if execute -%}
{{ exceptions.raise_compiler_error("Invalid columns object provided. Must be a list or a string.") }}
{%- endif %}

{%- endif %}

{%- endmacro -%}
8 changes: 6 additions & 2 deletions macros/internal/as_constant.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{%- macro as_constant(column_str=none) -%}

{{- adapter.dispatch('as_constant', packages = var('adapter_packages', ['dbtvault']))(column_str=column_str) -}}
{{- adapter.dispatch('as_constant', packages = dbtvault.get_dbtvault_namespaces())(column_str=column_str) -}}

{%- endmacro %}

{%- macro default__as_constant(column_str) -%}

{% if column_str is not none %}
{% if column_str is not none and column_str is string and column_str %}

{%- if column_str | first == "!" -%}

Expand All @@ -17,6 +17,10 @@
{{- return(column_str) -}}

{%- endif -%}
{%- else -%}
{%- if execute -%}
{{ exceptions.raise_compiler_error("Invalid columns_str object provided. Must be a string and not null.") }}
{%- endif %}
{%- endif -%}

{%- endmacro -%}
27 changes: 17 additions & 10 deletions macros/internal/expand_column_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{%- set col_list = [] -%}

{%- if columns is iterable -%}
{%- if dbtvault.is_list(columns) -%}

{%- for col in columns -%}

Expand All @@ -17,25 +17,32 @@
{%- do col_list.append(col) -%}

{#- If list of lists -#}
{%- elif col is iterable and col is not string -%}
{%- elif dbtvault.is_list(col) -%}

{%- if col is mapping -%}
{%- for cols in col -%}

{%- do col_list.append(col) -%}
{%- do col_list.append(cols) -%}

{%- else -%}
{%- endfor -%}
{%- elif col is mapping -%}

{%- for cols in col -%}

{%- do col_list.append(cols) -%}
{%- do col_list.append(col) -%}

{%- endfor -%}
{%- else -%}

{%- endif -%}
{%- if execute -%}
{{ exceptions.raise_compiler_error("Invalid columns object provided. Must be a list of lists, dictionaries or strings.") }}
{%- endif %}

{%- endif -%}

{%- endfor -%}
{%- else -%}

{%- if execute -%}
{{ exceptions.raise_compiler_error("Invalid columns object provided. Must be a list.") }}
{%- endif %}

{%- endif -%}

{% do return(col_list) %}
Expand Down
4 changes: 4 additions & 0 deletions macros/internal/get_package_namespaces.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{%- macro get_dbtvault_namespaces() -%}
{%- set override_namespaces = var('adapter_packages', []) -%}
{%- do return(override_namespaces + ['dbtvault']) -%}
{%- endmacro -%}
33 changes: 33 additions & 0 deletions macros/internal/is_checks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{%- macro is_list(obj, empty_is_false=false) -%}

{%- if obj is iterable and obj is not string and obj is not mapping -%}
{%- if obj is none and obj is undefined and not obj and empty_is_false -%}
{%- do return(false) -%}
{%- endif -%}

{%- do return(true) -%}
{%- else -%}
{%- do return(false) -%}
{%- endif -%}

{%- endmacro -%}

{%- macro is_nothing(obj) -%}

{%- if obj is none or obj is undefined or not obj -%}
{%- do return(true) -%}
{%- else -%}
{%- do return(false) -%}
{%- endif -%}

{%- endmacro -%}

{%- macro is_something(obj) -%}

{%- if obj is not none and obj is defined and obj -%}
{%- do return(true) -%}
{%- else -%}
{%- do return(false) -%}
{%- endif -%}

{%- endmacro -%}
4 changes: 2 additions & 2 deletions macros/internal/multikey.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{%- macro multikey(columns, prefix=none, condition=none, operator='AND') -%}

{{- adapter.dispatch('multikey', packages = var('adapter_packages', ['dbtvault']))(columns=columns, prefix=prefix, condition=condition, operator=operator) -}}
{{- adapter.dispatch('multikey', packages = dbtvault.get_dbtvault_namespaces())(columns=columns, prefix=prefix, condition=condition, operator=operator) -}}

{%- endmacro %}

Expand All @@ -20,7 +20,7 @@
{%- if not loop.last %} {{ operator }} {% endif %}
{% endfor -%}
{%- else -%}
{%- if columns is iterable and columns is not string -%}
{%- if dbtvault.is_list(columns) -%}
{%- for col in columns -%}
{{ prefix[0] ~ '.' if prefix }}{{ col }} {{ condition if condition else '' }}
{%- if not loop.last -%} {{ "\n " ~ operator }} {% endif -%}
Expand Down
96 changes: 0 additions & 96 deletions macros/internal/process_macros.sql

This file was deleted.

Loading

0 comments on commit 425bc81

Please sign in to comment.