DataGrip 2022.3 Help

Run files

Run the current file

You can run single files using a dedicated option on the toolbar. The run and debug buttons are active and allow you to instantly run the currently opened file.

  1. In the editor, open the file that you want to run.

  2. Click Run next to the Current File option on the toolbar.

    Running a single file from the toolbar

You can access other runners from the submenu as well: expand the list and click the right arrow next to Current File. From the menu that opens, you can open the run configuration to specify more options.

More options for running current file

Run an SQL file for several data sources

To run an SQL file for several data sources, attach a directory with the necessary files in the Files tool window (see User files).

  1. In the Files tool window (View | Tool Windows | Files), select file or files that you want to run.

  2. Right-click the selection and navigate to Run <configuration_name> (or press Ctrl+Shift+F10). This action creates a temporary run configuration.

  3. In the Edit Configuration window that opens, click the Add button (the Add button) in the Target data source / schema pane and select data sources or schemes against which you want to run selected files.

    You can click the Recent button (the History button) to select data sources that you used recently.

    Run an SQL file for several data sources
  4. Click Run.

Run files by using run configurations

Depending on your purposes, you can edit existing or create new configurations. For more information about editing you configurations, see Using run/debug configurations.

  1. Open the Run/Debug Configuration dialog in one of the following ways:

    • Select Run | Edit Configurations from the main menu.

    • With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector.

  2. In the Run/Debug Configuration dialog, click the Add New Configuration icon (the Add New Configuration icon) and select Database Script.

    The fields that appear in the right-hand pane display the default settings for the selected configuration type.

    • Target data source / schema: databases or schemas against which you want to run your database scripts. This setting is dialect-dependent.

      If you select a data source as a target, DataGrip displays a schema in which the script will be run. It is the default schema.

    • Script text: script that you want to run.

    • Script files: SQL files that you want to run. To add files, click the Add button (the Add button) and navigate to files that you want to run. If a script contains schema switching, you will see a warning (Warning).

    • Data source (utPLSQL and tSQLt): a name of a data source. utPLSQL supports Oracle. tSQLt supports Microsoft SQL Server.

    • Database (tSQLt): a name of the Microsoft SQL Server database.

    • Paths (utPLSQL and tSQLt): a qualified path to the testing package.

    • Tags (utPLSQL): tags of tests that you want to run. Use semicolon (;) as separator.

  3. Apply the changes and close the dialog.

  4. Click the Run <configuration_name> button The Run button.

    Run files by using run/debug configurations
Last modified: 05 December 2022