SQL (beta)
SQL over the documents' metadata.
SQL over a namespace (beta)
/v1/namespaces/{name}/sql beta metered: query Beta: the dialect may grow. A query over the namespace's documents as the table docs; the tenant's other namespaces are tables too, by name (quoted when it has - or .: "web-logs"), so it can join them. A key limited to some namespaces sees no others. Columns: id and every top-level meta key, typed from the values: int (booleans 1/0), float, text, date or time; missing is NULL; SHOW COLUMNS lists a namespace's. contains(text, '...') and grep(text, 'regex') go through the text index (in WHERE, on one table: contains(e.text, ...) when there are several). SELECT, WITH, UNION / INTERSECT / EXCEPT [ALL]; joins (INNER, LEFT, RIGHT, FULL, CROSS, USING, NATURAL); subqueries (IN, EXISTS, scalar, in FROM; correlated as [NOT] EXISTS / IN with = conditions); GROUP BY (ROLLUP, CUBE, GROUPING SETS), HAVING, QUALIFY, DISTINCT, ORDER BY, LIMIT / OFFSET; window functions (ROW_NUMBER, RANK, DENSE_RANK, NTILE, PERCENT_RANK, CUME_DIST, LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE, aggregates OVER (PARTITION BY ... ORDER BY ... ROWS BETWEEN ...)); aggregates COUNT, COUNT(DISTINCT), SUM, AVG, MIN, MAX, STDDEV, VARIANCE, MEDIAN, QUANTILE, PERCENTILE_CONT / DISC, MODE, STRING_AGG, ARG_MIN / ARG_MAX, BOOL_AND / BOOL_OR, COUNT_IF, CORR, with FILTER (WHERE ...); + - * / (a float; NULL dividing by 0) // %; CASE, COALESCE, NULLIF, CAST / TRY_CAST, text, math and date functions (LOWER, SUBSTRING, CONCAT, ||, REPLACE, SPLIT_PART, REGEXP*, ROUND, EXTRACT, DATE_TRUNC, DATE_DIFF, INTERVAL, STRFTIME, ...). LENGTH counts bytes, CHAR_LENGTH characters. A query reads at most 16 tables; JSON answers stop at 10,000 rows (truncated): format=ndjson or csv (or Accept: application/x-ndjson / text/csv) streams every row instead (a plain scan of one namespace any number, window by window; other shapes up to their row cap, then a last too_many_rows line and a broken transfer), and POST /v1/sql/exports writes an answer to a file. Writes (write scope): INSERT INTO ns [(columns)] VALUES (...) | SELECT ..., CREATE TABLE ns AS SELECT ..., DELETE FROM ns [WHERE ...]; a row's id column names the document (an existing id is replaced), its text column is its text, the rest metadata; each statement is one commit (all rows or none; a DELETE removes at most 1,000,000), metered as writes, and the answer has dml. Reference: https://docs.skimmerdb.com/reference/sql. A time limit per plan (10 s free, 30 s pro) and SQL queries in flight per tenant (2 free, 8 pro; 429 past it). Errors in the SQL are 422 with the reason; 413 when it would read too much. One query is metered, however many namespaces it reads. Counts as one query (metered; see Usage).
Parameters
namestring · pathrequiredThe namespace's name. |
formatstring · queryndjson or csv: every row streamed as it's made (no 10,000-row cap; Accept: application/x-ndjson or text/csv does the same). Its types come in X-Skimmerdb-Types. An error before the first row is the usual JSON error; after it, NDJSON gets a last error line and the transfer is broken off (never a short answer that looks whole). |
Body application/json
sqlstringrequiredOne query (SELECT, WITH, UNION ...) whose tables are namespaces (docs: the one in the path), SHOW COLUMNS, or a write (write scope): INSERT INTO ns [(columns)] VALUES (...) | SELECT ..., CREATE TABLE ns AS SELECT ..., DELETE FROM ns [WHERE ...]. |
format"json" | "ndjson" | "csv"json: the answer below (at most 10,000 rows). ndjson or csv: the rows streamed as they're made, with no row cap (as ?format= or an Accept header). Default "json". |
Answer
namespacestringThe namespace in the path ("" for /v1/sql). |
columnsstring[] |
typesstring[]int, float, text, date, time, decimal (its values as strings, exact) or null (every value NULL), one a column. |
rowsstring | number | null[][] |
chunksintegerColumn blocks in the namespaces read. |
scannedintegerColumn blocks read. |
partialbooleanReserved for response compatibility; incomplete SQL text reads fail with 503. |
truncatedbooleanMore than 10,000 rows: these are the first. |
took_msnumber |
dmlSqlWriteWhat a SQL write did (INSERT, CREATE TABLE, DELETE). |
dml.statement"insert" | "create" | "delete" |
dml.namespacestringThe namespace written. |
dml.insertedintegerDocuments written (an id that existed is replaced). |
dml.deletedinteger |
dml.versionintegerThe namespace's version with the write. |
dml.createdbooleanThe statement made the namespace. |
partialsobjectPresent when the query ran from per-segment partials (one namespace and aggregates that merge from parts, or a view): which view's partials answered it and how many segments' partials were computed for it or reused. Always exact. |
partials.viewstring | nullThe named view read (several: comma-separated), or null. |
partials.kind"named" | "auto" | "none"named: a view's kept partials; auto: an automatic view's (a query shape repeated on a big namespace); none: partials kept in memory only. |
partials.computedintegerSegments whose partials were computed for this query. |
partials.reusedintegerSegments whose partials were reused (unchanged since computed). |
partials.remoteintegerOf those computed, how many on other servers of the cluster. |
temperaturestringHow warm the namespace was: warm (open), local (opened from the server's disk) or cold (opened from object storage). |
store_getsintegerObject-storage reads this query made (0 when warm). |
store_bytesintegerBytes those reads fetched. |
cpu_msnumberCPU the query used (metered, not billed). |
timed_outbooleanThe query ran past the plan's time limit (query_seconds): the answer is partial. |
Status codes
200OK |
400Malformed: not the JSON expected. |
401No key, or an unknown or revoked one. |
402The free plan's included usage this period is used up (queries, query CPU, object-storage reads, bytes returned, writes or storage; the message says which), or its namespace count or daily namespace creations are reached (code namespace_limit): upgrade to pro. |
403The key's scope or namespaces don't allow it, or the tenant is suspended. |
404No such namespace, document, key or tenant (or one this key may not see: the same answer). |
409Exists already, or not possible in this state. |
413Too big: a request's documents (64 MB), an import (2 GB), or what a SQL query would read. |
422Invalid: the message says why (code invalid with fields: which input fields; query_timeout: past the plan's time limit; scan_refused: send scan: true). |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
503Object storage failed: retry (nothing was written, unless the code is write_unknown: then it may have been; retrying a write is safe). |
507The tenant's storage quota is full. |
curl -s https://api.skimmerdb.com/v1/namespaces/support/sql \
-H "Authorization: Bearer $KEY" \
-d '{"sql":"SELECT status, COUNT(*) AS n, AVG(priority) AS p FROM docs WHERE contains(text, 'refund') GROUP BY status ORDER BY n DESC"}'from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import query_sql
from skimmerdb._api.models import SqlRequest
db = SkimmerDB() # SKIMMERDB_KEY
answer = query_sql.sync("support", client=db.api, body=SqlRequest.from_dict({"sql":"SELECT status, COUNT(*) AS n, AVG(priority) AS p FROM docs WHERE contains(text, 'refund') GROUP BY status ORDER BY n DESC"}))import { SkimmerDB } from "skimmerdb";
import { querySql } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await querySql({ client: db.client, path: { name: "support" }, body: {"sql":"SELECT status, COUNT(*) AS n, AVG(priority) AS p FROM docs WHERE contains(text, 'refund') GROUP BY status ORDER BY n DESC"} });{
"namespace": "support",
"columns": [
"status",
"n",
"p"
],
"types": [
"text",
"int",
"float"
],
"rows": [
[
"open",
1,
3
]
],
"chunks": 1,
"scanned": 1,
"partial": false,
"truncated": false,
"took_ms": 0.9,
"temperature": "warm",
"store_gets": 0,
"store_bytes": 0,
"cpu_ms": 0.4,
"timed_out": false
}SQL over a namespace, by URL (beta)
/v1/namespaces/{name}/sql beta metered: query Beta. As POST /v1/namespaces/{name}/sql. The same query as a GET, for clients that can only fetch a URL: DuckDB's read_csv / read_json over https (with a CREATE SECRET of TYPE http and BEARER_TOKEN), curl, a spreadsheet's import. The SQL goes in ?sql= (URL-encoded; DuckDB reads a * in a URL as a glob: write %2A). Reads only: SQL that writes answers 405.
Parameters
namestring · pathrequiredThe namespace's name. |
sqlstring · queryThe query, URL-encoded. |
formatstring · queryndjson or csv: every row streamed as it's made (no 10,000-row cap; Accept: application/x-ndjson or text/csv does the same). Its types come in X-Skimmerdb-Types. An error before the first row is the usual JSON error; after it, NDJSON gets a last error line and the transfer is broken off (never a short answer that looks whole). |
Answer
namespacestringThe namespace in the path ("" for /v1/sql). |
columnsstring[] |
typesstring[]int, float, text, date, time, decimal (its values as strings, exact) or null (every value NULL), one a column. |
rowsstring | number | null[][] |
chunksintegerColumn blocks in the namespaces read. |
scannedintegerColumn blocks read. |
partialbooleanReserved for response compatibility; incomplete SQL text reads fail with 503. |
truncatedbooleanMore than 10,000 rows: these are the first. |
took_msnumber |
dmlSqlWriteWhat a SQL write did (INSERT, CREATE TABLE, DELETE). |
dml.statement"insert" | "create" | "delete" |
dml.namespacestringThe namespace written. |
dml.insertedintegerDocuments written (an id that existed is replaced). |
dml.deletedinteger |
dml.versionintegerThe namespace's version with the write. |
dml.createdbooleanThe statement made the namespace. |
partialsobjectPresent when the query ran from per-segment partials (one namespace and aggregates that merge from parts, or a view): which view's partials answered it and how many segments' partials were computed for it or reused. Always exact. |
partials.viewstring | nullThe named view read (several: comma-separated), or null. |
partials.kind"named" | "auto" | "none"named: a view's kept partials; auto: an automatic view's (a query shape repeated on a big namespace); none: partials kept in memory only. |
partials.computedintegerSegments whose partials were computed for this query. |
partials.reusedintegerSegments whose partials were reused (unchanged since computed). |
partials.remoteintegerOf those computed, how many on other servers of the cluster. |
temperaturestringHow warm the namespace was: warm (open), local (opened from the server's disk) or cold (opened from object storage). |
store_getsintegerObject-storage reads this query made (0 when warm). |
store_bytesintegerBytes those reads fetched. |
cpu_msnumberCPU the query used (metered, not billed). |
timed_outbooleanThe query ran past the plan's time limit (query_seconds): the answer is partial. |
Status codes
200OK |
400Malformed: not the JSON expected. |
401No key, or an unknown or revoked one. |
402The free plan's included usage this period is used up (queries, query CPU, object-storage reads, bytes returned, writes or storage; the message says which), or its namespace count or daily namespace creations are reached (code namespace_limit): upgrade to pro. |
403The key's scope or namespaces don't allow it, or the tenant is suspended. |
404No such namespace, document, key or tenant (or one this key may not see: the same answer). |
405Not with this method: SQL that writes needs POST. |
413Too big: a request's documents (64 MB), an import (2 GB), or what a SQL query would read. |
422Invalid: the message says why (code invalid with fields: which input fields; query_timeout: past the plan's time limit; scan_refused: send scan: true). |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
503Object storage failed: retry (nothing was written, unless the code is write_unknown: then it may have been; retrying a write is safe). |
curl -s https://api.skimmerdb.com/v1/namespaces/support/sql \
-H "Authorization: Bearer $KEY"from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import query_sql_get
db = SkimmerDB() # SKIMMERDB_KEY
answer = query_sql_get.sync("support", client=db.api)import { SkimmerDB } from "skimmerdb";
import { querySqlGet } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await querySqlGet({ client: db.client, path: { name: "support" } });SQL across namespaces (beta)
/v1/sql beta metered: query Beta. A query whose tables are the tenant's namespaces, each by name (quoted when it has - or .: "web-logs"); no table is docs here. A key limited to some namespaces sees only those: any other name is no table, like one nobody has. Columns: id and every top-level meta key, typed from the values: int (booleans 1/0), float, text, date or time; missing is NULL; SHOW COLUMNS lists a namespace's. contains(text, '...') and grep(text, 'regex') go through the text index (in WHERE, on one table: contains(e.text, ...) when there are several). SELECT, WITH, UNION / INTERSECT / EXCEPT [ALL]; joins (INNER, LEFT, RIGHT, FULL, CROSS, USING, NATURAL); subqueries (IN, EXISTS, scalar, in FROM; correlated as [NOT] EXISTS / IN with = conditions); GROUP BY (ROLLUP, CUBE, GROUPING SETS), HAVING, QUALIFY, DISTINCT, ORDER BY, LIMIT / OFFSET; window functions (ROW_NUMBER, RANK, DENSE_RANK, NTILE, PERCENT_RANK, CUME_DIST, LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE, aggregates OVER (PARTITION BY ... ORDER BY ... ROWS BETWEEN ...)); aggregates COUNT, COUNT(DISTINCT), SUM, AVG, MIN, MAX, STDDEV, VARIANCE, MEDIAN, QUANTILE, PERCENTILE_CONT / DISC, MODE, STRING_AGG, ARG_MIN / ARG_MAX, BOOL_AND / BOOL_OR, COUNT_IF, CORR, with FILTER (WHERE ...); + - * / (a float; NULL dividing by 0) // %; CASE, COALESCE, NULLIF, CAST / TRY_CAST, text, math and date functions (LOWER, SUBSTRING, CONCAT, ||, REPLACE, SPLIT_PART, REGEXP*, ROUND, EXTRACT, DATE_TRUNC, DATE_DIFF, INTERVAL, STRFTIME, ...). LENGTH counts bytes, CHAR_LENGTH characters. A query reads at most 16 tables; JSON answers stop at 10,000 rows (truncated): format=ndjson or csv (or Accept: application/x-ndjson / text/csv) streams every row instead (a plain scan of one namespace any number, window by window; other shapes up to their row cap, then a last too_many_rows line and a broken transfer), and POST /v1/sql/exports writes an answer to a file. Writes (write scope): INSERT INTO ns [(columns)] VALUES (...) | SELECT ..., CREATE TABLE ns AS SELECT ..., DELETE FROM ns [WHERE ...]; a row's id column names the document (an existing id is replaced), its text column is its text, the rest metadata; each statement is one commit (all rows or none; a DELETE removes at most 1,000,000), metered as writes, and the answer has dml. Reference: https://docs.skimmerdb.com/reference/sql. A time limit per plan (10 s free, 30 s pro) and SQL queries in flight per tenant (2 free, 8 pro; 429 past it). Errors in the SQL are 422 with the reason; 413 when it would read too much. One query is metered, however many namespaces it reads. Counts as one query (metered; see Usage).
Parameters
formatstring · queryndjson or csv: every row streamed as it's made (no 10,000-row cap; Accept: application/x-ndjson or text/csv does the same). Its types come in X-Skimmerdb-Types. An error before the first row is the usual JSON error; after it, NDJSON gets a last error line and the transfer is broken off (never a short answer that looks whole). |
Body application/json
sqlstringrequiredOne query (SELECT, WITH, UNION ...) whose tables are namespaces (docs: the one in the path), SHOW COLUMNS, or a write (write scope): INSERT INTO ns [(columns)] VALUES (...) | SELECT ..., CREATE TABLE ns AS SELECT ..., DELETE FROM ns [WHERE ...]. |
format"json" | "ndjson" | "csv"json: the answer below (at most 10,000 rows). ndjson or csv: the rows streamed as they're made, with no row cap (as ?format= or an Accept header). Default "json". |
Answer
namespacestringThe namespace in the path ("" for /v1/sql). |
columnsstring[] |
typesstring[]int, float, text, date, time, decimal (its values as strings, exact) or null (every value NULL), one a column. |
rowsstring | number | null[][] |
chunksintegerColumn blocks in the namespaces read. |
scannedintegerColumn blocks read. |
partialbooleanReserved for response compatibility; incomplete SQL text reads fail with 503. |
truncatedbooleanMore than 10,000 rows: these are the first. |
took_msnumber |
dmlSqlWriteWhat a SQL write did (INSERT, CREATE TABLE, DELETE). |
dml.statement"insert" | "create" | "delete" |
dml.namespacestringThe namespace written. |
dml.insertedintegerDocuments written (an id that existed is replaced). |
dml.deletedinteger |
dml.versionintegerThe namespace's version with the write. |
dml.createdbooleanThe statement made the namespace. |
partialsobjectPresent when the query ran from per-segment partials (one namespace and aggregates that merge from parts, or a view): which view's partials answered it and how many segments' partials were computed for it or reused. Always exact. |
partials.viewstring | nullThe named view read (several: comma-separated), or null. |
partials.kind"named" | "auto" | "none"named: a view's kept partials; auto: an automatic view's (a query shape repeated on a big namespace); none: partials kept in memory only. |
partials.computedintegerSegments whose partials were computed for this query. |
partials.reusedintegerSegments whose partials were reused (unchanged since computed). |
partials.remoteintegerOf those computed, how many on other servers of the cluster. |
temperaturestringHow warm the namespace was: warm (open), local (opened from the server's disk) or cold (opened from object storage). |
store_getsintegerObject-storage reads this query made (0 when warm). |
store_bytesintegerBytes those reads fetched. |
cpu_msnumberCPU the query used (metered, not billed). |
timed_outbooleanThe query ran past the plan's time limit (query_seconds): the answer is partial. |
Status codes
200OK |
400Malformed: not the JSON expected. |
401No key, or an unknown or revoked one. |
402The free plan's included usage this period is used up (queries, query CPU, object-storage reads, bytes returned, writes or storage; the message says which), or its namespace count or daily namespace creations are reached (code namespace_limit): upgrade to pro. |
403The key's scope or namespaces don't allow it, or the tenant is suspended. |
404No such namespace, document, key or tenant (or one this key may not see: the same answer). |
409Exists already, or not possible in this state. |
413Too big: a request's documents (64 MB), an import (2 GB), or what a SQL query would read. |
422Invalid: the message says why (code invalid with fields: which input fields; query_timeout: past the plan's time limit; scan_refused: send scan: true). |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
503Object storage failed: retry (nothing was written, unless the code is write_unknown: then it may have been; retrying a write is safe). |
507The tenant's storage quota is full. |
curl -s https://api.skimmerdb.com/v1/sql \
-H "Authorization: Bearer $KEY" \
-d '{"sql":"SELECT u.plan, COUNT(*) AS events, SUM(e.amount) AS total FROM \"web-events\" e JOIN users u ON u.id = e.user_id GROUP BY u.plan ORDER BY total DESC"}'from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import query_sql_tenant
from skimmerdb._api.models import SqlRequest
db = SkimmerDB() # SKIMMERDB_KEY
answer = query_sql_tenant.sync(client=db.api, body=SqlRequest.from_dict({"sql":"SELECT u.plan, COUNT(*) AS events, SUM(e.amount) AS total FROM \"web-events\" e JOIN users u ON u.id = e.user_id GROUP BY u.plan ORDER BY total DESC"}))import { SkimmerDB } from "skimmerdb";
import { querySqlTenant } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await querySqlTenant({ client: db.client, body: {"sql":"SELECT u.plan, COUNT(*) AS events, SUM(e.amount) AS total FROM \"web-events\" e JOIN users u ON u.id = e.user_id GROUP BY u.plan ORDER BY total DESC"} });{
"namespace": "",
"columns": [
"plan",
"events",
"total"
],
"types": [
"text",
"int",
"float"
],
"rows": [
[
"pro",
3,
16
]
],
"chunks": 2,
"scanned": 2,
"partial": false,
"truncated": false,
"took_ms": 1.4,
"temperature": "warm",
"store_gets": 0,
"store_bytes": 0,
"cpu_ms": 0.9,
"timed_out": false
}SQL across namespaces, by URL (beta)
/v1/sql beta metered: query Beta. As POST /v1/sql. The same query as a GET, for clients that can only fetch a URL: DuckDB's read_csv / read_json over https (with a CREATE SECRET of TYPE http and BEARER_TOKEN), curl, a spreadsheet's import. The SQL goes in ?sql= (URL-encoded; DuckDB reads a * in a URL as a glob: write %2A). Reads only: SQL that writes answers 405.
Parameters
sqlstring · queryThe query, URL-encoded. |
formatstring · queryndjson or csv: every row streamed as it's made (no 10,000-row cap; Accept: application/x-ndjson or text/csv does the same). Its types come in X-Skimmerdb-Types. An error before the first row is the usual JSON error; after it, NDJSON gets a last error line and the transfer is broken off (never a short answer that looks whole). |
Answer
namespacestringThe namespace in the path ("" for /v1/sql). |
columnsstring[] |
typesstring[]int, float, text, date, time, decimal (its values as strings, exact) or null (every value NULL), one a column. |
rowsstring | number | null[][] |
chunksintegerColumn blocks in the namespaces read. |
scannedintegerColumn blocks read. |
partialbooleanReserved for response compatibility; incomplete SQL text reads fail with 503. |
truncatedbooleanMore than 10,000 rows: these are the first. |
took_msnumber |
dmlSqlWriteWhat a SQL write did (INSERT, CREATE TABLE, DELETE). |
dml.statement"insert" | "create" | "delete" |
dml.namespacestringThe namespace written. |
dml.insertedintegerDocuments written (an id that existed is replaced). |
dml.deletedinteger |
dml.versionintegerThe namespace's version with the write. |
dml.createdbooleanThe statement made the namespace. |
partialsobjectPresent when the query ran from per-segment partials (one namespace and aggregates that merge from parts, or a view): which view's partials answered it and how many segments' partials were computed for it or reused. Always exact. |
partials.viewstring | nullThe named view read (several: comma-separated), or null. |
partials.kind"named" | "auto" | "none"named: a view's kept partials; auto: an automatic view's (a query shape repeated on a big namespace); none: partials kept in memory only. |
partials.computedintegerSegments whose partials were computed for this query. |
partials.reusedintegerSegments whose partials were reused (unchanged since computed). |
partials.remoteintegerOf those computed, how many on other servers of the cluster. |
temperaturestringHow warm the namespace was: warm (open), local (opened from the server's disk) or cold (opened from object storage). |
store_getsintegerObject-storage reads this query made (0 when warm). |
store_bytesintegerBytes those reads fetched. |
cpu_msnumberCPU the query used (metered, not billed). |
timed_outbooleanThe query ran past the plan's time limit (query_seconds): the answer is partial. |
Status codes
200OK |
400Malformed: not the JSON expected. |
401No key, or an unknown or revoked one. |
402The free plan's included usage this period is used up (queries, query CPU, object-storage reads, bytes returned, writes or storage; the message says which), or its namespace count or daily namespace creations are reached (code namespace_limit): upgrade to pro. |
403The key's scope or namespaces don't allow it, or the tenant is suspended. |
404No such namespace, document, key or tenant (or one this key may not see: the same answer). |
405Not with this method: SQL that writes needs POST. |
413Too big: a request's documents (64 MB), an import (2 GB), or what a SQL query would read. |
422Invalid: the message says why (code invalid with fields: which input fields; query_timeout: past the plan's time limit; scan_refused: send scan: true). |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
503Object storage failed: retry (nothing was written, unless the code is write_unknown: then it may have been; retrying a write is safe). |
curl -s https://api.skimmerdb.com/v1/sql \
-H "Authorization: Bearer $KEY"from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import query_sql_tenant_get
db = SkimmerDB() # SKIMMERDB_KEY
answer = query_sql_tenant_get.sync(client=db.api)import { SkimmerDB } from "skimmerdb";
import { querySqlTenantGet } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await querySqlTenantGet({ client: db.client });Export a query's answer (beta)
/v1/sql/exports beta metered: query For answers too big or too slow for a request: the query runs in the background (the plan's export_seconds: 60 s free, 900 s pro) and its rows are written as CSV, NDJSON or Parquet into object storage under the tenant's own prefix, kept 24 hours, or, with destination, delivered to the tenant's own bucket (AWS S3, R2, B2, MinIO, ...) by multipart upload and not kept here (its bytes count as bytes returned). A plain scan of one namespace exports any number of rows; other shapes up to their row cap. Poll GET /v1/sql/exports/{id}; download when done. Limits: exports queued or running at once (1 free, 2 pro; 429), exports a UTC day (10 free; 402 export_limit), an export's size (1 GB free, 50 GB pro; failed past it). Metered: one query when it runs; downloads as bytes returned. A server that restarts fails its running exports (run them again).
Body application/json
sqlstringrequiredA query (as POST /v1/sql: tables are the tenant's namespaces by name). |
format"csv" | "ndjson" | "parquet"CSV (a header line, RFC 4180), NDJSON (an object a row) or Parquet (one file: row groups of up to 131,072 rows, ZSTD; every column nullable; int as INT64, float DOUBLE, text STRING, date DATE, time TIMESTAMP (microseconds, not UTC-adjusted), decimal DECIMAL(18, s)). Default "csv". |
destinationExportDestinationDeliver the file to the tenant's own bucket (AWS S3, R2, B2, MinIO, ...) by multipart upload instead of keeping it here. The keys are checked at once (a small object is written and deleted) and kept in memory only while the export runs. |
destination.pathstringrequireds3://bucket/key for the file; ending in / a name is made (export- |
destination.s3S3KeysrequiredKeys for the tenant's own bucket, on AWS S3 or an S3-compatible service. Used while the request (or export) runs, never stored. Without access_key_id and secret_access_key, requests go unsigned: a public bucket (such as AWS Open Data), for reading only. |
destination.s3.regionstringThe bucket's region (auto for Cloudflare R2). Default "us-east-1". |
destination.s3.access_key_idstring |
destination.s3.secret_access_keystring |
destination.s3.session_tokenstring |
destination.s3.endpointstringAn S3-compatible service instead of AWS: an https URL of scheme, host and optional port, no path (requests are path-style). Cloudflare R2: |
Answer
idstring |
status"queued" | "running" | "done" | "failed" | "expired" |
formatstring |
sqlstring |
rowsintegerRows written so far (all, once done). |
bytesintegerThe file's size so far (all, once done). |
errorstringfailed: why. |
created_atstring |
finished_atstring | null |
expires_atstring24 hours after it was made: the file is deleted then. |
downloadstringdone: where to download it. |
destinationstringDelivered to the tenant's bucket: the file's s3:// path (no download here). |
Status codes
202OK |
400Malformed: not the JSON expected. |
401No key, or an unknown or revoked one. |
402The free plan's included usage this period is used up (queries, query CPU, object-storage reads, bytes returned, writes or storage; the message says which), or its namespace count or daily namespace creations are reached (code namespace_limit): upgrade to pro. |
403The key's scope or namespaces don't allow it, or the tenant is suspended. |
422Invalid: the message says why (code invalid with fields: which input fields; query_timeout: past the plan's time limit; scan_refused: send scan: true). |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
503Object storage failed: retry (nothing was written, unless the code is write_unknown: then it may have been; retrying a write is safe). |
curl -s https://api.skimmerdb.com/v1/sql/exports \
-H "Authorization: Bearer $KEY" \
-d '{"sql":"SELECT id, status, priority, opened_at FROM tickets WHERE status = 'open'","format":"csv"}'from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import create_export
from skimmerdb._api.models import ExportRequest
db = SkimmerDB() # SKIMMERDB_KEY
answer = create_export.sync(client=db.api, body=ExportRequest.from_dict({"sql":"SELECT id, status, priority, opened_at FROM tickets WHERE status = 'open'","format":"csv"}))import { SkimmerDB } from "skimmerdb";
import { createExport } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await createExport({ client: db.client, body: {"sql":"SELECT id, status, priority, opened_at FROM tickets WHERE status = 'open'","format":"csv"} });{
"id": "ex_5f0c1a2b3c4d5e6f7a8b",
"status": "done",
"format": "csv",
"sql": "SELECT id, status FROM tickets",
"rows": 120000,
"bytes": 3400211,
"error": "",
"created_at": "2026-10-18T10:00:00Z",
"finished_at": "2026-10-18T10:00:04Z",
"expires_at": "2026-10-19T10:00:00Z",
"download": "/v1/sql/exports/ex_5f0c1a2b3c4d5e6f7a8b/download"
}List exports (beta)
/v1/sql/exports beta The tenant's exports not expired, newest first (the last 100). A key limited to namespaces sees only its own.
Answer
exportsExport[] |
exports[].idstring |
exports[].status"queued" | "running" | "done" | "failed" | "expired" |
exports[].formatstring |
exports[].sqlstring |
exports[].rowsintegerRows written so far (all, once done). |
exports[].bytesintegerThe file's size so far (all, once done). |
exports[].errorstringfailed: why. |
exports[].created_atstring |
exports[].finished_atstring | null |
exports[].expires_atstring24 hours after it was made: the file is deleted then. |
exports[].downloadstringdone: where to download it. |
exports[].destinationstringDelivered to the tenant's bucket: the file's s3:// path (no download here). |
Status codes
200OK |
401No key, or an unknown or revoked one. |
403The key's scope or namespaces don't allow it, or the tenant is suspended. |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
curl -s https://api.skimmerdb.com/v1/sql/exports \
-H "Authorization: Bearer $KEY"from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import list_exports
db = SkimmerDB() # SKIMMERDB_KEY
answer = list_exports.sync(client=db.api)import { SkimmerDB } from "skimmerdb";
import { listExports } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await listExports({ client: db.client });{
"exports": [
{
"id": "ex_5f0c1a2b3c4d5e6f7a8b",
"status": "done",
"format": "csv",
"sql": "SELECT id, status FROM tickets",
"rows": 120000,
"bytes": 3400211,
"error": "",
"created_at": "2026-10-18T10:00:00Z",
"finished_at": "2026-10-18T10:00:04Z",
"expires_at": "2026-10-19T10:00:00Z",
"download": "/v1/sql/exports/ex_5f0c1a2b3c4d5e6f7a8b/download"
}
]
}An export's status (beta)
/v1/sql/exports/{id} beta queued, running (rows and bytes so far), done (download), failed (error) or expired.
Parameters
idstring · pathrequired |
Answer
idstring |
status"queued" | "running" | "done" | "failed" | "expired" |
formatstring |
sqlstring |
rowsintegerRows written so far (all, once done). |
bytesintegerThe file's size so far (all, once done). |
errorstringfailed: why. |
created_atstring |
finished_atstring | null |
expires_atstring24 hours after it was made: the file is deleted then. |
downloadstringdone: where to download it. |
destinationstringDelivered to the tenant's bucket: the file's s3:// path (no download here). |
Status codes
200OK |
401No key, or an unknown or revoked one. |
404No such namespace, document, key or tenant (or one this key may not see: the same answer). |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
curl -s https://api.skimmerdb.com/v1/sql/exports/t-1 \
-H "Authorization: Bearer $KEY"from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import get_export
db = SkimmerDB() # SKIMMERDB_KEY
answer = get_export.sync("t-1", client=db.api)import { SkimmerDB } from "skimmerdb";
import { getExport } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await getExport({ client: db.client, path: { id: "t-1" } });{
"id": "ex_5f0c1a2b3c4d5e6f7a8b",
"status": "done",
"format": "csv",
"sql": "SELECT id, status FROM tickets",
"rows": 120000,
"bytes": 3400211,
"error": "",
"created_at": "2026-10-18T10:00:00Z",
"finished_at": "2026-10-18T10:00:04Z",
"expires_at": "2026-10-19T10:00:00Z",
"download": "/v1/sql/exports/ex_5f0c1a2b3c4d5e6f7a8b/download"
}Download an export (beta)
/v1/sql/exports/{id}/download beta The file, streamed (Content-Type text/csv, application/x-ndjson or application/vnd.apache.parquet; X-Skimmerdb-Size: its size). Resumable: Range: bytes=first-last (one range) answers 206 with Content-Range. Metered as bytes returned; on the free plan a download stops when they're used up (a range past them: 402).
Parameters
idstring · pathrequired |
Rangestring · headerbytes=first-last, bytes=first- or bytes=-suffix: part of the file (206). |
Status codes
200OK |
401No key, or an unknown or revoked one. |
402The free plan's included usage this period is used up (queries, query CPU, object-storage reads, bytes returned, writes or storage; the message says which), or its namespace count or daily namespace creations are reached (code namespace_limit): upgrade to pro. |
404No such namespace, document, key or tenant (or one this key may not see: the same answer). |
409Exists already, or not possible in this state. |
410It existed, but not anymore (an export past its 24 hours). |
416The Range asked for isn't in the file. |
429Over the tenant's or the key's rate, concurrency or cap, or writes arriving faster than the namespace commits them (code write_busy): retry after Retry-After seconds. |
503Object storage failed: retry (nothing was written, unless the code is write_unknown: then it may have been; retrying a write is safe). |
curl -s https://api.skimmerdb.com/v1/sql/exports/t-1/download \
-H "Authorization: Bearer $KEY"from skimmerdb import SkimmerDB
from skimmerdb._api.api.sql_beta import download_export
db = SkimmerDB() # SKIMMERDB_KEY
answer = download_export.sync("t-1", client=db.api)import { SkimmerDB } from "skimmerdb";
import { downloadExport } from "skimmerdb/api";
const db = new SkimmerDB(); // SKIMMERDB_KEY
const { data } = await downloadExport({ client: db.client, path: { id: "t-1" } });