surfaceq & asql_expression
Q & Ascalar · returns varchar

SQL_EXPRESSION

Generate a DuckDB SQL expression string from a plain-English description

Per-row — runs once for each row.

qallmtext

Arguments

nametypedescription
descriptionVARCHARNatural language description of the SQL expression to generate
column_context(optional)VARCHAROptional column names available for reference

About

Turn a plain-English description into a DuckDB SQL expression, returned as a string. The operator writes the expression but does not execute it — useful when you want to compose dynamic expressions from user input (report builders, no-code dashboards, notebook helpers) and review or further transform the generated SQL before running it. Pass an optional list of column names to steer the output toward your actual schema; without that context the generator assumes standard naming conventions. If you want the expression to actually run against your data and return rows, use ASK_DATA instead — it generates, runs, and returns results.

Examples

Natural language to SQL

SELECT
  sql_expression ('count of users')

Nearby rabbit holes

same domain
Climb back to The Looking Glass