DataGrip 2019.1 Help

Working with DDL definitions

Edit the DDL definition of a database object

  1. In the Database tool window (View | Tool Windows | Database), click a database object.

  2. Click the Source Editor button (the Source Editor button) on the toolbar. Alternatively, press Ctrl+B.

Edit the DDL definition of a database object

Generate DDL definitions for database objects

Data definition language (DDL) defines the structure of a database, including rows, columns, tables, indexes, and other elements. In DataGrip, you can generate the data definition of a database object using the SQL Generator tool window.

In the Database tool window (View | Tool Windows | Database), right-click a database object and select SQL Scripts | SQL Generator (Ctrl+Alt+G).

In the SQL Generator window, you can configure the output, copy it to the clipboard (The copy icon), save it to file (The Save to File icon), or open it in a database console (Run in a console).

Generate DDL definitions for database objects

Save generated DDL in SQL files

  1. In the Database tool window (View | Tool Windows | Database), right-click a database object and select SQL Scripts | SQL Generator (Ctrl+Alt+G).

  2. In the SQL Generator tool window, click the File Output Options icon (The File Output Options icon).

  3. From the Layout list, select a method that you want to use:

    • File per object: generates a set of SQL files.

    • File per object with order: generates a numbered set of SQL files.

Generate DDL for database objects

Go from a reference to its DDL definition

  1. In the Setting/Preferences dialog (Ctrl+Alt+S), navigate to Database | General.

  2. In the Navigation pane, clear the Prefer database view over DDL editor checkbox.

Open a definition in the DDL editor

Generate a DDL definition to the database console

In the Database tool window (View | Tool Windows | Database), right-click a database object and select SQL Scripts | Generate DDL to Console.

Generate a DDL definition to the database console

Generate a DDL definition to the clipboard

In the Database tool window (View | Tool Windows | Database), right-click a database object and select SQL Scripts | Generate DDL to Clipboard.

Generate a DDL definition to the clipboard