Imagine having a helper that turns any of your data search tasks in CloudBeaver into a working SQL query. If you’ve dreamed of such a thing, we’ve just built in an AI Assistant into our tool’s SQL Editor. Today you’ll learn how to interact with it for maximum advantage.
We’re back with experienced data analyst Louis and his fellow marketers. The boss gave the specialists a task of preparing a report on stores in Central America in 2022 to present it at an upcoming meeting with potential partners from this part of the world. Since our heroes use CloudBeaver to solve such assignments, this time they had no doubts about what to do. Louis told them he is already very familiar with AI features in DBeaver. He is sure that AI Assistant will save a lot of time when creating a composite query in CloudBeaver.
In fact, setting up artificial intelligence in CloudBeaver is not just one button in SQL Editor but a complete process. Louis will prepare the first part of it for his colleagues in the Administrator panel since he has been given admin rights. Marketers will only have to enter the correct prompts for the model in the context window.
How to configure AI in CloudBeaver
First, Louis needs to go to the Server Configuration tab in the Administration panel to ensure the AI Services option is enabled in the company’s corporate account.
Next, Louis goes to AI Settings and chooses an engine. Out of three options in the form of Google Gemini, Azure OpenAI, and OpenAI, he kept the last one.
Then he pastes the API token into the field, selects ‘gpt-3.5-turbo-16k’ as the most advanced, sets the temperature low for greater precision, and clicks Save in the top left corner of the tab.
If you have API access to use GPT-4, you can select that model from the list.
Specialist preparations to work with AI are complete, so now Louis’ colleagues can start operating directly with AI.
How to use AI Assistant in CloudBeaver
Marketers will need to get data about client contacts, partners, and sales volume to complete the task. They will first test the capabilities of neural networks with simple prompts and then add conditions for a particular region.
In the main CloudBeaver window, they open SQL Editor. They want relatively recent data and list everything needed for 2022 in a request to the AI. To do this, marketers click on the AI Prompt icon in the side toolbar and enter a natural language prompt for the model with the sentence “Need customer names, last names, email addresses, and total in a customer table for the year 2022”.
As heroes saw after executing the query with the SELECT statement, the AI did precisely what they asked for in the prompt, translating everything into SQL.
It’s time to get specific about the requests. Since potential partners work in the Central American market, they need data on customers from this region. To narrow the result set, the heroes click the AI Prompt button again and add the countries they need to the query.
When they click Translate, the required query appears in the SQL Editor. All heroes have to do is to execute it and get the Central American customer data.
The data for the advertising report was received, but it seems they need to make it even more comprehensive. They want to add columns from the table with partner stores in the same database to emphasize the channels through which people buy products.
How to get data from multiple tables at once
As heroes saw after executing the query with the SELECT statement, the AI did precisely what they asked for in the prompt, translating everything into SQL.
If not closing the SQL Editor tab, CloudBeaver saves the old prompt to which new details can be added. Previous AI queries can also be found by clicking on the corresponding popup list.
As they see, in the generated query, the AI has added a Join that combines columns from two different tables at once in the same result set. Apparently, the data is ready to be exported and sent to the boss.
However, marketers want to engage with AI a little more. They add a suggestion to the prompt to sort the data by order volume to make the final report more structured.
They get the results sorted by the total column after the model turns the sentence “Sort all the data by total from larger to smaller” into a query string with an ORDER BY keyword.
They only have to export the result set in Excel spreadsheet format.
In order to illustrate successful partners’ cases, they show the best sellers in a pie chart. To do this, they select the Charts tab in the toolbar, and in the settings choose Pie and the partner_name column on the X axis.
Learn more about how to export data from CloudBeaver in our blog post
Now it’s really done. Today, marketers have discovered that with AI in SQL Editor, they can produce a report of any complexity, as the model has the ability to translate natural language requests into queries.
The fact that the new feature can quickly get the data you need without understanding the nuances of writing code may be especially relevant for business professionals. Please share this article with those for whom it is valid, and follow the blog where we regularly publish content about CloudBeaver.