Skip to main content
POST
/
v0
/
sql
Execute a read-only SQL query against ClickHouse
import requests

url = "https://api.pmxt.dev/v0/sql"

payload = { "query": "SELECT * FROM markets LIMIT 10" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "data": [
    {
      "column1": "value1"
    }
  ],
  "meta": {
    "columns": [
      {
        "name": "column1",
        "type": "String"
      }
    ],
    "rows": 1,
    "statistics": {
      "elapsed": 0.005,
      "rows_read": 100,
      "bytes_read": 5000
    }
  }
}

Authorizations

Authorization
string
header
required

Required when calling the hosted API directly (curl, requests, fetch). SDK users pass credentials via constructor params instead.

Body

application/json
query
string
required
Example:

"SELECT * FROM markets LIMIT 10"

Response

Query executed successfully

data
object[]
Example:
[{ "column1": "value1" }]
meta
object