Skip to content

Query Dataset

POST
/v1/datasets/{dataset_id}/query
curl --request POST \
--url https://example.com/v1/datasets/example/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "sql": "SELECT * FROM data", "offset": 0, "limit": 100 }'

Run one DuckDB SELECT over the table data, the dataset, and return a page of its rows, e.g. SELECT * FROM data WHERE stars = 1 ORDER BY review LIMIT 20. It can read nothing but the dataset. agree([a, b, …]) and disagree([a, b, …]) compare columns in a row; see POST /v1/datasets/{id}/compare.

dataset_id
required
Dataset Id
string
Media typeapplication/json
QueryRequest
object
sql
Sql

One DuckDB SELECT over the table data.

string
default: SELECT * FROM data
offset
Offset
integer
0
limit
Limit

Rows to return; the query’s own LIMIT caps the total.

integer
default: 100 >= 1 <= 1000

Successful Response

Media typeapplication/json
QueryResult
object
columns
required
Columns

What the query returns, which needn’t be the dataset’s.

Array<object>
Column
object
name
required
Name
string
type
required
Type
string
rows
required
Rows
Array<object>
object
key
additional properties
any
total
required
Total

Rows the query returns, ignoring offset and limit.

integer

Example generated

{
"columns": [
{
"name": "example",
"type": "example"
}
],
"rows": [
{}
],
"total": 1
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Example generated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}