Fixing SQL Query Syntax Errors with FortiAI
Suppose you created a SQL search but there are some errors while you Format or Run it. You can use the power of Generative AI to fix the errors. This requires that you have ChatGPT API Key configured in Admin > Settings > Analytics > ML/AI.
Once the ClickHouse Query Engine returns an error from either a Format or Run operation, the Fix Errors option will be clickable from the FortiAI (
) drop-down. When clicked, the following occurs.
- A new Ask FortiAI window opens next to Query Console. FortiAI interaction with ChatGPT will appear in this window.
- FortiSIEM will send a request to ChatGPT to fix the SQL Query error.
- ChatGPT will first respond with "I am trying to fix the Query". Then it may provide an explanation of the error and a fixed SQL Query if it is able to provide one.
- If you want to directly run the fixed query returned by ChatGPT, then go to the FortiAI (
) drop-down on the top right corner of the ChatGPT response and choose click Replace Original Query (
). The query will replace your query. Check the fix for accuracy and then click Run. - You also have the option to Copy the fixed query to Clipboard by choosing this option Copy Query to Clipboard (
). Then you can open a new tab and paste the query from your Clipboard and click Run. - The result will show in the Query Results pane below.