DataGrip 2024.1 Help

User files

User files are the files that are stored on your machine or any other place you have access to. To work with them in DataGrip, attach the directory that contains them in the Files tool window .

You can view, edit, create, and delete the SQL files.

Create an SQL file

  1. In the Files tool window ( View | Tool Windows | Files) , right-click the directory in which you want to create an SQL file and select New | SQL File.

  2. In the New File dialog, specify the filename.

    Create an SQL file

Managing files and directories

You can add directories and files to your project by attaching them to it in the Files tool window . The attached directories become associated with the project, DataGrip indexes them and includes them into search, navigation, highlighting, and so on. You can exclude the attached directories and files from project, include them back, and physically delete them using the corresponding context menu actions.

Action

Applies to

Description

Detach Directory from Project

Directories

Remove the association of the directory with the project.

Directory will be removed from Files tool window , but it will remain intact physically on disk.

Exclude from Project

Directories and files

Exclude the directory or file from indexing and make them ignored by inspections, code completion, navigation, and so on.

The item will remain in Files tool window highlighted unless the Show Excluded Files option is enabled in the Options icon Options | Tree Appearance on the title bar. The item will remain intact physically on disk.

Delete

Directories and files

Physically delete the directory or file from disk.

Attach a directory with SQL files

  1. To attach a directory, do one of the following:

    • In the main menu, go to File | Open.

    • In the Files tool window ( View | Tool Windows | Files) , right-click any area and select Attach Directory to Project.

    • In the Files tool window ( View | Tool Windows | Files) , click the Attach Directory to Project button (Attach Directory to Project) in the toolbar.

  2. In the file browser, navigate to the directory that you want to attach.

  3. Click Open.

Attach a directory with SQL files

Exclude files and directories from project

  • To exclude file or directory from your project, in the Files tool window , right-click the directory that you want to detach and click Exclude from Project.

    The item becomes highlighted in the tree.

Files tool window with files and directories that are excluded from the project

To include the file or directory back to your project, right-click it and select Include to Project.

Detach a directory with SQL files

  1. In the Files tool window ( View | Tool Windows | Files) , right-click the directory that you want to detach and click Detach Directory from Project.

  2. In the notification dialog, click Detach.

    Detach a directory with SQL files

Run SQL files

SQL files are run against the selected databases or schemas using run configurations. To run an SQL file, you can either create a new run configuration, or edit an existing one.

For more information about running an SQL files from your machine, refer to Run files.

Configure a dialect for SQL files

For better coding assistance, assign an SQL dialect to an SQL file. An SQL dialect is a DBMS-specific version of SQL.

DataGrip lets you specify the SQL dialect for an individual file or all SQL and DDL files that can be stored in a directory, in your project, or on your computer.

Specify a dialect for a single SQL file

  1. Click the dialect list, which is in the upper-right corner of the window.

  2. Select a dialect from the dialect list.

    Specify an SQL dialect

Specify a dialect for multiple SQL files

  1. Open settings by pressing Ctrl+Alt+S and navigate to Database | SQL Dialects. .

  2. Click the Add button the Add button and select directories or files for which you want to change a dialect.

  3. Click Open.

  4. Click the SQL Dialect cell and select the necessary dialect.

  5. Apply changes and click OK.

    Specify an SQL dialect

Images

View images in DataGrip

  • In the Files tool window ( View | Tool Windows | Files) , find and select the image file.

  • To preview an image in a popup instead of in a separate tab, select the image file in the Files tool window and press Ctrl+Shift+I.

View images in an external editor

  • In the Files tool window ( View | Tool Windows | Files) , right-click the image file and select Jump to external editor.

    Alternatively, press Ctrl+Alt+F4.

    DataGrip opens the image in the editor that is used in your OS by default. You can configure another image editor in which the IDE will open files.

Change the default external editor

  1. Right-click an image in the editor and select Edit Path to External Editor from the context menu.

    You can also press Ctrl+Shift+A and type Edit Path to External Editor.

  2. In the Path to External Editor dialog, specify the path to the application in which you want to open images and click Save.

    Specifying the path to an external editor

Toolbar and context menu actions

Action

Description

Show Chessboard

Select this checkbox to have transparent pieces of images shown as a chessboard.

Show Grid

Select this checkbox to have a grid displayed when reviewing image files.

Zoom In

Click the zoom the image in.

Zoom Out

Click the zoom the image out.

Actual Size

Click to view the image in its actual size.

Fit Zoom To Window

Click to make large images fit the window size.

Show Color Picker

Open the Color Picker dialog.

Last modified: 08 April 2024