Skip to main content

ShopifyQL Python SDK and CLI

You can access ShopifyQL data through a dedicated Python SDK and CLI tool designed for analytics workflows.

The shopifyql Python package provides a clean, Pythonic interface for ShopifyQL queries while handling GraphQL API complexity behind the scenes. It eliminates manual OAuth implementation and HTTP request handling, returning data directly as pandas DataFrames. This enables developers to create reporting apps and export store data to data warehouses without managing GraphQL interactions directly.


To install the base package, run:

Terminal

pip install shopifyql

Or you can include support for pandas and polars DataFrames:

Terminal

pip install "shopifyql[all]"

Use the Python SDK to query ShopifyQL data:

Python

from shopifyql import ShopifyQLClient

client = ShopifyQLClient(shop="your-shop", access_token="shpat_...")

records = client.query("FROM sales SHOW total_sales SINCE -3m GROUP BY month ORDER BY month")

For data analysis workflows, get results directly as pandas DataFrames:

Python

from shopifyql import ShopifyQLClient

client = ShopifyQLClient(shop="your-shop", access_token="shpat_...")
df = client.query_pandas("FROM sales SHOW total_sales SINCE -3m GROUP BY month ORDER BY month")
print(df.head())

This makes it easy to create reporting apps and export store data to data warehouses without managing GraphQL interactions directly.


Anchor to Jupyter notebook templateJupyter notebook template

The fastest way to get started is with the CLI template that sets up a complete development environment:

Terminal

shopify app init --template=https://github.com/Shopify/shopify-app-notebooks-template

This template provides:

  • Pre-configured Python 3.11+ environment with Jupyter notebooks.
  • Automatic app configuration and authentication.
  • All necessary dependencies installed.
  • Ready-to-use development environment powered by Shopify CLI.


Was this page helpful?