---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://segmentstream.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# segmentstream warehouse query

Run a read-only SQL query against the workspace data warehouse.

## Usage

Command syntax

```
segmentstream warehouse query [OPTIONS]
```

Run a read-only SQL query against the workspace data warehouse.  SQL is sent unchanged in the warehouse's own dialect, currently BigQuery GoogleSQL; it is not translated. Only a single SELECT statement is allowed. Reference tables as DATASET.TABLE; they resolve to the workspace project. Queries bill at most 1 TiB by default; --max-bytes-billed lowers that limit and --dry-run reports the estimated bytes without running the query.  Examples: segmentstream warehouse query --sql 'SELECT COUNT(\*) AS n FROM gold.orders' segmentstream warehouse query --file report.sql --output csv > report.csv segmentstream warehouse query --file - --dry-run < report.sql segmentstream warehouse query --query-id ID --page-token TOKEN

## Options

- `--sql SQL`

  SQL text to run

- `--file FILE|-`

  Read SQL from a file or stdin

- `--query-id ID`

  Read results of an earlier query instead of running SQL

- `--page-token TOKEN`

  Read a later page of --query-id

- `--all`

  Fetch all remaining result pages

- `--page-size INTEGER RANGE`

  Rows per result page \[default: 500; 1<=x<=1000]

- `--dry-run`

  Validate and estimate bytes without running

- `--max-bytes-billed SIZE`

  Lower the billing limit, e.g. 50GiB (bytes, KiB, MiB, GiB, TiB)

- `--timeout INTEGER RANGE`

  Seconds to wait for a running query before printing its ID \[default: 3600; 1<=x<=21600]

- `--workspace UUID`

  Override the linked workspace

- `--output [table|json|csv]`

  \[default: table]

- `--api-url URL`

  SegmentStream control-plane origin

- `--organization ORG-ID`

  Organization for this command

- `--help`

  Show this message and exit.

[Read as Markdown ↗](https://segmentstream.com/docs/cli/warehouse/query.md)
