Generate SQL from text #
The query editor allows you to generate SQL statements using natural language.
This feature uses OpenAI’s GPT-4 technology. To use this technology, your
current
role
must have the Generative AI features account-level
privilege.
These features are not employed by default.
For more information, see the OpenAI
documentation.
To create a SQL statement from text, go to the query editor by clicking
Query > Query editor in the navigation menu, and complete these steps:
- In the cluster explorer
pane of the query
editor, select Generate SQL for this data from themore_vertoptions menu next to the
name of a schema or view.
- In the Generate SQL from text panel, your schema or table selection
appears in the Scope field. Expand the field to select a different
catalog, schema, or table.
- In the empty field, enter a question or request that pertains to the schema
or table, then click Generate SQL.
- Click Insert into editor to paste the generated SQL statement into the
query editor.
- Click the ▶ Run button to run the SQL statement.

Caution:
Generating SQL is a technology in its infancy.
It is possible to get plausible but incorrect results that may need editing. We
urge you to verify all output.
Learn more #
Is the information on this page helpful?