To work with files from your machine or any other place you have access to, attach the directory you need to the Project tool window.
Running SQL files
Run an SQL file
Right-click a data source.
Select Run SQL Script….
In the Select Path window, navigate to the SQL file that you want to apply.
Run an SQL file for several data sources
Select the necessary SQL file in the Project tool window.
Right-click the SQL file, select Run (or press Ctrl+Shift+F10).
In the Target data source / schema pane, click the Add button () and select the necessary data sources.
To see a full list of data sources, click the Filter button.
Run individual statements
Open an SQL file in PyCharm.
Click the statement that you want to execute. If you want to execute more than one statement, select (highlight) the necessary statements.
Press Ctrl+Enter or select Execute from the context menu.
Select the query console where you want to execute the statement.
Configuring 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.
PyCharm 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
Click the dialect list, which is in the upper-right corner of the window.
Select a dialect from the dialect list.
Specify a dialect for multiple SQL files
Open settings by pressing Ctrl+Alt+S and navigate to.
Click the Add button and select directories or files for which you want to change a dialect.
Click the SQL Dialect cell and select the necessary dialect.
Apply changes and click OK.