---
title: "Query and export"
description: "Ask a question of a dataset in SQL or in plain language, download the answer, and export whole datasets as Excel or CSV."
url: "https://www.jsonify.com/docs/datasets/query-and-export"
---

[Documentation](https://www.jsonify.com/docs/) Filter pages

## Getting started

*   [What is Jsonify?](https://www.jsonify.com/docs/)
*   [How pipelines work](https://www.jsonify.com/docs/how-jsonify-works)
*   [Your first pipeline](https://www.jsonify.com/docs/getting-started/first-pipeline)
*   [Workspaces](https://www.jsonify.com/docs/getting-started/workspaces)
*   [Glossary](https://www.jsonify.com/docs/getting-started/glossary)

## Tutorials

*   [Track the Hacker News front page](https://www.jsonify.com/docs/tutorials/hacker-news)
*   [Monitor prices across retailers](https://www.jsonify.com/docs/tutorials/price-monitoring)
*   [Get a Slack alert when a price drops](https://www.jsonify.com/docs/tutorials/slack-price-alert)
*   [Use a dataset from your agent](https://www.jsonify.com/docs/tutorials/agent-query)

## Jason

*   [Chatting with Jason](https://www.jsonify.com/docs/jason/chat)
*   [Changing a pipeline](https://www.jsonify.com/docs/jason/changing-a-pipeline)
*   [Agents, workers and repairs](https://www.jsonify.com/docs/data-agents)

## Pipelines

*   [The pipeline page](https://www.jsonify.com/docs/pipelines/overview)
*   [Statement of work and steps](https://www.jsonify.com/docs/pipelines/statement-of-work)
*   [Inputs and parameters](https://www.jsonify.com/docs/pipelines/inputs)
*   [Settings reference](https://www.jsonify.com/docs/pipelines/settings)
*   [Versions and changelog](https://www.jsonify.com/docs/pipelines/versions)

## Runs

*   [Running a pipeline](https://www.jsonify.com/docs/runs/running)
*   [Scheduling](https://www.jsonify.com/docs/runs/scheduling)
*   [Run detail](https://www.jsonify.com/docs/runs/run-detail)
*   [Run lifecycle](https://www.jsonify.com/docs/runs/lifecycle)
*   [Verification and repair](https://www.jsonify.com/docs/runs/verification-and-repair)

## Datasets

*   [Dataset pages](https://www.jsonify.com/docs/datasets/overview)
*   [Versions](https://www.jsonify.com/docs/datasets/versions)
*   [Query and export](https://www.jsonify.com/docs/datasets/query-and-export)
*   [Row detail and provenance](https://www.jsonify.com/docs/datasets/provenance)
*   [Sharing](https://www.jsonify.com/docs/datasets/sharing)

## Analytics

*   [Dashboards](https://www.jsonify.com/docs/analytics/dashboards)
*   [Newsletters](https://www.jsonify.com/docs/analytics/newsletters)

## Alerts

*   [Alert rules](https://www.jsonify.com/docs/alerts/rules)
*   [Alert history and notifications](https://www.jsonify.com/docs/alerts/history)

## Integrations

*   [Integrations overview](https://www.jsonify.com/docs/integrations/overview)
*   [Slack and email](https://www.jsonify.com/docs/integrations/slack-and-email)
*   [Sheets, warehouses and webhooks](https://www.jsonify.com/docs/integrations/destinations)
*   [Ingest and serve API](https://www.jsonify.com/docs/integrations/api)
*   [Connect your agent (MCP)](https://www.jsonify.com/docs/integrations/mcp)
*   [Command line](https://www.jsonify.com/docs/integrations/cli)

## Workspace and account

*   [Workspace settings](https://www.jsonify.com/docs/workspace/settings)
*   [Team](https://www.jsonify.com/docs/workspace/team)
*   [Billing and usage](https://www.jsonify.com/docs/workspace/billing)
*   [Data retention](https://www.jsonify.com/docs/workspace/data-retention)

## Plans

*   [Radar or Benchmark? Enterprise](https://www.jsonify.com/docs/radar-vs-benchmark)
*   [Row pricing and managed service](https://www.jsonify.com/docs/pricing-model)

## More

*   [Connect your agent](https://www.jsonify.com/connect)
*   [Pricing](https://www.jsonify.com/pricing)
*   [Contact support](https://www.jsonify.com/contact)

[Docs](https://www.jsonify.com/docs/)/Datasets

# Query and export

Ask a question of a dataset in SQL or in plain language, download the answer, and export whole datasets as Excel or CSV.

Three ways to get answers out of a dataset, from quickest to most flexible: filter the grid, run a read-only SQL query on the dataset page, or ask Jason in chat. Exports give you the whole thing as a file.

## Run query

Press **Run query** in the dataset header. The dialog is titled **Run SQL** and carries a green **Read only** pill: nothing you type here can change the data.

![The Run SQL dialog with the relation chips, the SQL editor prefilled with SELECT \* FROM data LIMIT 100, the Ask Jason button and the Run query button](/assets/images/product/datasets-run-query.png)

Run SQL. The worksheet you are viewing is called data; other worksheets get sheet\_ aliases.

### Relation names

The panel at the top says which version you are querying (“Query Live product offers version v2”) and lists the names to use in your query:

*   **`data`** is the worksheet you are viewing. It is tagged “current”.
*   **`sheet_{name}`** is each other worksheet of the same version, for example `sheet_offers` or `sheet_menu_items`. Names are lower-cased with punctuation replaced by underscores.

You can join worksheets by these names. You cannot reference other datasets; to combine datasets, build a dashboard (whose widgets can join across confirmed relationships) or ask Jason.

### The editor

| Option | Values | Default | What it does |
| --- | --- | --- | --- |
| SQL query | One SELECT or VALUES statement, PostgreSQL syntax | SELECT * FROM data LIMIT 100 | The query to run. Press Cmd/Ctrl+Enter to run it. |
| Ask Jason | A sentence describing what the query should show, up to 4,000 characters | Empty | Replaces the editor text with a query Jason writes. It is not run until you press Run query. |

Rules the server applies:

*   Exactly one `SELECT` or `VALUES` statement. Anything else, including a second statement after a semicolon, is rejected with the parser’s message.
*   Only the listed relation names.
*   Results are capped at **200 rows** and 2 MB. Use `ORDER BY` and `LIMIT` to make sure the rows you want are the ones that come back.
*   Queries are not saved. The editor resets to the default when you reopen the dialog or change version or worksheet. Keep useful queries in your own notes.

### Ask Jason

Press **Ask Jason** in the editor toolbar, type what you want to see, and press **Generate**. Jason reads the column names and types of every worksheet in the version, writes one query, and puts it in the editor for you to read and run. Edit it if it is not quite right; Jason cannot see the values in the rows, only the columns.

> Average current price and product count per brand, brands with the most products first

> Jason fills the editor with a `GROUP BY brand` query ordered by count. Press **Run query** to see the rows.

If Jason cannot produce a safe query from your description, the dialog says “Jason could not generate a safe query. Try a more specific description.” Naming the columns you mean usually fixes it.

### Results

Results appear under the editor with a row count, a resizable table, and an **Export** button that downloads the result as a CSV named after the dataset, query and version (`live-product-offers-query-v2.csv`). An empty result reads “The query returned no rows.”

## Example queries

These run against the **Live product offers** example dataset (`/datasets/marketdata01`) that new workspaces start with. Its columns include `product_id`, `product_name`, `brand`, `category`, `current_price`, `previous_price`, `availability`, `retailer_count` and `review_score`, plus a link column per retailer. Swap in your own column names.

**Which brands have the most products, and what do they cost on average?**

```
SELECT brand,
       COUNT(*) AS products,
       ROUND(AVG(current_price)::numeric, 2) AS avg_price
FROM data
GROUP BY brand
ORDER BY products DESC
LIMIT 20
```

**Which products dropped in price, and by how much?**

```
SELECT product_name,
       brand,
       previous_price,
       current_price,
       ROUND(((current_price - previous_price) / previous_price * 100)::numeric, 1) AS change_pct
FROM data
WHERE current_price < previous_price
ORDER BY change_pct ASC
LIMIT 25
```

**How many products are in each availability state?**

```
SELECT availability, COUNT(*) AS products
FROM data
GROUP BY availability
ORDER BY products DESC
```

**A category summary: count, price range and average review.**

```
SELECT category,
       COUNT(*) AS products,
       MIN(current_price) AS cheapest,
       MAX(current_price) AS priciest,
       ROUND(AVG(review_score)::numeric, 2) AS avg_review
FROM data
GROUP BY category
ORDER BY products DESC
```

**Well-reviewed products under $50.**

```
SELECT product_name, brand, current_price, review_score
FROM data
WHERE current_price < 50 AND review_score >= 4.5
ORDER BY review_score DESC, current_price ASC
LIMIT 20
```

**Low-stock products sold by the most retailers.**

```
SELECT product_name, brand, retailer_count
FROM data
WHERE availability = 'Low stock'
ORDER BY retailer_count DESC
LIMIT 20
```

> Column formats are display settings. A currency column holds a plain number, so compare it with `< 50`, not `< '$50'`. Text columns are case sensitive in `=`; use `ILIKE '%oled%'` for a case-insensitive match.

## Export

Exports are in the header menu on the dataset page, and on a pipeline’s **Latest outputs** tab.

| Item | Format | What is included |
| --- | --- | --- |
| Export Excel workbook | .xlsx | Every worksheet of the version you are viewing, one sheet each, in the column order from table settings. Worksheets over 1,048,575 rows cannot be exported as Excel; use CSV. |
| Export current table as CSV | .csv | The worksheet you are viewing. Hidden columns are included. |

JSON export is available by adding `?export_format=json` to the dataset page’s address.

1.  **Choose the export.** A toast reads “Preparing export…” and both export items are disabled until it finishes.
2.  **Wait.** The file is built in the background; the page checks every couple of seconds. Large datasets take longer. You can keep using the page.
3.  **Download.** When the toast says “Export ready” the browser downloads the file, named after the dataset. The file is removed from our side once it has been downloaded.

An export you did not download stays available for **24 hours**; after that the toast reads “The generated file is no longer available; request it again.” If the export fails, the toast says so and you can try again.

For a recurring export, do not export by hand: connect a destination such as Google Sheets or a webhook and every new version is delivered automatically. See [Sheets, warehouses and webhooks](https://www.jsonify.com/docs/integrations/destinations).

## Asking Jason in chat

For questions that need reasoning across versions, datasets or time, ask Jason in the workspace chat or in the sidebar on the dataset page. Jason can read any dataset in the workspace, run queries on your behalf, compare versions, and reply with a table or a summary. It does not change anything unless you ask it to.

> In Live product offers, which products went from In stock to Low stock since last week, and which retailers list them?

> Jason compares the two versions on `product_id`, lists the products whose availability changed, and includes the retailer links from the row. It offers to set up an alert rule if you want to hear about this automatically.

Selecting rows in the grid before you ask pins them for Jason, so “why do these three have no brand?” refers to exactly those rows. See [Chatting with Jason](https://www.jsonify.com/docs/jason/chat).

## What’s next

[**Dashboards**

Turn a question you keep asking into a widget that stays current.

](https://www.jsonify.com/docs/analytics/dashboards)[**Alert rules**

Be told when a value crosses a line instead of querying for it.

](https://www.jsonify.com/docs/alerts/rules)[**Connect your agent (MCP)**

Query datasets from your own agent over MCP.

](https://www.jsonify.com/docs/integrations/mcp)[**Destinations**

Sheets, warehouses and webhooks for recurring delivery.

](https://www.jsonify.com/docs/integrations/destinations)

[PreviousVersions](https://www.jsonify.com/docs/datasets/versions) [NextRow detail and provenance](https://www.jsonify.com/docs/datasets/provenance)

Something missing or wrong? [Tell us](https://www.jsonify.com/contact).[Build it →](https://factory.jsonify.com/setup)

## On this page
