Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #50: Enable teams to configure additional columns for staging entities models #51

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ vars:
customers_pass_through_columns:
- name: "customer_custom_field"
alias: "customer_field"
entities_pass_through_columns:
- name: "entity_custom_field"
alias: "entity_field"
locations_pass_through_columns:
- name: "location_custom_field"
subsidiaries_pass_through_columns:
Expand Down
1 change: 1 addition & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ vars:
consolidated_exchange_rates_pass_through_columns: []
vendors_pass_through_columns: []
items_pass_through_columns: []
entities_pass_through_columns: []

clean-targets:
- target
Expand Down
2 changes: 2 additions & 0 deletions macros/get_entity_columns.sql
fivetran-avinash marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
{"name": "vendor", "datatype": dbt.type_int()}
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('entities_pass_through_columns')) }}

{{ return(columns) }}

{% endmacro %}
4 changes: 4 additions & 0 deletions models/netsuite2/stg_netsuite2__entities.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ final as (
employee as employee_id,
project as job_id,
vendor as vendor_id

--The below macro adds the fields defined within your entities_pass_through_columns variable into the staging model
{{ fivetran_utils.fill_pass_through_columns('entities_pass_through_columns') }}

from fields
)

Expand Down