DDL data sources allow you to model structures of databases that do not yet exist or that you do not have access to. A DDL data source is based on a data structure definition specified in a .ddl file. PyCharm reads DDL statements from this file and creates the corresponding structure in the new DDL data source.
DDL data sources can be used for various purposes. For example, if your target is to prepare a data source structure definition file to use in the future, you may need to check that it determines the correct data structure. You can also check whether the structure generated through your definition file is consistent with the target database. To do so, specify the JDBC data source that provides access to the target database as the parent data source.
PyCharm provides various coding assistance for handling data structure definition files. You can navigate from statements in a .ddl file to the corresponding tables or columns in the Database tool window. Any changes made to the tables in the data source are reflected in the .ddl file.
You can create a data structure definition file manually, or copy it from another location, or generate it based on an entire configured data source or any table or column accessible through it.
DDL data sources only exist on the project level.
- Start creating a new DDL data source.
- In the Data Sources and Drivers dialog, type the name of the new data source.
specify the desired data structure definition file.
PyCharm parses the specified file according to the SQL dialect assigned to it or its parent. To have the data structure created successfully, this dialect should support DDL statements. SQL dialect settings are specified on the SQL Dialects page of the Settings dialog box.
- If necessary, select the data source parent from the list of available data sources.
- Click OK.
- Open the desired .ddl file in the editor.
Position the cursor at the name of the desired table or column and press Alt+F1Shift+Alt+1 or Alt+F1Shift+Alt+1Alt+F1Alt+F1Alt+F1Ctrl+Shift+1, Ctrl+Shift+2, Ctrl+Shift+3 or Ctrl+Shift+9Alt+F1Alt F1Alt F1Alt ⌘ W.
The corresponding column is highlighted in the Database tool window: