DataGrip 2020.2 Help

Data extractors

Data extractors set rules of how to copy or view your data in the editor (in the Text view mode). You can select a default extractor from the list near the Export Data icon (The Export Data icon), configure the existing extractor, or create a custom extractor by using Groovy or JavaScript.

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, or Markdown. For more information about exporting, see the Export section.

Select the extractor

Configure an extractor for delimiter-separated values

You can extend the default functionality and create your own format that is based on CSV or any DSV format.

  1. From the Export Data list (The Export Data icon), 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

Add a custom extractor

You can create your own extractor that you can write on Groovy or JavaScript.

  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.

    Add a custom extractor
Last modified: 15 July 2020