-
Notifications
You must be signed in to change notification settings - Fork 41
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 #70 from fivetran/feature/general-ledger-unioning
Feature/General ledger unioning
- Loading branch information
Showing
9 changed files
with
66 additions
and
93 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% macro get_enabled_unioned_models(unioned_models = [ | ||
'bill', | ||
'credit_memo', | ||
'deposit', | ||
'invoice', | ||
'journal_entry', | ||
'payment', | ||
'refund_receipt', | ||
'sales_receipt', | ||
'transfer', | ||
'vendor_credit']) %} | ||
|
||
{% set enabled_unioned_models = [] %} | ||
|
||
{{ enabled_unioned_models.append(ref('int_quickbooks__purchase_double_entry')) }} | ||
|
||
{% for unioned_model in unioned_models %} | ||
{% if var('using_' ~ unioned_model, True) %} | ||
{{ enabled_unioned_models.append(ref('int_quickbooks__' ~ unioned_model ~ '_double_entry')) }} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% if var('using_bill', True) %} | ||
{{ enabled_unioned_models.append(ref('int_quickbooks__bill_payment_double_entry')) }} | ||
{% endif %} | ||
|
||
{% if var('using_credit_card_payment_txn', True) %} | ||
{{ enabled_unioned_models.append(ref('int_quickbooks__credit_card_pymt_double_entry')) }} | ||
{% endif %} | ||
|
||
{{ return(enabled_unioned_models) }} | ||
|
||
{% endmacro %} |
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,13 @@ | ||
version: 2 | ||
|
||
macros: | ||
- name: get_enabled_unioned_models | ||
description: > | ||
This macro takes models from the `double_entry_transactions` folder and appends them together in an array of relations if these models are enabled. This will then be unioned together using `dbt_utils.union_relations` in the `quickbooks__general_ledger` model. `int_quickbooks__purchase_double_entry` is included by default. `int_quickbooks__bill_payment_double_entry` and `int_quickbooks__credit_card_pymt_double_entry` are appended separately because their `using_` variables do not match up like the other variables, which can't be modified. | ||
arguments: | ||
- name: unioned_models | ||
type: list | ||
description: List of strings referring to particular models to then be appended and eventually unioned if enabled. | ||
- name: enabled_unioned_models | ||
type: list | ||
description: List of relations of models that are enabled to eventually be unioned into a general ledger model. |
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