Shopify Source dbt Package (Docs)
- Materializes Shopify staging tables which leverage data in the format described by this ERD. These staging tables clean, test, and prepare your Shopify data from Fivetran's connector for analysis by doing the following:
- Name columns for consistency across all packages and for easier analysis
- Adds freshness tests to source data
- Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values.
- Generates a comprehensive data dictionary of your Shopify data through the dbt docs site.
- These tables are designed to work simultaneously with our Shopify transformation package.
To use this dbt package, you must have the following:
- At least one Fivetran Shopify connector syncing data into your destination.
- A BigQuery, Snowflake, Redshift, Databricks, or PostgreSQL destination.
Include the following shopify_source package version in your packages.yml
file.
TIP: Check dbt Hub for the latest installation instructions or read the dbt docs for more information on installing packages.
packages:
- package: fivetran/shopify_source
version: [">=0.7.0", "<0.8.0"]
By default, this package runs using your destination and the shopify
schema. If this is not where your Shopify data is (for example, if your Shopify schema is named shopify_fivetran
and your issue
table is named usa_issue
), add the following configuration to your root dbt_project.yml
file:
vars:
shopify_database: your_destination_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 (cannot do both) in your root dbt_project.yml
file:
# dbt_project.yml
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 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. To disable those models, add the below configuration in your root dbt_project.yml
file:
# 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
Expand to view configurations
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 in your root dbt_project.yml
. This is extremely useful if you'd like to include custom fields to the package.
# dbt_project.yml
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: []
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:
# dbt_project.yml
models:
shopify_source:
+schema: my_new_schema_name # leave blank for just the target_schema
If an individual source table has a different name than the package expects, add the table name as it appears in your destination to the respective variable:
IMPORTANT: See this project's
src_shopify.yml
for the default names.
# dbt_project.yml
vars:
shopify_<default_source_table_name>_identifier: your_table_name
Expand to view details
Fivetran offers the ability for you to orchestrate your dbt project through Fivetran Transformations for dbt Core™. Learn how to set up your project for orchestration through Fivetran in our Transformations for dbt Core setup guides.
This dbt package is dependent on the following dbt packages. Please be aware that these dependencies are installed by default within this package. For more information on the following packages, refer to the dbt hub site.
IMPORTANT: If you have any of these dependent packages in your own
packages.yml
file, we highly recommend that you remove them from your rootpackages.yml
to avoid package version conflicts.
packages:
- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
- package: dbt-labs/dbt_utils
version: [">=1.0.0", "<2.0.0"]
The Fivetran team maintaining this package only maintains the latest version of the package. We highly recommend that you stay consistent with the latest version of the package and refer to the CHANGELOG and release notes for more information on changes across versions.
A small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions!
We highly encourage and welcome contributions to this package. Check out this dbt Discourse article to learn how to contribute to a dbt package!
- If you have questions or want to reach out for help, please refer to the GitHub Issue section to find the right avenue of support for you.
- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our Feedback Form.
- Have questions or want to just say hi? Book a time during our office hours on Calendly or email us at solutions@fivetran.com.