Deterministic NL-to-SQL Synthesizer & Dialect Query Generator
synthesize_sql_queryTranslates natural language questions into dialect-accurate, optimized SQL SELECT queries using schema awareness and safety checks for reporting and automated data analytics pipelines.
Instructions
Translates natural language questions into dialect-accurate, optimized SQL SELECT queries with schema awareness and safety checks. Use when generating reporting queries or automated data analytics pipelines; for analyzing SQL execution performance and EXPLAIN plans, use analyze_query_plan instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'natural_language_request' and 'schema_ddl' ('sql_dialect' defaults to 'postgresql_dialect'), supports '?demo=true' or L402 (15 sats), and returns HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema_ddl | Yes | Database schema DDL statements defining available tables, columns, and relations. | |
| sql_dialect | No | Target SQL dialect specification: PostgreSQL dialect, MySQL dialect, or SQLite dialect. | |
| read_only_mode | No | Whether to enforce strict read-only SELECT query constraints. | |
| natural_language_request | Yes | Natural language question or reporting requirement to transform into SQL. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dialect | Yes | Database engine dialect target the query was generated for. | |
| sql_query | Yes | Synthesized, formatted SQL query tailored to the provided schema and dialect. | |
| query_type | Yes | Operation classification (e.g., SELECT_AGGREGATE, SELECT_JOIN, FILTERED_SCAN). | |
| explanation | Yes | Step-by-step rationale explaining table joins, filtering predicates, and grouping logic. | |
| safety_checked | Yes | True if AST static analysis verified the query has zero mutation side-effects. |