DataGrip 2022.3 Help

Export data in DataGrip

DataGrip has an engine to export and import data in various formats. You can select a predefined format or create your own.

For more information about export and import operations, see the corresponding section.

Export directions

You can export or copy to the clipboard any result set, table, or view.

Export to a file

  1. To export data to a file, perform one of the following actions:

    • Right-click a result set, a table, or a view, select Export Data.

    • Right-click a query and select Export Data to &File.

    • On the toolbar, click the Export Data icon (The Export Data icon) and select Export to File.

  2. In the Export Data dialog, click Export to File.

    Export a view to a file

Export to a clipboard

  • Select data in the result set or in the editor and press Ctrl+C.

  • On the toolbar, click the Export Data icon (The Export Data icon) and select Copy To Clipboard.

    Export a view to the clipboard

Built-in extractors

You can select a built-in export format from the list near the Export Data icon (The Export Data icon). There are several built-in formats. You can export data as a set of INSERT or UPDATE statements. Also, you can select text formats like CSV, JSON, HTML, Markdown, and other formats (for more information about export options, see Import/Export options.

Before DataGrip 2020.1, if you select the default extractor from the list, you set this extractor as default for the whole IDE. Beginning from DataGrip 2020.1, you set the extractor for a single table. If you open a different table, the extractor defaults to CSV.

Select the extractor
  1. From the list of data extractors, select Configure CSV formats.

  2. In the CSV Formats dialog, click the Add Format icon The Add Format icon.

  3. Specify a name of a new format (for example, Confluence Wiki Markup).

  4. Define settings of the format: set separators for rows and headers, define text for NULL values, specify quotation. Click OK.

    When the format is created, you can select it in the drop-down list near the Export Data icon (The Export Data icon).

    Configuring extractors
  1. In the Files tool window (View | Tool Windows | Files), navigate to Scratches and Consoles | Extensions | Database Tools and SQL | data | extractors.

  2. Right-click the extractors node and select New | File.

  3. Type the filename (for example, PHP.array.groovy), where:

    • PHP: the name that is used in the extractor menu.

    • array: output of the extractor.

    • groovy: the extension of the script.

  4. Type or paste the code of the extractor in a new file. You can use code of other extractors in the extractors folder to write your extractor. Also, you can try the following extractors:

  5. Select the extractor from the list of extractors.

    Consider the following example of adding the PHP-array extractor in DataGrip.

    Add a custom extractor
Last modified: 05 December 2022