Database endpoints
Query in a transaction
Runs a read-only query plan inside the transaction at its snapshot, including the transaction's own buffered writes.
POST /v1/tenants/{tenant}/tx/{tx_id}/query
- Choose the transaction IDUse the transaction's existing read snapshot.
- Supply a read-only planQuery stored data plus this transaction's buffered changes.
- Read the returned rowsFinish the transaction separately with commit or rollback.
Before you start
Use your database bearer token.
Begin a transaction and replace TX_ID with its returned tx_id. Finish the transaction with commit or rollback.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
tx_id | string | Required |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Request body
application/json
Limits and accepted values
- A query plan tree tagged by op, e.g. {"op":"scan","schema":"ns.table"}, optionally wrapped in filter, project, sort, limit, distinct, aggregate, window, join, set-operation or CTE nodes.
- Plans that read outside a full-table scan (index scans, count fast paths, graph traversals) and write plans are refused with 400.
| Field | Type | Required |
|---|---|---|
op | string | Required |
Read the result
rows includes data visible at the transaction's snapshot plus its own buffered writes. This does not mean those writes are committed or visible to another transaction.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 404 | Check the resource ID and API route. |
| 409 | Resolve the conflict before retrying. |
| 413 | Split or reduce the request body. |
| 415 | Send the required Content-Type. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 499 | The client cancelled the request. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 503 | Honor Retry-After when present; check write outcomes. |