This package models Shopify data from Fivetran's connector. It uses data in the format described by this ERD.
The main focus of the package is to transform the core object tables into analytics-ready models, including a cohort model to understand how your customers are behaving over time.
This package contains transformation models, designed to work simultaneously with our Shopify source package. A dependency on the source package is declared in this package's packages.yml
file, so it will automatically download when you run dbt deps
. The primary outputs of this package are described below.
model | description |
---|---|
shopify__customer_cohorts | Each record represents the monthly performance of a customer, including fields for the month of their 'cohort'. |
shopify__customers | Each record represents a customer, with additional dimensions like lifetime value and number of orders. |
shopify__orders | Each record represents an order, with additional dimensions like whether it is a new or repeat purchase. |
shopify__order_lines | Each record represents an order line item, with additional dimensions like how many items were refunded. |
shopify__products | Each record represents a product, with additional dimensions like most recent order date and order volume. |
shopify__transactions | Each record represents a transaction with additional calculations to handle exchange rates. |
Check dbt Hub for the latest installation instructions, or read the dbt docs for more information on installing packages.
Include in your packages.yml
packages:
- package: fivetran/shopify
version: [">=0.6.0", "<0.7.0"]
By default, this package looks for your Shopify data in the shopify
schema of your target database. If this is not where your Shopify data is, add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
config-version: 2
vars:
shopify_database: your_database_name
shopify_schema: your_schema_name
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 shopify_union_schemas
or shopify_union_databases
variables:
# dbt_project.yml
...
config-version: 2
vars:
shopify_union_schemas: ['shopify_usa','shopify_canada'] # use this if the data is in different schemas/datasets of the same database/project
shopify_union_databases: ['shopify_usa','shopify_canada'] # use this if the data is in different databases/projects but uses the same schema name
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.
# dbt_project.yml
...
config-version: 2
vars:
shopify_source:
customer_pass_through_columns: []
order_line_refund_pass_through_columns: []
order_line_pass_through_columns: []
order_pass_through_columns: []
product_pass_through_columns: []
product_variant_pass_through_columns: []
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:
# dbt_project.yml
...
vars:
shopify__using_order_adjustment: false # true by default
shopify__using_order_line_refund: false # true by default
shopify__using_refund: false # true by default
By default this package will build the Shopify staging models within a schema titled (<target_schema> + _stg_shopify
) and the Shopify final models within a schema titled (<target_schema> + _shopify
) in your target database. If this is not where you would like your modeled Shopify data to be written to, add the following configuration to your dbt_project.yml
file:
# dbt_project.yml
...
models:
shopify:
+schema: my_new_schema_name # leave blank for just the target_schema
shopify_source:
+schema: my_new_schema_name # leave blank for just the target_schema
For additional configurations for the source models, visit the Shopify source package.
Additional contributions to this package are very welcome! Please create issues
or open PRs against main
. Check out
this post
on the best workflow for contributing to a package.
This package has been tested on BigQuery, Snowflake, Redshift, Postgres, and Databricks.
dbt v0.20.0
introduced a new project-level dispatch configuration that enables an "override" setting for all dispatched macros. If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your dbt_project.yml
. This is required in order for the package to accurately search for macros within the dbt-labs/spark_utils
then the dbt-labs/dbt_utils
packages respectively.
# dbt_project.yml
dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils']
- Provide feedback on our existing dbt packages or what you'd like to see next
- Have questions, feedback, or need help? Book a time during our office hours using Calendly or email us at solutions@fivetran.com
- Find all of Fivetran's pre-built dbt packages in our dbt hub
- Learn how to orchestrate your models with Fivetran Transformations for dbt Core™
- Learn more about Fivetran overall in our docs
- Check out Fivetran's blog
- Learn more about dbt in the dbt docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the dbt blog for the latest news on dbt's development and best practices