Skip to content

Commit

Permalink
add pass through columns
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-reneeli committed Mar 9, 2022
1 parent 38cbffd commit bdce113
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 36 deletions.
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ vars:
sage_intacct_database: your_database_name
sage_intacct_schema: your_schema_name
```
### Passthrough Columns
This package allows users to add additional columns to the final model tables.
Columns passed through must be present in the downstream source tables. See
below for an example of how the passthrough columns should be configured within your `dbt_project.yml` file.
Expand All @@ -50,22 +51,10 @@ below for an example of how the passthrough columns should be configured within
...
vars:
# add pass through columns
sage_intacct_source:
account_pass_through_columns: ['new_custom_field', 'custom_field_2']
```


```yml
# dbt_project.yml
...
vars:
```
### Disable models
It's possible that your Sage Intacct connector does not sync every table that this package expects. If your syncs exclude certain tables, it is because you either don't use that functionality in Sage Intacct or actively excluded some tables from your syncs. To disable the corresponding functionality in the package, you must add the relevant variables. By default, the package assume that all variables are true. Add variables for only the tables you want to disable.

<!-- do we want an example here? -->

### Change the Build Schema
By default, this package builds the Sage Intacct staging models within a schema titled (<target_schema> + `_stg_sage_intacct`) in your target database. If this is not where you would like your Sage Intacct staging data to be written to, add the following configuration to your `dbt_project.yml` file:

Expand Down
2 changes: 2 additions & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ vars:
ar_invoice_item: "{{ source('sage_intacct','ar_invoice_item') }}"
ar_invoice: "{{ source('sage_intacct','ar_invoice') }}"

account_pass_through_columns: []

clean-targets:
- target
- dbt_modules
36 changes: 14 additions & 22 deletions models/stg_sage_intacct__gl_account.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ fields as (
staging_columns=get_gl_account_columns()
)
}}

--The below script allows for pass through columns.
{% if var('account_pass_through_columns') %}
,
{{ var('account_pass_through_columns') | join (", ")}}

{% endif %}

from base
),

Expand Down Expand Up @@ -43,27 +49,13 @@ final as (
title,
whencreated as created_at,
whenmodified as modified_at
-- cf_fs_group_5,
-- cf_fs_group_4,
-- cf_fs_group_3,
-- cf_fs_group_2,
-- cf_fs_group_1,
-- cf_category,
-- cf_bs_group_1,
-- cf_bs_account_group,
-- cf_bs_account_name,
-- cf_account_group,
-- cf_bs_order_summary,
-- cf_is_order_detail,
-- cf_is_order_summary,
-- cf_bs_group_3,
-- cf_bs_group_2,
-- cf_bs_group_4,
-- cf_bs_group_5,
-- cf_reporting_group_1,
-- cf_bs_order_detail,
-- cf_bs_account_number,
-- cf_header_account

--The below script allows for pass through columns.
{% if var('account_pass_through_columns') %}
,
{{ var('account_pass_through_columns') | join (", ")}}

{% endif %}

from fields
)
Expand Down

0 comments on commit bdce113

Please sign in to comment.