Skip to main content

SQL Lab API

SQL Lab: saved queries + schema browse (catalogs / schemas / tables / columns).

This page lists 15 endpoints (OpenAPI tag sqllab). It is generated from openapi.json; see the REST API overview for authentication, CSRF and error conventions.

MethodPathOperation idNotes
GET/api/ws/{workspace}/sqllab/databases/{db}/catalogscatalogs
GET/api/ws/{workspace}/sqllab/databases/{db}/columnscolumns
GET/api/ws/{workspace}/sqllab/databases/{db}/schemasschemas
GET/api/ws/{workspace}/sqllab/databases/{db}/searchsearch
GET/api/ws/{workspace}/sqllab/databases/{db}/tablestables
GET/api/ws/{workspace}/sqllab/querieslist
POST/api/ws/{workspace}/sqllab/queriessave
GET/api/ws/{workspace}/sqllab/queries/{id}load
PUT/api/ws/{workspace}/sqllab/queries/{id}update
DELETE/api/ws/{workspace}/sqllab/queries/{id}remove
PATCH/api/ws/{workspace}/sqllab/queries/{id}/foldersq_set_folder
GET/api/ws/{workspace}/sqllab/snippetssnippets_list
POST/api/ws/{workspace}/sqllab/snippetssnippets_create
PUT/api/ws/{workspace}/sqllab/snippets/{id}snippets_update
DELETE/api/ws/{workspace}/sqllab/snippets/{id}snippets_remove

GET /api/ws/{workspace}/sqllab/databases/{db}/catalogs​

Operation id: catalogs. Auth: Session cookie. Forbidden (403): Missing query:run permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
dbpathstring (uuid)yesGranted database id
workspacepathstringyes

Response 200 (application/json): array of string

StatusMeaning
200Catalog names visible on the database
401Not authenticated
403Missing query:run permission
404Database not granted to this workspace
500Internal error

GET /api/ws/{workspace}/sqllab/databases/{db}/columns​

Operation id: columns. Auth: Session cookie. Forbidden (403): Missing query:run permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
dbpathstring (uuid)yesGranted database id
catalogquerystringnoCatalog to scope to
schemaquerystringnoSchema to scope to
tablequerystringnoTable to describe columns for
workspacepathstringyes

Response 200 (application/json): array of SchemaColumn

FieldTypeRequiredDescription
namestringyes
typestringyes
StatusMeaning
200Columns (name + type) of the table
401Not authenticated
403Missing query:run permission
404Database not granted to this workspace
500Internal error

GET /api/ws/{workspace}/sqllab/databases/{db}/schemas​

Operation id: schemas. Auth: Session cookie. Forbidden (403): Missing query:run permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
dbpathstring (uuid)yesGranted database id
catalogquerystringnoCatalog to list schemas in
workspacepathstringyes

Response 200 (application/json): array of string

StatusMeaning
200Schema names in the catalog
401Not authenticated
403Missing query:run permission
404Database not granted to this workspace
500Internal error

GET /api/ws/{workspace}/sqllab/databases/{db}/search​

Operation id: search. Auth: Session cookie. Forbidden (403): Missing query:run permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
dbpathstring (uuid)yesGranted database id
qquerystringnoObject-name search term
workspacepathstringyes

Response 200 (application/json): array of SearchHit

FieldTypeRequiredDescription
catalogstringyes
schemastringyes
tablestringyes
StatusMeaning
200Matching tables/views across the database
403Missing query:run permission
404Database not granted to this workspace

GET /api/ws/{workspace}/sqllab/databases/{db}/tables​

Operation id: tables. Auth: Session cookie. Forbidden (403): Missing query:run permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
dbpathstring (uuid)yesGranted database id
catalogquerystringnoCatalog to scope to
schemaquerystringnoSchema to list tables in
workspacepathstringyes

Response 200 (application/json): array of string

StatusMeaning
200Table names in the schema
401Not authenticated
403Missing query:run permission
404Database not granted to this workspace
500Internal error

GET /api/ws/{workspace}/sqllab/queries​

Operation id: list. Auth: Session cookie. Forbidden (403): Missing saved_query:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug

Response 200 (application/json): array of SavedQueryDto

FieldTypeRequiredDescription
idstringyes
database_idstring, nullableno
namestringyes
sqlstringyes
descriptionstringyes
created_bystring, nullableno
folder_idstring, nullablenoFolder this saved query lives in (None = root). Serialized as a string.
updated_atstring (date-time)yes
StatusMeaning
200Saved queries in the workspace
401Not authenticated
403Missing saved_query:read permission
500Internal error

