Skip to content

AI chat

Note

This feature is available in Lite, Enterprise, Ultimate and Team editions only.

DBeaver provides AI Chat for working with databases in natural language. You can enter requests in plain text to generate SQL queries, get explanations, or ask questions about your databases.

Using AI Chat

To use the AI Chat:

  1. Activate the AI assistant.
  2. Click on the AI Chat icon located in the DBeaver toolbar.

    • Alternatively, click on the AI assistant icon located in the left toolbar of the SQL Editor.

    Note

    The toolbar is customizable. For further information, refer to Toolbar Customization article.

  3. In the chat window that opens, select a connection and, optionally, a scope.

  4. Enter your request in natural language.
  5. Press the Send button to get the SQL translation. You can then choose from the following options:

    • Execute to run the generated SQL query
    • Editor to open the query in the SQL Editor and continue working with it directly
    • Copy to copy the query to your clipboard

AI Chat configuration

Connection field

To use a specific connection in AI Chat, select the connection from the toolbar at the top of the chat panel. The selected connection defines which database the AI will use when generating SQL queries.

Multiple conversations

You can create multiple chats for different connections.

The first chat is created automatically when you open AI Chat. Each chat is named based on your first prompt. Messages related to the same query or object in the same connection are kept together in one conversation.

Action Button/icon How to do it
Add a new chat Click the button to start a new conversation
Switch chats (Dropdown menu) Use the dropdown menu to switch between existing chats
Delete a chat Select the chat from the dropdown, then click the delete button

Important

Deleted conversations can’t be restored.

Resetting query context

The AI Chat logs your query history, enabling you to reference and expand on prior inputs. Each new or edited entry prompts the AI to generate a revised SQL query. To change the query context in AI Chat or clear history up to a specific message, click the reset button () next to the desired message.

Defining the scope

To improve accuracy, especially in databases with large schemas, you can use the Scope field to limit the context to specific database objects.

  1. In the AI Chat toolbar, click the Change scope button to open the context menu.
  2. Choose the desired context level:

    Scope option Description
    Current schema AI focuses only on the schema you’re currently using
    Current database AI is limited to the currently selected database
    This connection AI considers all schemas within the current database connection
    This conversation AI uses only the context and metadata gathered in the current chat
    All objects AI can access metadata for all available connections, databases, and schemas
    Custom Lets you define a more specific scope, such as a particular table or set of objects

AI Chat settings

You can adjust a few key options to make AI Chat work the way you prefer. Go to Window -> Preferences -> General -> AI -> AI Chat.

Setting Description
Send previous answers Passes earlier replies back to the AI to improve context, but uses more tokens
Days to keep chats Sets how long your chat history is stored locally
Use experimental renderer Switches to a faster web-based view of AI Chat (still in development)

Tip

For the full list of AI settings, see AI configuration.