macros docs
This commit is contained in:
parent
93c2de6f03
commit
319c743cec
2 changed files with 19 additions and 7 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
We have different tables computing fees for different line items coming.
|
||||||
|
|
||||||
|
The only difference between these tables is what Xero Line Items are we looking
|
||||||
|
into. To avoid copying the same logic multiple times, we created this macro.
|
||||||
|
|
||||||
|
*/
|
||||||
{% macro generate_xero_net_fees_model(item_codes_to_include) %}
|
{% macro generate_xero_net_fees_model(item_codes_to_include) %}
|
||||||
|
|
||||||
{% set relevant_document_statuses = "('PAID', 'AUTHORISED')" %}
|
{% set relevant_document_statuses = "('PAID', 'AUTHORISED')" %}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
|
/*
|
||||||
|
This macro is necessary to allow different models to automatically be generated
|
||||||
|
in schemas different than the default one for the target database.
|
||||||
|
|
||||||
|
To understand better, check:
|
||||||
|
- https://www.youtube.com/watch?v=AvrVQr5FHwk
|
||||||
|
- https://docs.getdbt.com/docs/build/custom-schemas
|
||||||
|
*/
|
||||||
{% macro generate_schema_name(custom_schema_name, node) -%}
|
{% macro generate_schema_name(custom_schema_name, node) -%}
|
||||||
|
|
||||||
{%- set default_schema = target.schema -%}
|
{%- set default_schema = target.schema -%}
|
||||||
{%- if custom_schema_name is none -%}
|
{%- if custom_schema_name is none -%} {{ default_schema }}
|
||||||
|
|
||||||
{{ default_schema }}
|
{%- else -%} {{ custom_schema_name | trim }}
|
||||||
|
|
||||||
{%- else -%}
|
|
||||||
|
|
||||||
{{ custom_schema_name | trim }}
|
|
||||||
|
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue