Working with files
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 corresponding button on the toolbar.
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.
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.
To have the VCS support, please, install the corresponding JetBrains plugin from Settings → Plugins.
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.
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.
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.
Specify the SQL dialects used in the various directories you work with to have the files highlighted and analyzed correctly.