Using generative SQL
After the correct permissions are configured, when working with a notebook in query editor v2, you can choose an icon to start a conversation.
To interact with the Amazon Q generative SQL chat to generate SQL
In the Editor tab of the query editor v2, open a notebook.
Choose the Generative SQL icon, then follow the directions to ask your questions of the Amazon Redshift query editor v2 generative SQL in the chat panel.
You provide questions in a prompt field and Amazon Q generative SQL responds with suggested SQL. Any errors encountered are returned to you in the chat panel.
Choose Add to notebook to add a Markdown cell with your prompt and a SQL cell with the suggested SQL to your notebook.
(Optional) Provide feedback regarding the SQL generated by choosing the helpful feedback icon or the not helpful feedback icon. You can categorize not helpful feedback as
Incorrect tables/columns
,Incorrect predicates/literals/group bys
,Incorrect SQL structure
, orOther
. In addition, you can provide some free-form text with your feedback about the accuracy of the SQL.(Optional) Choose Regenerate SQL to generate another response for the same prompt. You can choose to Regenerate SQL one time for the current prompt.
(Optional) In the generative SQL chat panel, choose the More icon, then choose Refresh database to refresh the metadata describing your connected database. This metadata includes the definitions of schemas, tables, and columns in your database.