Skip to content

Commit f114928

Browse files
update_parition_by_macro
1 parent 5f71110 commit f114928

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# dbt_quickbooks v1.4.2
22

3-
[PR #198](https://github.com/fivetran/dbt_quickbooks/pull/198) includes the following updates:
3+
[PR #198](https://github.com/fivetran/dbt_quickbooks/pull/198) includes the following update:
44

55
## Under the Hood
66
- Introduces the `partition_by_source_relation` macro to conditionally include `source_relation` in window function PARTITION BY clauses only when multiple sources are configured via the `quickbooks_sources` variable. Replaces hardcoded `source_relation` partitioning in the following models: `int_quickbooks__bill_payment_double_entry`, `int_quickbooks__credit_card_pymt_double_entry`, `int_quickbooks__payment_double_entry`, `int_quickbooks__transfer_double_entry`, `int_quickbooks__general_ledger_balances`, `quickbooks__cash_flow_statement`, `quickbooks__general_ledger`, and `stg_quickbooks__credit_card_payment_txn`.
77

8-
98
# dbt_quickbooks v1.4.1
109

1110
[PR #196](https://github.com/fivetran/dbt_quickbooks/pull/196) includes the following updates:
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
{%- macro partition_by_source_relation(has_other_partitions='yes', alias=None) -%}
1+
{% macro partition_by_source_relation(has_other_partitions='yes', alias=None) %}
2+
{{ return(adapter.dispatch('partition_by_source_relation', 'quickbooks')(has_other_partitions, alias)) }}
3+
{% endmacro %}
24

3-
{{ adapter.dispatch('partition_by_source_relation', 'quickbooks') (has_other_partitions, alias) }}
5+
{% macro default__partition_by_source_relation(has_other_partitions='yes', alias=None) -%}
46

5-
{%- endmacro %}
7+
{%- set prefix = '' if alias is none else alias ~ '.' -%}
68

7-
{% macro default__partition_by_source_relation(has_other_partitions='yes', alias=None) -%}
8-
{% set prefix = '' if alias is none else alias ~ '.' %}
9-
10-
{%- if has_other_partitions == 'no' -%}
11-
{{ 'partition by ' ~ prefix ~ 'source_relation' if var('quickbooks_sources', [])|length > 1 }}
12-
{%- else -%}
13-
{{ ', ' ~ prefix ~ 'source_relation' if var('quickbooks_sources', [])|length > 1 }}
14-
{%- endif -%}
15-
{%- endmacro -%}
9+
{%- if has_other_partitions == 'no' -%}
10+
{{- 'partition by ' ~ prefix ~ 'source_relation' if var('quickbooks_union_schemas', [])|length > 1 or var('quickbooks_union_databases', [])|length > 1 else '' -}}
11+
{%- else -%}
12+
{{- ', ' ~ prefix ~ 'source_relation' if var('quickbooks_union_schemas', [])|length > 1 or var('quickbooks_union_databases', [])|length > 1 else '' -}}
13+
{%- endif -%}
14+
15+
{%- endmacro %}

0 commit comments

Comments
 (0)