Using generative SQL - Amazon Redshift

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
  1. In the Editor tab of the query editor v2, open a notebook.

  2. Choose the Generative SQL panel 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.

  3. Choose Add to notebook to add a Markdown cell with your prompt and a SQL cell with the suggested SQL to your notebook.

  4. (Optional) Provide feedback regarding the SQL generated by choosing the Helpful feedback helpful feedback icon or the Not helpful feedback not helpful feedback icon. You can categorize not helpful feedback as Incorrect tables/columns, Incorrect predicates/literals/group bys, Incorrect SQL structure, or Other. In addition, you can provide some free-form text with your feedback about the accuracy of the SQL.

  5. (Optional) Choose Regenerate SQL to generate another response for the same prompt. You can choose to Regenerate SQL one time for the current prompt.

  6. (Optional) In the generative SQL chat panel, choose the More 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.