PyCharm 2019.2 Help

SQL files

Run an SQL file

  1. Right-click a data source.

  2. Select Run SQL Script.

  3. In the Select Path window, navigate to the SQL file that you want to apply.

Run an SQL file

Run an SQL file for several data sources

  1. Select the necessary SQL file in the Project tool window.

  2. Right-click the SQL file, select Run <file_name> (or press Ctrl+Shift+F10).

  3. In the Execution target window, select the necessary data sources.

Run an SQL file for several data sources

Run individual statements

  1. Open an SQL file in PyCharm.

  2. Click the statement that you want to execute. If you want to execute more than one statement, select (highlight) the necessary statements.

  3. Press Ctrl+Enter or select Execute from the context menu.

  4. Select the database console where you want to execute the statement.

Run individual statements

Create an SQL file

  1. In the Project tool window (View | Tool Windows | Project), 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.

  3. Click OK.

Specify an SQL dialect

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

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

  1. Right-click the editing area in the SQL file and select Change Dialect (<CurrentDialect>).

  2. Select a dialect from the dialect list and apply it to the current SQL file. If you want to apply the dialect to a set of files, select SQL Dialects.

  3. In the SQL Dialects dialog, click the Add button the Add button and select directories or files for which you want to change a dialect.

  4. Click Open.

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

  6. Apply changes and click OK.

Specify an SQL dialect
Last modified: 14 October 2019