Introducing ShopifyQL: Our New Commerce Data Querying Language
ShopifyQL is a commerce-focused query language for Shopify Plus merchants that reorders SQL-like syntax (FROM before SHOW, BY instead of GROUP BY) and adds VISUALIZE for direct charting, COMPARE TO for period-over-period analysis without joins or window functions, and DURING for named commerce date ranges like BFCM. It runs over purpose-built exploration data models: single flat tables at the lowest domain grain with fully additive metrics and overlapping coverage across products, orders and customers. Merchants use it through ShopifyQL Notebooks, partners through GraphQL APIs, and Shopify plans to power all Admin analytics with it, with pivoting, aggregate filters in WHERE and more chart types on the roadmap.
Related posts
- ShopifyQL Notebooks: Simplifying Querying with Commerce Data Models
Shopify Engineering mediumAdeptShopify built commerce data models behind ShopifyQL Notebooks so merchants can query metrics like sales and view-to-purchase conversion without SQL or joining across departmental datasets. Good models are purpose-driven, explorable (right granularity, useful dimensions, fully additive metrics rather than semi- or non-additive ones) and extensible. The process runs from business questions to mock data and template queries, then to sourcing upstream tables, checking quality and consistency, and deriving freshness from upstream SLOs. Build time improved by switching from full-drop to incremental pipelines, at some cost in maintainability, and query speed improved with daily per-product roll-up tables for high-cardinality GROUP BYs.
- How Shopify Built An In-Context Analytics Experience
Shopify Engineering mediumAdeptShopify embedded order and fulfillment metrics directly into the admin Orders page instead of keeping them in a separate Analytics section, after research showed merchants bouncing between pages to make decisions. The data science team validated candidate metrics against merchant workflows, segmented merchants to study the shape of each metric (hiding metrics that are inapplicable, constant, or only useful over long periods), and prototyped visualizations with real data. One result was choosing histograms over medians for fulfillment and delivery times. A shared data specification sheet kept Web, Android and iOS on the same queries. The underlying model uses an atomic grain of one row per fulfillment, in-transit or delivery event, and was built batch-first, then combined with streaming in a lambda architecture so batch supplies history and streaming covers recent data.
- The evolution of SQL-based observability
ClickHouse mediumAdept
ClickHouse's rewritten JSON column type is presented as the key observability advance of the past year. It replaces the Map(String, String) columns used for OpenTelemetry attributes, which lose type precision, require linear scans of every key, hide available keys and cannot nest. The new type stores each unique path and type pair as its own dense sub-column using offsets, so queries read only the paths they need. Paths beyond a limit overflow into a shared data column. The post revisits the checklist for when SQL-based observability fits, shows how OTel log schemas would adopt JSON columns, and previews experimental work toward metrics support.
- The Complex Data Models Behind Shopify's Tax Insights Feature
Shopify Engineering mediumAdeptShopify's Tax Insights feature tells US merchants when they reach sales-tax economic nexus in each state. It runs on a pipeline of Spark data models over warehouse tables in GCS. State rules differ in dollar and order thresholds, inclusive or exclusive comparisons, excluded order types, and evaluation periods (prior calendar year, rolling 12 months, preceding four quarters). To handle this, the team built a rules lookup table with valid_from/valid_to dates, which drives a dimensional model of evaluation windows and thresholds per state per date. That model is joined to monthly merchant-state sales to produce a merchant-state-month liability model. The latest snapshot is pushed to Bigtable keyed by merchant ID for the app backend to serve. The team prototyped in SQL with BigQuery before PySpark, split the logic into intermediate models, and generalized the design so it later extended to Canadian GST.
- Double Entry Transition Tables: How We Track State Changes At Shopify
Shopify Engineering mediumAdeptDouble entry transition tables record each state change as two rows, a -1 row for the previous state and a +1 row for the new state, so counting entities in any state reduces to summing a net_change column. Shopify built a PySpark pipeline that merges per-attribute transition tables (Balance account status and Shopify account status) on a partition key and a sort key, forward-fills missing values, and uses a row-number index to break timestamp ties. The result answers how many merchants actively use Shopify Balance over time. New attributes can be added without rewriting downstream SQL or PySpark, at the cost of significant up-front build effort.