Working with files

Attach directory

You can manage files and directories right from DataGrip: your work directory, or several of them, can be displayed in the Files tool window. To attach the needed directory to the Files tool window, use the context menu.

Attach console

Attach a console to .sql files, meaning that objects will be associated with the data source of this console and queries will be run in the context of this console.

To do so, use the context menu of the file or the drop-down switcher in the top right-hand corner of the file editor.

Version control

DataGrip provides unified support for all the major version control systems (Git, SVN, Mercurial, and many others), so you can easily work on different projects from different VCS and switch between them at will. If you notice a small issue while looking at a diff, there is no need to go back to the editor - just unlock the editing mode and apply changes in-situ.

To have the VCS support, please, install the corresponding JetBrains plugin from Settings → Plugins.

See also: How to work with Git in DataGrip and DataGrip and GitHub integration.

Run against data-source, database or schema

Invoke the context menu and run script files against a particular data-source, database, or schema. This is much faster than opening the same files and then running scripts from the editor.

Scratch files

A very handy feature that helps you experiment and prototype. With this feature, you can sketch something really quickly right in the editor, without modifying your project or creating any files. You can open any number of scratch files and easily switch between them. DataGrip will provide all of its coding assistance features for these files according to the file type you select for them in the status bar widget.

File language

To get the correct highlighting and resolution suggestions, you can change the language of any file. Or, in the case of SQL, select the appropriate dialect.

SQL resolution scopes

You can map any SQL file or folder to any data-source in Settings | Tools | Database | SQL resolution scopes. If you do, all unqualified objects from these locations will be resolved to the selected data-source, database, or schema.

SQL dialects

Specify the SQL dialects used in the various directories you work with to have the files highlighted and analyzed correctly.