Skip to main content
StockfulQL is a query language for your store’s inventory. You write a query to ask a question, like “what is my stock worth” or “which products sell fastest,” and get back a table you can optionally turn into a chart. It reads like SQL and runs against your live inventory, sales, purchasing and returns data. You rarely write it by hand (the report editor builds it for you), but it is always there to read, edit and share.

Getting started

Start with a question about your store and write it as a query. Each example below adds one clause to the one before it, building from a simple total to a full chart.
FROM picks the inventory dataset and SHOW picks the inventory_value metric. With no grouping, the result is a single total.
Add GROUP BY vendor to break the total down into one row per vendor.
Switch to the sales dataset, show revenue and units, group by product, and set the window with DURING. ORDER BY and LIMIT keep the top rows.
COMPARE TO previous_period runs the query again over the prior window and adds the change to each row.
VISUALIZE turns the table into a chart. Here the top sellers become a bar chart, each bar carrying its change against the month before.
See Syntax for every clause, and Examples for more complete queries.

Running StockfulQL

You write a query once and meet the same query in a few places. The query is identical everywhere; only what surrounds it changes.

Parts of a query

  • Syntax is the clause set: FROM and SHOW, WHERE, GROUP BY, date ranges, comparison, TIMESERIES, sorting, limits and charts.
  • Datasets are the data you can query, grouped by area. Each dataset’s page lists the metrics, dimensions and filters it exposes.
A query always names one dataset and shows at least one metric. Everything else is optional.