Skip to content

Commit

Permalink
Merge pull request #24 from fivetran/feature/deactivate-refunds
Browse files Browse the repository at this point in the history
deactivate config for adjustment and refunds
  • Loading branch information
fivetran-joemarkiewicz authored Sep 8, 2021
2 parents eda9beb + 4b2775d commit ad6c52d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
dbt seed --target spark --full-refresh
dbt run --target spark --full-refresh
dbt test --target spark
dbt run --vars '{shopify__using_order_adjustment: false, shopify__using_order_line_refund: false, shopify__using_order_refund: false}' --target spark --full-refresh
dbt test --target spark
- run:
name: "Run Tests - Redshift"
command: |
Expand All @@ -42,6 +44,8 @@ jobs:
dbt seed --target redshift --full-refresh
dbt run --target redshift --full-refresh
dbt test --target redshift
dbt run --vars '{shopify__using_order_adjustment: false, shopify__using_order_line_refund: false, shopify__using_order_refund: false}' --target redshift --full-refresh
dbt test --target redshift
- run:
name: "Run Tests - Postgres"
command: |
Expand All @@ -52,6 +56,8 @@ jobs:
dbt seed --target postgres --full-refresh
dbt run --target postgres --full-refresh
dbt test --target postgres
dbt run --vars '{shopify__using_order_adjustment: false, shopify__using_order_line_refund: false, shopify__using_order_refund: false}' --target postgres --full-refresh
dbt test --target postgres
- run:
name: "Run Tests - Snowflake"
command: |
Expand All @@ -62,6 +68,8 @@ jobs:
dbt seed --target snowflake --full-refresh
dbt run --target snowflake --full-refresh
dbt test --target snowflake
dbt run --vars '{shopify__using_order_adjustment: false, shopify__using_order_line_refund: false, shopify__using_order_refund: false}' --target snowflake --full-refresh
dbt test --target snowflake
- run:
name: "Run Tests - BigQuery"
environment:
Expand All @@ -74,4 +82,6 @@ jobs:
dbt deps
dbt seed --target bigquery --full-refresh
dbt run --target bigquery --full-refresh
dbt test --target bigquery
dbt run --vars '{shopify__using_order_adjustment: false, shopify__using_order_line_refund: false, shopify__using_order_refund: false}' --target bigquery --full-refresh
dbt test --target bigquery
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ vars:
shopify_schema: your_schema_name
```

### Union Multiple Shopify Connectors
If you have multiple Shopify connectors in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the `source_relation` column of each model. To use this functionality, you will need to set either the `union_schemas` or `union_databases` variables:

```yml
Expand All @@ -54,6 +55,7 @@ vars:
union_databases: ['shopify_usa','shopify_canada'] # use this if the data is in different databases/projects but uses the same schema name
```

### Add Passthrough Columns
This package includes all source columns defined in the staging_columns.sql macro. To add additional columns to this package, do so using our pass-through column variables. This is extremely useful if you'd like to include custom fields to the package.

```yml
Expand All @@ -71,6 +73,20 @@ vars:
product_pass_through_columns: []
product_variant_pass_through_columns: []
```

### Disable Models
This package was designed with the intention that users have all relevant Shopify tables being synced by Fivetran. However, if you are a Shopify user that does not operate on returns or adjustments then you will not have the related source tables. As such, you may use the below variable configurations to disable the respective downstream models. All variables are `true` by default. Only add the below configuration if you are wishing to disable the models:

```yml
# dbt_project.yml
...
vars:
shopify__using_order_adjustment: false # true by default
shopify__using_order_line_refund: false # true by default
shopify__using_order_refund: false # true by default
```

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

Expand Down
7 changes: 5 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

name: 'shopify_source'
version: '0.5.0'
version: '0.5.1'
config-version: 2

require-dbt-version: ">=0.20.0"
Expand Down Expand Up @@ -31,4 +31,7 @@ vars:
product_pass_through_columns: []
product_variant_pass_through_columns: []
transaction_pass_through_columns: []


shopify__using_order_adjustment: True
shopify__using_order_line_refund: True
shopify__using_order_refund: True
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'shopify_source_integration_tests'
version: '0.5.0'
version: '0.5.1'
profile: 'integration_tests'
config-version: 2

Expand Down
2 changes: 2 additions & 0 deletions models/stg_shopify__order_adjustment.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--To disable this model, set the shopify__using_order_adjustment variable within your dbt_project.yml file to False.
{{ config(enabled=var('shopify__using_order_adjustment', True)) }}

with source as (

Expand Down
3 changes: 3 additions & 0 deletions models/stg_shopify__order_line_refund.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
--To disable this model, set the shopify__using_order_line_refund variable within your dbt_project.yml file to False.
{{ config(enabled=var('shopify__using_order_line_refund', True)) }}

with source as (

select * from {{ ref('stg_shopify__order_line_refund_tmp') }}
Expand Down
2 changes: 2 additions & 0 deletions models/stg_shopify__refund.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--To disable this model, set the shopify__using_refund variable within your dbt_project.yml file to False.
{{ config(enabled=var('shopify__using_refund', True)) }}

with source as (

Expand Down
3 changes: 3 additions & 0 deletions models/tmp/stg_shopify__order_adjustment_tmp.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
--To disable this model, set the shopify__using_order_adjustment variable within your dbt_project.yml file to False.
{{ config(enabled=var('shopify__using_order_adjustment', True)) }}

{{
fivetran_utils.union_data(
table_identifier='order_adjustment',
Expand Down
3 changes: 3 additions & 0 deletions models/tmp/stg_shopify__order_line_refund_tmp.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
--To disable this model, set the shopify__using_order_line_refund variable within your dbt_project.yml file to False.
{{ config(enabled=var('shopify__using_order_line_refund', True)) }}

{{
fivetran_utils.union_data(
table_identifier='order_line_refund',
Expand Down
3 changes: 3 additions & 0 deletions models/tmp/stg_shopify__refund_tmp.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
--To disable this model, set the shopify__using_refund variable within your dbt_project.yml file to False.
{{ config(enabled=var('shopify__using_refund', True)) }}

{{
fivetran_utils.union_data(
table_identifier='refund',
Expand Down

0 comments on commit ad6c52d

Please sign in to comment.