Execute SQL
Executes raw SQL against the Athena client selected by `X-Athena-Client`. PostgreSQL clients may also be targeted with a direct PostgreSQL URI header (`x-pg-uri` preferred). This route is intended for advanced workflows where structured gateway payloads are insufficient. Use carefully with parameterized SQL on the caller side when constructing dynamic queries. Direct URI requests execute inline (deferred queue bypassed). Optional `schema_name` sets a schema-local search_path (`schema_name, public`) for PostgreSQL execution only.
Header Parameters
Registered logical Athena client name. Optional when direct PostgreSQL URI headers are provided.
Preferred direct PostgreSQL URI (postgres://... or jdbc:postgresql://...).
Compatibility direct PostgreSQL URI header.
Compatibility direct PostgreSQL URI header.
Optional API key header; not required for credentialed direct PostgreSQL URI requests.
Request Body
application/json
raw SQL to execute
Optional schema override for PostgreSQL query execution.
Response Body
application/json
curl -X POST "https://athena-cluster.com/gateway/query" \ -H "Content-Type: application/json" \ -d '{ "query": "SELECT id, path, status_code FROM http_request_log ORDER BY created_at DESC LIMIT 10;" }'{
"status": "success",
"message": "Query executed",
"data": {
"rows": [
{
"id": "5d845b27-8d06-40a0-9e76-08de9d9f3c1f",
"path": "/gateway/fetch",
"status_code": 200
}
]
}
}Insert data PUT
Inserts one row (or server-normalized payload) into the target table selected by `X-Athena-Client` or a direct PostgreSQL URI header (`x-pg-uri` preferred). The optional `X-Athena-Insert-Window` header can enable request-scoped batching for Postgres-backed inserts. Conflict responses (409) are typically raised for unique/constraint violations. Direct URI requests are executed inline (gateway deferred queue bypassed).
Execute a Postgres function as an RPC call POST
Invokes `schema.function(arg => ...)` on the pool selected by `X-Athena-Client`. Requires API key with right `gateway.rpc.execute`. Success responses return **`{"data": [...], "count": ...}`** (not the usual `status`/`message` envelope). Rows are JSON objects keyed by selected columns.