POST /api/ws/{workspace}/sqllab/queries​

Operation id: save. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing saved_query:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug

Request body (application/json): SaveQuery

FieldTypeRequiredDescription
database_idstring (uuid), nullableno
namestringyes
sqlstringyes
descriptionstringno

Response 200 (application/json): SavedQueryDto

FieldTypeRequiredDescription
idstringyes
database_idstring, nullableno
namestringyes
sqlstringyes
descriptionstringyes
created_bystring, nullableno
folder_idstring, nullablenoFolder this saved query lives in (None = root). Serialized as a string.
updated_atstring (date-time)yes
StatusMeaning
200Saved query created
401Not authenticated
403Missing saved_query:manage permission
500Internal error

GET /api/ws/{workspace}/sqllab/queries/{id}​

Operation id: load. Auth: Session cookie. Forbidden (403): Missing saved_query:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesSaved query id
workspacepathstringyes

Response 200 (application/json): SavedQueryDto

FieldTypeRequiredDescription
idstringyes
database_idstring, nullableno
namestringyes
sqlstringyes
descriptionstringyes
created_bystring, nullableno
folder_idstring, nullablenoFolder this saved query lives in (None = root). Serialized as a string.
updated_atstring (date-time)yes
StatusMeaning
200Saved query detail
401Not authenticated
403Missing saved_query:read permission
404No such saved query
500Internal error

PUT /api/ws/{workspace}/sqllab/queries/{id}​

Operation id: update. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing saved_query:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesSaved query id
workspacepathstringyes

Request body (application/json): SaveQuery

FieldTypeRequiredDescription
database_idstring (uuid), nullableno
namestringyes
sqlstringyes
descriptionstringno

Response 200 (application/json): SavedQueryDto

FieldTypeRequiredDescription
idstringyes
database_idstring, nullableno
namestringyes
sqlstringyes
descriptionstringyes
created_bystring, nullableno
folder_idstring, nullablenoFolder this saved query lives in (None = root). Serialized as a string.
updated_atstring (date-time)yes
StatusMeaning
200Saved query updated
401Not authenticated
403Missing saved_query:manage permission
404No such saved query
500Internal error

DELETE /api/ws/{workspace}/sqllab/queries/{id}​

Operation id: remove. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing saved_query:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesSaved query id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Saved query deleted
401Not authenticated
403Missing saved_query:manage permission
404No such saved query
500Internal error

PATCH /api/ws/{workspace}/sqllab/queries/{id}/folder​

Operation id: sq_set_folder. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing saved_query:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesSaved query id
workspacepathstringyes

Request body (application/json): SetFolder

FieldTypeRequiredDescription
folder_idstring (uuid), nullableno

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Saved query moved to folder
401Not authenticated
403Missing saved_query:manage permission
404No such saved query or target folder in this workspace
500Internal error

GET /api/ws/{workspace}/sqllab/snippets​

Operation id: snippets_list. Auth: Session cookie.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug

Response 200 (application/json): array of SnippetDto

FieldTypeRequiredDescription
idstringyes
namestringyes
bodystringyes
descriptionstringyes
updated_atstring (date-time)yes
StatusMeaning
200Workspace SQL snippets

POST /api/ws/{workspace}/sqllab/snippets​

Operation id: snippets_create. Auth: Session cookie and X-Egret-CSRF header.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug

Request body (application/json): SnippetBody

FieldTypeRequiredDescription
namestringyes
bodystringyes
descriptionstringno

Response 200 (application/json): SnippetDto

FieldTypeRequiredDescription
idstringyes
namestringyes
bodystringyes
descriptionstringyes
updated_atstring (date-time)yes
StatusMeaning
200Created snippet

PUT /api/ws/{workspace}/sqllab/snippets/{id}​

Operation id: snippets_update. Auth: Session cookie and X-Egret-CSRF header.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesSnippet id
workspacepathstringyes

Request body (application/json): SnippetBody

FieldTypeRequiredDescription
namestringyes
bodystringyes
descriptionstringno

Response 200 (application/json): SnippetDto

FieldTypeRequiredDescription
idstringyes
namestringyes
bodystringyes
descriptionstringyes
updated_atstring (date-time)yes
StatusMeaning
200Updated snippet
404Snippet not found in this workspace

DELETE /api/ws/{workspace}/sqllab/snippets/{id}​

Operation id: snippets_remove. Auth: Session cookie and X-Egret-CSRF header.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesSnippet id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Deleted