PyCharm
 
Get PyCharm

DDL data sources

Last modified: 22 November 2024

DDL data source is a virtual view of a database structure based on SQL files that contain data definition language statements (DDL statements). You can reference all tables, columns and other objects defined in such files in the editor. Diagrams are also supported.

DDL data source lets you maintain database versioning. Keep the SQL files under a VCS system and regenerate them every time your database structure is updated.

Once created, DDL data sources are available in Database tool window (View | Tool Windows | Database) . You can create and manage the SQL files with statements in the Project tool window (View | Tool Windows | Project) .

DDL data source in Database tool window and SQL files with statements in Project tool window

In PyCharm, you can create a DDL data source by dumping an existing data source and by using existing SQL files:

  • When you dump an existing data source to a DDL data source, the folder with SQL files for this DDL data source is automatically attached in the Database tool window.

    If you already have a DDL data source for the selected data source, you can choose whether to dump DDL files to the existing DDL data source or create a new one.

  • To create a DDL data source using existing SQL files, add the directory with the SQL files to your project and drag them from the Project tool window to the Database tool window.

Use file scopes to filter the files and folders that are used as sources for the DDL data source. When you dump DLL files to the existing DDL data source, the excluded ones will be ignored.