For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
LoginBook a Demo
  • Getting Started
    • Athena SDK Quickstart
  • Database API
    • Database Filters & CRUD
  • Python Guides
    • Build with Agents
    • Use Models Directly
    • Load Data Frames
    • Upload Files
    • Create Assets
    • Structured Output
    • Long-Running AOP Execution
  • TypeScript Guides
    • Build with Agents
    • Working with Assets
    • Use Models Directly
    • Execute AOPs
    • Sheets API
    • Browser JavaScript (ESM)
    • UI Registry (Assistant.js)
    • Upload Files
    • Create Assets
    • Structured Output
  • API Reference
      • GETCheck database status
      • GETList tables in database
      • GETRead rows from database table
      • POSTInsert rows into database table
      • DELDelete rows from database table
      • PATCHUpdate rows in database table
      • GETGet table schema (columns and types)
      • POSTExecute SQL against database
Logo
LoginBook a Demo
API ReferenceDatabases

Execute SQL against database

Beta
POST
https://api.athenaintel.com/api/v0/databases/:asset_id/sql
POST
/api/v0/databases/:asset_id/sql
$curl -X POST https://api.athenaintel.com/api/v0/databases/asset_id/sql \
> -H "X-API-KEY: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "sql": "SELECT id, name FROM users WHERE active = true LIMIT 10"
>}'
1{
2 "columns": [
3 "id",
4 "name"
5 ],
6 "rows": [
7 {
8 "id": 1,
9 "name": "Alice"
10 },
11 {
12 "id": 2,
13 "name": "Bob"
14 }
15 ]
16}

Execute a SQL statement against the database. SELECT queries return columns and rows. Non-SELECT statements (CREATE, INSERT, UPDATE, DELETE, ALTER, DROP, etc.) return execution statuses.

Was this page helpful?
Previous

Get Tabular Data from SQL snippet

Next
Built with

Authentication

X-API-KEYstring
API Key authentication via header
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

asset_idstringRequired

Request

This endpoint expects an object.
sqlstringRequired
SQL statement to execute

Response

Successful Response
columnslist of strings or null

Column names (populated for SELECT queries)

rowslist of maps from strings to any or null

Row data as objects (populated for SELECT queries)

statuseslist of strings or null

Execution statuses (populated for non-SELECT statements)

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
500
Internal Server Error
501
Not Implemented Error
503
Service Unavailable Error