Load Shopify data into BigQuery
You can load data from Shopify to BigQuery using the BigQuery Data Transfer Service for Shopify connector. With the BigQuery Data Transfer Service, you can schedule recurring transfer jobs that add your latest data from Shopify to BigQuery.
The Shopify connector supports the data transfer of GraphQL-based
resources, such as Collections and Orders, from the following resources:
- Subscription-based accounts
- Partner accounts
Limitations
Shopify data transfers are subject to following limitations:
- To include the
GiftCardsobject in the data transfer, the account associated with this data transfer must have a ShopifyPlus subscription. - To include the following app subscription data objects in the data transfer,
the app installed on the Shopify store must be a sales channel app.
AppSubscriptionLineItemsAppSubscriptionsProductResourceFeedbacks
- To include the following Shopify data objects that require a
discount function, you must
use the Shopify CLI
to create a Shopify app.
DiscountsCodeAppDiscountsCodeBasic
Before you begin
The following sections describe the prerequisites that you need to do before you create a Shopify data transfer.
Shopify prerequisites
- You must have a Shopify account and a Shopify store.
- You must have a custom Shopify App for your Shopify store. For more information, see Custom apps.
- You must have access to all the required access scopes. For a list of all required access scopes, see Authenticated access scopes.
BigQuery prerequisites
- Verify that you have completed all actions required to enable the BigQuery Data Transfer Service.
- Create a BigQuery dataset to store your data.
Required BigQuery roles
To get the permissions that
you need to create a BigQuery Data Transfer Service data transfer,
ask your administrator to grant you the
BigQuery Admin (roles/bigquery.admin)
IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to create a BigQuery Data Transfer Service data transfer. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to create a BigQuery Data Transfer Service data transfer:
-
BigQuery Data Transfer Service permissions:
-
bigquery.transfers.update -
bigquery.transfers.get
-
-
BigQuery permissions:
-
bigquery.datasets.get -
bigquery.datasets.getIamPolicy -
bigquery.datasets.update -
bigquery.datasets.setIamPolicy -
bigquery.jobs.create
-
You might also be able to get these permissions with custom roles or other predefined roles.
For more information, see Grant bigquery.admin access.
If you intend to set up transfer run notifications for Pub/Sub,
ensure that you have the pubsub.topics.setIamPolicy Identity and Access Management (IAM)
permission. Pub/Sub permissions aren't required if you only set up
email notifications. For more information, see
BigQuery Data Transfer Service run notifications.
Set up a Shopify data transfer
Add Shopify data into BigQuery by setting up a transfer configuration using one of the following options:
Console
Go to the Data transfers page in the Google Cloud console.
Click Create transfer.
In the Source type section, for Source, choose Shopify.
In the Data source details section, do the following:
- For Shop name, enter the name of your Shopify shop.
For example, if your merchant account ID is
storename.myshopify.com, then your shop name isstorename. - For Client ID and Client Secret, enter the client ID and secret for your Shopify app. For more information, see About client secrets.
- For Shopify objects to transfer, click Browse:
- Select any objects to be transferred to the BigQuery destination dataset. You can also manually enter any objects to include in the data transfer in this field.
- For Shop name, enter the name of your Shopify shop.
For example, if your merchant account ID is
In the Destination settings section, for Dataset, choose the dataset that you created to store your data.
In the Transfer config name section, for Display name, enter a name for the data transfer.
In the Schedule options section:
- In the Repeat frequency list, select an option to specify how often this data transfer runs. To specify a custom repeat frequency, select Custom. If you select On-demand, then this transfer runs when you manually trigger the transfer.
- If applicable, select either Start now or Start at set time, and provide a start date and run time.
Optional: In the Notification options section, do the following:
- To enable email notifications, click the Email notification toggle. When you enable this option, the transfer administrator receives an email notification when a transfer run fails.
- To enable Pub/Sub transfer run notifications for this transfer, click the Pub/Sub notifications toggle. You can select your topic name, or you can click Create a topic to create one.
Click Save.
bq
Enter the bq mk command
and supply the transfer creation flag
--transfer_config:
bq mk --transfer_config --project_id=PROJECT_ID --data_source=DATA_SOURCE --display_name=NAME --target_dataset=DATASET --params='PARAMETERS'
Where:
- PROJECT_ID (optional): your Google Cloud project ID.
If
--project_idisn't supplied to specify a particular project, the default project is used. - DATA_SOURCE: the data source —
shopify. - NAME: the display name for the data transfer configuration. The transfer name can be any value that lets you identify the transfer if you need to modify it later.
- DATASET: the target dataset for the transfer configuration.
PARAMETERS: the parameters for the created transfer configuration in JSON format. For example:
--params='{"param":"param_value"}'. The following are the parameters for a Shopify data transfer:assets: the path to the Shopify objects to be transferred to BigQuery.connector.shopName: the name of your Shopify shop. For example, if your merchant account ID isstorename.myshopify.com, then your shop name isstorename.connector.authentication.accessToken: the Shopify Admin API access token.
The following command creates an incremental Shopify data transfer in the default project.
bq mk --transfer_config --target_dataset=mydataset --data_source=shopify --display_name='My Transfer' --params='{"assets": ["Orders"] "connector.shopName": "storename", "connector.authentication.accessToken":"sk_test_123456789"}'
To manually run a data transfer outside of your regular schedule, you can start a backfill run.
Supported tables
The Shopify connector supports the following data objects:
AppFeedbacksAppSubscriptionLineItems(Requires a sales channel app)AppSubscriptions(Requires a sales channel app)CatalogsCollectionsCompaniesCompanyContactRoleAssignmentsCompanyContactsCompanyLocationsCustomersDeliveryProfilesDiscountsAutomaticApp(Requires a discount function)DiscountsAutomaticBasic(Requires a discount function)DiscountsAutomaticBxgyDiscountsCodeAppDiscountsCodeBasicDiscountsCodeBxgyDraftOrdersFilesFulfillmentEventsFulfillmentOrdersFulfillmentsFulfillmentServicesFulfillmentTrackingInfoGiftCards(Requires a ShopifyPlus subscription)InventoryItemsLocationsMetafieldobjects, such asmetafield_productormetafield_order.OrderRiskAssessmentsOrdersOrderTransactionsPriceListsProductMediaImagesProductOptionsProductOptionValuesProductResourceFeedbacks(Requires a sales channel app)ProductsProductVariantsPublicationsRefundsReturnsScriptTagsSegmentsSellingPlanGroupsStorefrontAccessTokensUrlRedirects
Data type mapping
The following table maps Shopify data types to the corresponding BigQuery data types:
| Shopify data type | BigQuery data type |
|---|---|
String |
STRING |
Int |
INT64 |
Decimal |
NUMERIC |
Double |
FLOAT64 |
Long |
BIGNUMERIC |
Bool |
BOOL |
Datetime |
TIMESTAMP |
Pricing
There is no cost to transfer Shopify data into BigQuery while this feature is in Preview.
Troubleshoot transfer setup
If you are having issues setting up your data transfer, see Shopify transfer issues.
What's next
- For an overview of the BigQuery Data Transfer Service, see What is BigQuery Data Transfer Service.
- For information on using transfers including getting information about a transfer configuration, listing transfer configurations, and viewing a transfer's run history, see Manage transfers.