Generate SQL Code with AI

Use the Generate SQL command and prompt SAP Datasphere to generate code for your SQL views. You can create a view from scratch or modify existing SQL code.

Prerequisites

For information about privileges and other prerequisites needed to use this feature, see the prerequisites listed in Creating an SQL View.

Generate SQL Code

  1. Click (Generate) Start of the navigation path Next navigation step Generate SQLEnd of the navigation path (or press CTRL + G / CMD + G ) to open the prompt panel.

  2. Drag the sources that you want SAP Datasphere to use from the Source Browser, and drop them in the prompt panel.

  3. [optional] Select SQL code for the AI to focus on.

  4. Enter your prompt describing the output that you want from your SQL view and then click Send Prompt (or press Enter).

    SAP Datasphere will generate SQL code in response to your prompt.

  5. Review the generated code. You can:

    • Enter a new prompt to make further modifications.

    • Manually modify the code.

    • Click (Preview Data) to preview the data output.

    • Click Reject to reject and roll back the proposed changes.

    You can work iteratively with prompts and manual editing as necessary until you are satisfied with the code.

  6. Click (Save)Start of the navigation path Next navigation step SaveEnd of the navigation path to save your entity or click (Deploy) to save and deploy it immediately.

    For more information, see Saving and Deploying Objects.