Translate natural language to SQL
POST /queries/translate
Convert a natural language query to DataFusion SQL.
Features:
- Understands table schemas and column types
- Supports semantic/vector search via knn_* functions and text_to_embedding
- Validates generated SQL syntax (optional)
- Returns confidence level and explanations
Request Body:
tables: Map of table aliases (as used in SQL) to table IDsquery: Natural language query to translateincludeExplanation: Include explanation of generated SQL (default: false)validateSyntax: Validate SQL syntax before returning (default: true)
Example Request:
{
"tables": {
"orders": "tbl_abc123",
"customers": "tbl_def456"
},
"query": "Find customers who placed orders over $1000 last month",
"includeExplanation": true
}
Phase 1 Constraint: All tables must belong to the same team.
Authorizations
Section titled “Authorizations ”Request Body
Section titled “Request Body ”object
Map of table aliases (as used in SQL) to table IDs
object
Natural language query to translate
Include explanation of the generated SQL
Validate SQL syntax via EXPLAIN before returning
Responses
Section titled “ Responses ”Translation successful
object
Generated DataFusion SQL query
Explanation of the generated SQL (if requested)
Warnings or assumptions made during translation
Table aliases referenced in the SQL
Columns referenced in the SQL (format: table.column)
Whether the query uses vector search functions
Confidence level of the translation
Bad request - invalid input or translation failed
object
Error message
Error code
Unauthorized - Authentication required or invalid token
object
Payment required - insufficient credits
Forbidden - Insufficient permissions
object
One or more dataset tables not found
object
Error message
Error code