From 19a89e875a2874ec84f95d1ccaaf356c4abcf4ac Mon Sep 17 00:00:00 2001 From: yaruishi Date: Thu, 28 Oct 2021 11:48:48 -0400 Subject: [PATCH] add pass through for customers --- README.md | 1 + dbt_project.yml | 7 ++++--- models/stg_netsuite__customers.sql | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 172814c..69d2d54 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ vars: departments_pass_through_columns: ['department_custom_fields'] transactions_pass_through_columns: ['transactions_can_be_custom','pass_this_transaction_field_on'] transaction_lines_pass_through_columns: ['transaction_lines_field'] + customers_pass_through_columns: ['customers_field'] ``` ### Changing the Build Schema diff --git a/dbt_project.yml b/dbt_project.yml index c84b67d..6015ef8 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,6 +1,6 @@ config-version: 2 require-dbt-version: ">=0.20.0" - + name: 'netsuite_source' version: '0.3.1' @@ -36,7 +36,8 @@ vars: departments_pass_through_columns: [] transactions_pass_through_columns: [] transaction_lines_pass_through_columns: [] - + customers_pass_through_columns: [] + clean-targets: - target - - dbt_modules \ No newline at end of file + - dbt_modules diff --git a/models/stg_netsuite__customers.sql b/models/stg_netsuite__customers.sql index 130109e..66d84b6 100644 --- a/models/stg_netsuite__customers.sql +++ b/models/stg_netsuite__customers.sql @@ -23,6 +23,13 @@ fields as ( ) }} + --The below script allows for pass through columns. + {% if var('customers_pass_through_columns') %} + , + {{ var('customers_pass_through_columns') | join (", ")}} + + {% endif %} + from base ), @@ -39,6 +46,14 @@ final as ( date_first_order as date_first_order_at, _fivetran_deleted + --The below script allows for pass through columns. + {% if var('customers_pass_through_columns') %} + , + {{ var('customers_pass_through_columns') | join (", ")}} + + {% endif %} + + from fields )