Chelabase
ManagementTables

One table's or other relation's structure

GET
/v1/databases/{id}/branches/{branch_id}/tables/{schema}/{table}

Any relation the object list shows, with its kind. An ordinary table (kind: table) carries its columns, constraints, indexes, policies, privileges, options and comment, as the schema merge reads them; a table that inherits from another is read the same way. A view, materialized view, foreign table or partitioned table is read-only: its columns (in attnum order, with format_type's text and not_null) and comment, every other list empty; a view's definition and a foreign table's options are never returned. A partition, an index, a sequence, a composite type, a relation in a schema the object list leaves out, or a missing one is 404.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid
schema*string

Schema name

table*string

Table name

Query Parameters

database?string

The Postgres database; the branch's main database when absent.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches/497f6eca-6276-4993-bfeb-53cbbbba6f08/tables/string/string"
{  "columns": [    {      "attnum": 0,      "collation": "string",      "comment": "string",      "data_type": "string",      "default": "string",      "generated": "string",      "grants": [        {          "grantable": true,          "grantee": "public",          "grantor": {            "name": "string",            "oid": 0          },          "privilege": "string"        }      ],      "identity": {        "generation": "always",        "grants": [          {            "grantable": true,            "grantee": "public",            "grantor": {              "name": "string",              "oid": 0            },            "privilege": "string"          }        ],        "params": {          "cache": 0,          "cycle": true,          "data_type": "string",          "increment": 0,          "max": 0,          "min": 0,          "start": 0        },        "sequence_name": "string",        "sequence_oid": 0      },      "name": "string",      "not_null": true,      "type_oid": 0    }  ],  "comment": "string",  "constraints": [    {      "columns": [        0      ],      "deferrable": true,      "definition": "string",      "initially_deferred": true,      "kind": "primary_key",      "name": "string",      "oid": 0,      "references": {        "columns": [          0        ],        "schema": "string",        "table": "string",        "table_oid": 0      },      "validated": true    }  ],  "grants": [    {      "grantable": true,      "grantee": "public",      "grantor": {        "name": "string",        "oid": 0      },      "privilege": "string"    }  ],  "indexes": [    {      "comment": "string",      "include": [        "string"      ],      "keys": [        "string"      ],      "method": "string",      "name": "string",      "nulls_not_distinct": true,      "oid": 0,      "options": [        "string"      ],      "predicate": "string",      "unique": true,      "valid": true    }  ],  "name": "string",  "oid": 0,  "options": [    "string"  ],  "owner": {    "name": "string",    "oid": 0  },  "policies": [    {      "command": "all",      "comment": "string",      "name": "string",      "oid": 0,      "permissive": true,      "roles": [        "public"      ],      "using": "string",      "with_check": "string"    }  ],  "rls_enabled": true,  "rls_forced": true,  "schema": "string",  "unlogged": true,  "kind": "table"}

Change tables, columns, constraints, indexes, policies, grants and enums POST

Renders the operations to SQL (names quoted, expressions as given, each exactly one SQL expression) and runs them on one of the branch's Postgres databases as the owner (Admin only) or, with `role`, as that role (the SQL editor's session: your member role, then `SET ROLE`), in one transaction with `lock_timeout` (`lock_timeout_ms`, default 5000) and `statement_timeout` (60 s; 15 s for a dry run). A dry run runs the same statements and always rolls back; it evaluates your expressions (defaults, checks, `USING`), so their non-transactional side effects (e.g. `nextval`) remain. A statement that may rewrite a table over `CHELABASE_TABLE_API_DRY_RUN_MAX_BYTES` (default 256 MiB), and every one after it, is only rendered in a dry run (`skipped`), and then `would_succeed` is null. A table the request names that doesn't exist (and no earlier operation creates) is 404 with its `op_index`. Drops end `RESTRICT` and a request with drops returns `dependents`: what `CASCADE` would also remove beyond the request's own drop targets and their parts, and their `hash`. When something depends on a drop and the request confirms no cascade, the dry run and the real run alike answer 409 `has_dependents` with `dependents`, and change nothing. To cascade, send that hash as `cascade.dependents_hash`: the run (dry or real) locks the drop targets' tables, reads the dependents again, and refuses with 409 `dependents_changed` when they differ or when Postgres reports dropping anything but them and the parts of the request's other drop targets (drops that reach each other, e.g. a parent table and its child, need the hash of no dependents); a drop whose target an earlier drop of the request already removed is `skipped` (`already_dropped`). A `CONCURRENTLY` index operation must be the request's only operation: it runs outside a transaction (`statement_timeout` 900 s; a dry run only checks it), can't cascade, and when its build fails after creating its index, that INVALID index is dropped (another index of the same name never is). Postgres errors keep their fields (`op_index`, `sqlstate`, `message`, `detail`, `hint`, `position`; `dry_run: true` on a dry run). Each request is logged with its operation count, never its SQL.

One cell's full value POST

The whole value of one column of the row with the given primary key, as text (a grid's preview cuts long values). `key` names exactly the primary key's columns; strings bind as given, numbers and booleans as their JSON text, compared at the column's type without its length or precision (never cut or rounded to fit). A value over 64 MiB is 413. Read as a role the caller holds below Developer, the read runs as the role through the data API's connection (rest), so the Postgres database must have the data API on (409 `data_api_disabled`) and the worker's role check applies (403 `role_refused`); the answers are the same.