Skip to content
You're viewing documentation for v2026.11.7-beta. It may be out of date.Go to latest
TimescaleDB Enterprise
Esc
↑↓navigate↵open⌘Jpreview

Fetch the database schema

Fetch a database service’s schema (tables, views, functions, hypertables, …).

GET/api/v1/database-services/{id}/sql/api/schema
Authorization
tse_sessionAPI key · cookierequired
Path parameters
idstringrequired
Query parameters
databasestring
schemastring
internalboolean
definitionsboolean
commentsboolean
Responses
200

OK

idstringrequired
namestringrequired
schemasNamespacedSchema[]required
Show properties
Array of NamespacedSchema
commentstring
enumsEnumSchema[]
Show properties
Array of EnumSchema
commentstring
namestringrequired
valuesstring[]
functionsRoutine[]
Show properties
Array of Routine
argumentsstring
commentstring
definitionstring
namestringrequired
typestringrequired
materialized_viewsViewSchema[]
Show properties
Array of ViewSchema
columnsViewColumnSchema[]
Show properties
Array of ViewColumnSchema
commentstring
namestringrequired
typestringrequired
commentstring
continuous_aggregateContinuousAggregateInfo
Show properties
compression_enabledbooleanrequired
materialized_onlybooleanrequired
definitionstring
indexesIndexSchema[]
Show properties
Array of IndexSchema
columnsstringrequired
definitionstring
is_uniqueboolean
namestringrequired
where_clausestring
namestringrequired
triggersTriggerSchema[]
Show properties
Array of TriggerSchema
manipulationstringrequired
namestringrequired
statementstringrequired
timingstringrequired
namestringrequired
proceduresRoutine[]
Show properties
Array of Routine
argumentsstring
commentstring
definitionstring
namestringrequired
typestringrequired
tablesTableSchema[]
Show properties
Array of TableSchema
checksCheckConstraint[]
Show properties
Array of CheckConstraint
columnsstring[]
expressionstringrequired
namestringrequired
columnsTableColumnSchema[]
Show properties
Array of TableColumnSchema
commentstring
defaultstring
identity_typestring
is_serialboolean
namestringrequired
not_nullboolean
typestringrequired
commentstring
constraintsTableConstraint[]
Show properties
Array of TableConstraint
columnsstring[]
namestringrequired
ref_columnsstring[]
ref_tablestring
typestringrequired
exclusionsExclusionConstraint[]
Show properties
Array of ExclusionConstraint
definitionstringrequired
namestringrequired
foreignForeignTableInfo
Show properties
optionsstring[]
serverstringrequired
wrapperstringrequired
hypertableHypertableInfo
Show properties
compression_enabledbooleanrequired
num_chunksinteger<int64>required
indexesIndexSchema[]
namestringrequired
partitionsPartitionInfo[]
Show properties
Array of PartitionInfo
boundstring
namestringrequired
schemastring
triggersTriggerSchema[]
viewsViewSchema[]
Show properties
Array of ViewSchema
columnsViewColumnSchema[]
commentstring
continuous_aggregateContinuousAggregateInfo
definitionstring
indexesIndexSchema[]
namestringrequired
triggersTriggerSchema[]
default

Error

codestring

Stable code of the refusal, when the route has codes

detailsstring[]

Additional detail, e.g. per-field validation failures

errorstringrequired

Human-readable error message

Request
curl -X GET 'https://console.example.com/api/v1/database-services/string/sql/api/schema' \
  -H 'Cookie: tse_session=YOUR_API_KEY' \
  -H 'Accept: application/json'
Response
{
  "id": "string",
  "name": "string",
  "schemas": [
    {
      "comment": "string",
      "enums": [
        {
          "comment": "string",
          "name": "string",
          "values": [
            "string"
          ]
        }
      ],
      "functions": [
        {
          "arguments": "string",
          "comment": "string",
          "definition": "string",
          "name": "string",
          "type": "string"
        }
      ],
      "materialized_views": [
        {
          "columns": [
            {
              "comment": "string",
              "name": "string",
              "type": "string"
            }
          ],
          "comment": "string",
          "continuous_aggregate": {
            "compression_enabled": true,
            "materialized_only": true
          },
          "definition": "string",
          "indexes": [
            {
              "columns": "string",
              "definition": "string",
              "is_unique": true,
              "name": "string",
              "where_clause": "string"
            }
          ],
          "name": "string",
          "triggers": [
            {
              "manipulation": "string",
              "name": "string",
              "statement": "string",
              "timing": "string"
            }
          ]
        }
      ],
      "name": "string",
      "procedures": [
        {
          "arguments": "string",
          "comment": "string",
          "definition": "string",
          "name": "string",
          "type": "string"
        }
      ],
      "tables": [
        {
          "checks": [
            {
              "columns": [
                "string"
              ],
              "expression": "string",
              "name": "string"
            }
          ],
          "columns": [
            {
              "comment": "string",
              "default": "string",
              "identity_type": "string",
              "is_serial": true,
              "name": "string",
              "not_null": true,
              "type": "string"
            }
          ],
          "comment": "string",
          "constraints": [
            {
              "columns": [
                "string"
              ],
              "name": "string",
              "ref_columns": [
                "string"
              ],
              "ref_table": "string",
              "type": "string"
            }
          ],
          "exclusions": [
            {
              "definition": "string",
              "name": "string"
            }
          ],
          "foreign": {
            "options": [
              "string"
            ],
            "server": "string",
            "wrapper": "string"
          },
          "hypertable": {
            "compression_enabled": true,
            "num_chunks": 0
          },
          "indexes": [
            {
              "columns": "string",
              "definition": "string",
              "is_unique": true,
              "name": "string",
              "where_clause": "string"
            }
          ],
          "name": "string",
          "partitions": [
            {
              "bound": "string",
              "name": "string",
              "schema": "string"
            }
          ],
          "triggers": [
            {
              "manipulation": "string",
              "name": "string",
              "statement": "string",
              "timing": "string"
            }
          ]
        }
      ],
      "views": [
        {
          "columns": [
            {
              "comment": "string",
              "name": "string",
              "type": "string"
            }
          ],
          "comment": "string",
          "continuous_aggregate": {
            "compression_enabled": true,
            "materialized_only": true
          },
          "definition": "string",
          "indexes": [
            {
              "columns": "string",
              "definition": "string",
              "is_unique": true,
              "name": "string",
              "where_clause": "string"
            }
          ],
          "name": "string",
          "triggers": [
            {
              "manipulation": "string",
              "name": "string",
              "statement": "string",
              "timing": "string"
            }
          ]
        }
      ]
    }
  ]
}