DataGrip 2026.1 Help

Query consoles

Overview

Query consoles are SQL and JS files are created for a data source automatically, always attached to it, and stored outside an IDE project. You can write and execute SQL statements in query consoles the same way as you do it in terminal. Query consoles are not included in the project context.

Query console

For more information about working with query results in query consoles, refer to Query results.

When you create a data source, a query console is created automatically and attached to this data source by default. If necessary, you can create additional query consoles for this data source.

Each query console creates a new connection session. If you do not want to create new connections, enable Single session mode.

The following video gives a short overview of query consoles in DataGrip.

Database connection session

For each query console, a database connection session is created automatically. You can create new connection sessions and attach your query console to existing ones in the console toolbar.

Location

All the created query consoles are located in the internal Database Consoles directory. To open this directory, open the Files tool window (Alt+2) and navigate to Scratches and Consoles | Database Consoles.

On your machine, query consoles are stored in the consoles subdirectory of the IDE configuration directory.

Code editor

The code editor is where you compose your SQL statements using the resolve modes and coding assistance features, and execute them against the associated data source.

Find the code editor toolbar controls in Code editor controls. Read more about the editor in Editor basics.

SQL statement execution

When you execute a statement, the Services tool window opens. The Services tool window displays available connection sessions, Output and Result tabs. For more information about the tool window, refer to the Services tool window topic.

Create a query console

To create a query console, use one of the following actions in the Database Explorer (⌘ 1) .

  • Select a data source and select File | New | Query Console from the main menu.

  • Right-click a data source and select New | Query Console.

  • Select a data source, press Alt+Insert, and select Query Console.

  • Select a data source, press Ctrl+Shift+F10, and select New Query Console.

  • Select a data source and press Ctrl+Shift+Q.

Open a query console

  • In the Files tool window, navigate to the Scratches and Consoles | Database Consoles internal directory . Expand the data source group that includes your query console, then double-click the query console you want to open.

  • In the Database Explorer, click the Jump to Query Console icon Jump to Query Console, navigate to the All submenu, and double-click the query console you want to open.

  • To open the default query console of a data source, click the data source and press F4.

Open a query console

Rename a query console

To rename a query console, do one of the following:

  • Right-click a query console tab and select Rename File.

  • In the Files tool window (Alt+2) :

    1. Navigate to the Scratches and Consoles | Database Consoles internal directory .

    2. Expand a data source group that includes your query console.

    3. Right-click the query console and then select Rename (Shift+F6).

Rename a query console

Group consoles under the data source directory

  1. Open the Files tool window (Alt+2) and navigate to the Scratches and Consoles | Database Consoles internal directory .

  2. Right-click a data source group where you want to create a new directory, then select New | Directory.

  3. Specify a name of the directory.

  4. Select and drag query consoles to the directory.

  5. In the Move dialog, click Refactor.

    Group consoles under the data source directory

Delete a query console

  • In the Files tool window (Alt+2) :

    1. Navigate to the Scratches and Consoles | Database Consoles internal directory .

    2. Expand a data source group that includes your query console.

    3. Right-click the query console and select Delete. Alternatively, press Delete.

Delete a query console

Copy a query console to a new location

  1. In the Files tool window, navigate to the Scratches and Consoles | Database Consoles internal directory .

  2. Expand a data source group that includes your query console.

  3. Right-click a query console and select Refactor | Copy File.

  4. In the To directory field, specify a new location for the query console.

Copy a query console to another location

Open a query console in the file browser

To open a query console in your file browser, do one of the following:

  • Right-click a query console tab and navigate to Open In | <file_browser>.

  • Open the Files tool window (Alt+2) and navigate to the Scratches and Consoles | Database Consoles internal directory . Expand a data source group that includes your query console. Right-click the query console, and select Open In | <file_browser>.

Open a query console in the file browser

Set the default schema

When you select the default schema for a query console, you can omit the name of that schema or database in your statements.

  • To set the default schema or database, click the <schema> dropdown located in the upper-right part of the toolbar. Then, select the schema that you need.

    For more information about schemas, refer to the Schemas topic.

    Select the default schema or database

Query console reference

Find information about query console context menu and toolbar buttons in the Code editor topic.

Read more about code editor in Editor basics.

13 March 2026