SQL

Text to SQL

Generate and optionally execute an NSQL query.

This endpoint generates a SQL query using a natural language query (NSQL) and optionally executes it. The SQL query is generated by the specified model and executed if the Accept header is not set to application/sql.

post/v1/nsql

Headers

Acceptstring required

The format of the response, one of 'application/json' (default), 'application/sql', 'text/csv' or 'text/plain'. 'application/sql' will only return the SQL query generated by the model.

Request body

datasetsstring[] nullable

Names of datasets to sample from. If omitted, all datasets are used.

modelstring

The name of the model to use for SQL generation. Default: "nql"

querystring required

The natural language query to be converted into SQL

sample_data_enabledboolean

Whether sample data is included in the context for SQL generation. Default: true

Response

SQL query executed successfully

{"stackTrail":"paths:/v1/nsql:post:responses:200:content:application/json:schema:items","oasType":"schema","type":"unknown"}

Changes