-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from ScalefreeCOM/test
Pre-Release 1.8.2
- Loading branch information
Showing
34 changed files
with
1,690 additions
and
1,120 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
macros/internal/metadata_processing/metadata_processing.yml
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 @@ | ||
version: 2 | ||
|
||
macros: | ||
- name: yaml_metadata_parser | ||
description: A macro to parse yaml-metadata into single parameters. Used in top-level front-end macros. | ||
arguments: | ||
- name: name | ||
type: string | ||
description: The name of the parameter you want to extract of the yaml-metadata. | ||
- name: yaml_metadata | ||
type: string | ||
description: The yaml-string that holds the definition of other parameters. Needs to be in yaml format. | ||
- name: parameter | ||
type: variable | ||
description: The forwarded parameter of the top-level macro. This is used, if the yaml-metadata is none. | ||
- name: required | ||
type: boolean | ||
description: Whether this parameter is required for the top-level macro. Default is False. | ||
- name: documentation | ||
type: string | ||
description: A string that holds documentation of this parameter. |
28 changes: 28 additions & 0 deletions
28
macros/internal/metadata_processing/yaml_metadata_parser.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,28 @@ | ||
{% macro yaml_metadata_parser(name=none, yaml_metadata=none, parameter=none, required=False, documentation=none) %} | ||
|
||
{% if datavault4dbt.is_something(yaml_metadata) %} | ||
{%- set metadata_dict = fromyaml(yaml_metadata) -%} | ||
{% if name in metadata_dict.keys() %} | ||
{% set return_value = metadata_dict.get(name) %} | ||
{% if datavault4dbt.is_something(parameter)%} | ||
{{ log("[" ~ this ~ "] Parameter '" ~ name ~ "' defined both in yaml-metadata and separately. Value from yaml-metadata will be used, and separate parameter is ignored.", info=False) }} | ||
{% endif %} | ||
{% elif datavault4dbt.is_something(parameter) %} | ||
{% set return_value = parameter %} | ||
{{ log("[" ~ this ~ "] yaml-metadata given, but parameter '" ~ name ~ "' not defined in there. Applying '" ~ parameter ~ "' which is either a parameter passed separately or the default value.", info=False) }} | ||
{% elif required %} | ||
{{ exceptions.raise_compiler_error("[" ~ this ~ "] Error: yaml-metadata given, but required parameter '" ~ name ~ "' not defined in there or outside in the parameter. \n Description of parameter '" ~ name ~ "': \n" ~ documentation ) }} | ||
{% else %} | ||
{% set return_value = None %} | ||
{% endif %} | ||
{% elif datavault4dbt.is_something(parameter) %} | ||
{% set return_value = parameter %} | ||
{% elif required %} | ||
{{ exceptions.raise_compiler_error("[" ~ this ~ "] Error: Required parameter '" ~ name ~ "' not defined. Define it either directly, or inside yaml-metadata. \n Description of parameter '" ~ name ~ "': \n" ~ documentation ) }} | ||
{% else %} | ||
{% set return_value = None %} | ||
{% endif %} | ||
|
||
{{ return(return_value) }} | ||
|
||
{% endmacro %} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,23 @@ | ||
version: 2 | ||
|
||
macros: | ||
- name: process_prejoined_columns | ||
description: > | ||
A macro to process prejoined columns. If a list of dictioniaries(new syntax) is provided it will do nothing and return the list. | ||
If a dictionary of dictionaries if provided(old syntax) it will be transformed to the new syntax. | ||
When multiple columns are to be extracted from the same prejoin-target and with the same conditions(columns and operator) they will be combined into one item. | ||
arguments: | ||
- name: prejoined_columns | ||
type: list or dictionary | ||
description: The value of the prejoined_columns as defined in the yaml_metadata of the stage-model. | ||
|
||
- name: extract_prejoin_column_names | ||
description: > | ||
A macro to extract the names of the prejoined columns of each staging-model. | ||
Takes a list of prejoins and will add the aliases of the prejoins to the return-list. | ||
If no aliases are present it will return the names of the extracted columns. | ||
Returns an empty list if the passed parameter is empty. | ||
arguments: | ||
- name: prejoined_columns | ||
type: list | ||
description: The prejoined_columns as process by the process_prejoined_columns-macro |
Oops, something went wrong.