Skip to content

feat(rest): add SQL endpoint#105

Draft
cpsievert wants to merge 1 commit intoposit-dev:mainfrom
cpsievert:feature/sql-endpoint
Draft

feat(rest): add SQL endpoint#105
cpsievert wants to merge 1 commit intoposit-dev:mainfrom
cpsievert:feature/sql-endpoint

Conversation

@cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Feb 5, 2026

  • Add /api/v1/sql endpoint for executing plain SQL queries (no VISUALISE clause)
  • Returns JSON with rows, columns, row count, and truncation status
  • Configurable row limit via --sql-max-rows CLI flag (default: 10,000)
  • Results are truncated (not errored) when limit is exceeded

API

Request:

{"query": "SELECT * FROM my_table WHERE x > 10"}

Response:

{
  "status": "success",
  "data": {
    "rows": [{"id": 1, "name": "Alice"}, ...],
    "columns": ["id", "name"],
    "rowCount": 150,
    "truncated": false
  }
}

🤖 Generated with Claude Code

Add /api/v1/sql endpoint for executing plain SQL queries (no VISUALISE
clause). Returns rows and columns as JSON, enabling direct database
access for data exploration.

Features:
- Execute arbitrary SQL queries against the database
- Returns JSON with rows, columns, rowCount, and truncated flag
- Configurable row limit via --sql-max-rows (default: 10000)
- Results truncated (not errored) when limit exceeded
- Proper date/datetime serialization matching VegaLite writer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cpsievert cpsievert marked this pull request as draft February 5, 2026 22:04
@cpsievert
Copy link
Collaborator Author

@georgestagg I haven't done a super detailed review of these changes, but offering them to see if they feel right at first glance. If it feels right, I'll look in greater detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant