---
title: "Execute SQL query on workspace tables"
method: POST
path: "/workspaces/{workspace_id}/tables/query"
tags: ["tables"]
---

# Execute SQL query on workspace tables

`POST /workspaces/{workspace_id}/tables/query`

Executes a SQL query on workspace tables with optional parameterized queries. Supports SELECT, INSERT, UPDATE, DELETE operations with parameter binding for security. Supports MessagePack responses (Accept: application/msgpack) for efficient binary data transfer.

## Path parameters

- `workspace_id` string, required

## Request body

- GithubComActiveloopaiDeeplakeApiInternalTablesExecuteQueryRequest
  - `params` unknown[]
    - unknown
  - `query` string
  - `timeout_ms` integer — optional query timeout in milliseconds (max 300000)

## Response `200`

Query executed successfully

- GithubComActiveloopaiDeeplakeApiInternalTablesQueryResult
  - `columns` string[]
  - `execution_time_ms` number
  - `row_count` integer
  - `rows` array[]
    - unknown[]
      - unknown

## Other responses

- `400` — Invalid request (bad workspace ID, invalid body, empty query, or invalid query)
- `401` — Unauthorized - missing or invalid authentication
- `403` — Access denied - user does not have access to this workspace
- `500` — Internal server error - query execution failed

---

[API](https://skmtc.net/deeplake/apis/deeplake-api.md) · [All operations](https://skmtc.net/deeplake/apis/deeplake-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/deeplake/deeplake-api/revisions/e16ed11d991c/schema)
