Skip to content

Examples

Every example below runs against the public samples corpus — a small star schema you can query today:

FileColumns
sales.parquetorder_id, order_date, region_id, product_id, quantity, revenue
regions.parquetregion_id, region_name, country
products.parquetproduct_id, product_name, category, unit_cost

Copy a formula into a cell and it will resolve — these URLs are live.

Name the sales file, then total revenue by region. The result spills from the cell holding =DB.QUERY, header row first.

A1: =DB.SOURCE("https://dev-fdb.sumpalabs.com/samples/sales.parquet", "sales")
A3: =DB.QUERY("SELECT region_id, ROUND(SUM(revenue)) AS total
FROM sales
GROUP BY region_id
ORDER BY total DESC", A1)

A3 spills a region_id | total header followed by one row per region, biggest first.

region_id isn’t very readable. Bring in the regions file as a second source and JOIN on the key to get region names. Each source gets its own cell; pass both to =DB.QUERY.

A1: =DB.SOURCE("https://dev-fdb.sumpalabs.com/samples/sales.parquet", "sales")
A2: =DB.SOURCE("https://dev-fdb.sumpalabs.com/samples/regions.parquet", "regions")
A4: =DB.QUERY("SELECT r.region_name, ROUND(SUM(s.revenue)) AS total
FROM sales s
JOIN regions r ON s.region_id = r.region_id
GROUP BY r.region_name
ORDER BY total DESC", A1, A2)

Now A4 reads region_name | total — the same totals, labelled by name.

Sometimes the lookup table lives in the workbook, not in a file. Type a small targets table into the sheet and bind the range as a source — formulaDB reads the live cells, so editing a target re-runs the query.

Type this into D1:E4 (the first row is the header):

region_idtarget
1500000
2400000
3300000

Then bind the range and JOIN it against the remote sales totals:

A1: =DB.SOURCE("https://dev-fdb.sumpalabs.com/samples/sales.parquet", "sales")
G1: =DB.SOURCE(D1:E4, "targets")
G3: =DB.QUERY("SELECT t.region_id,
ROUND(SUM(s.revenue)) AS actual,
t.target,
ROUND(SUM(s.revenue)) - t.target AS variance
FROM sales s
JOIN targets t ON s.region_id = t.region_id
GROUP BY t.region_id, t.target
ORDER BY variance DESC", A1, G1)

G3 compares each region’s actual revenue to its target. Change a number in D1:E4 and the query recalculates — the range is read live, never copied.

  • =DB.QUERY — the full reference: spill shape, limits, and the error matrix.
  • =DB.SOURCE — every source shape, including local files and Excel Tables.
  • =DB.SCHEMA — list a source’s columns before you query it.