
DataGrip 2016.2 release: CSV import, JSON and XML support in rows, dynamic SQL, improvements for PostgreSQL
Hello! We have time for releases. This is a post about what's interesting in the new version of DataGrip - our IDE for SQL. These changes also apply to IntelliJ IDEA , PyCharm , PhpStorm and RubyMine - those tools from JetBrains that have database support.

Here is what we added:
The old way was inconvenient . We have added an interface for import - now select the item I mport from file ... from the context menu of the data source , specify the path to the file and forward.
A dialog box opens in which there are options for describing the file structure - the separator used, quotation marks, the presence of headers, etc. On the right side, specify the field types and other characteristics of the table into which the data will fall. Using the Delete key, you can delete columns from the script for creating this table. If errors occur during import, the process will not stop, and information about errors will be written to a text file - in the lower part of the window indicate where to create it.

Schemes that you see in the database window now select directly from the tree. In the Schemas tab , there are no more data source properties. Remember that the console only knows about objects from this tree.

You can assign a specific language to a string literal and use the IDE's capabilities to work with it - highlighting, auto-completion, and others. It can be JSON , XML , regular expressions or any dialect of SQL .
When DataGrip understands that the field contains JSON data or XML , support is automatic.
Let's say we insert a value into a field of type JSON .

If you specify a value for the default field, the same thing happens - here the IDE realized that you are using XML, and opportunities to work with this language have become available. This is renaming elements, searching for entries, moving elements to the sides, etc. Do not forget to look at the XML support documentation page in our tools.

By default, only two types are built in, for which languages are automatically supported - JSON and XML. But if you have a data type for which you want to have the same, then select Inject by Type from the Alt + Enter tooltip menu.

The example uses the CUSTOMDATA type , but let's say we always use XML for types whose name ends in DATA . The name of the types for which automatic support will be provided is described in regular expression(? i). * DATA. You can check on the fly whether this or that string matches the template, in this case, the name of your type.

Type name templates for supporting languages in literals fall into Settings / Preferences → Editor → Language Injections.

You can now check the string against the regular expression anywhere. According to Alt + Enter , select the appropriate language, and then again on the Alt + Enter Select Check Regexp.

Another way to tell the environment about the language in a string literal is to use a comment of the form language =% name% . The following example uses dynamic SQL- Inside the line, autocompletion and navigation started working: the environment understood which objects are used in the request within the line.

For the values inside the table, we added an addition by values to the field, which is called by Ctrl (Cmd) + Space. This is reminiscent of an already existing type of add-on, which is called by Alt + / - it searches for all used words in all open files.

Specific improvements for PostgreSQL : fields with range types can be edited.

And fields with time zones.

Column size now changes by Ctrl (Cmd) + Shift + Left / Right . All columns are selected by Shift + Space , as in Excel.

Like all other IntelliJ development environments, we now support ligatures. To do this, they must be supported by the font itself, which you install. It can be FiraCode , Hasklig , Monoid or PragmataPro .

It turns out this: A

nice feature for those who use several languages, that is, for you and me: auto-completion will help if you forgot to switch the layout.

The Surround with function item appeared in the Surround with menu ( Ctrl / Cmd + Alt + T ) - the selected expressions will be bracketed and the cursor will be placed before the first bracket. Previously, this thing did not work with multicursors, now everything is fine. For PostgreSQL

we supported search path - add and remove schemes from the menu at the top of the console.

In the connection window, the addition of names in the fields of the server, instance, and database now works.

Last time, there were a lot of comments about problems connecting to SQL Server . We have written a small guide to solve the main problems with this.
The corresponding item is added to the context menu, and only those packages that need this can be recompiled. To do this, select Invalid objects only.

Now you can export the entire schema or selected tables at once. We started work on integrating DataGrip with the external tools pg_dump and mysqldump , so write your wishes in the comments!

In the Find Action menu (Ctrl (Cmd) + Shift + A), find Set Background Image or select the corresponding item in the context menu of the image file. Then adjust the transparency and other background settings. This has appeared in all IntelliJ IDEs.

If you want to know more, welcome to the What's new page , and do not forget to look into Features , suddenly didn’t know something?
We will be happy if you try DataGrip 2016.2 and tell us about your impressions while we are preparing the first small update.
DataGrip Team.

Here is what we added:
Import CSV
The old way was inconvenient . We have added an interface for import - now select the item I mport from file ... from the context menu of the data source , specify the path to the file and forward.
A dialog box opens in which there are options for describing the file structure - the separator used, quotation marks, the presence of headers, etc. On the right side, specify the field types and other characteristics of the table into which the data will fall. Using the Delete key, you can delete columns from the script for creating this table. If errors occur during import, the process will not stop, and information about errors will be written to a text file - in the lower part of the window indicate where to create it.

Choice of schemes
Schemes that you see in the database window now select directly from the tree. In the Schemas tab , there are no more data source properties. Remember that the console only knows about objects from this tree.

Language support in string literals
You can assign a specific language to a string literal and use the IDE's capabilities to work with it - highlighting, auto-completion, and others. It can be JSON , XML , regular expressions or any dialect of SQL .
When DataGrip understands that the field contains JSON data or XML , support is automatic.
Let's say we insert a value into a field of type JSON .

If you specify a value for the default field, the same thing happens - here the IDE realized that you are using XML, and opportunities to work with this language have become available. This is renaming elements, searching for entries, moving elements to the sides, etc. Do not forget to look at the XML support documentation page in our tools.

By default, only two types are built in, for which languages are automatically supported - JSON and XML. But if you have a data type for which you want to have the same, then select Inject by Type from the Alt + Enter tooltip menu.

The example uses the CUSTOMDATA type , but let's say we always use XML for types whose name ends in DATA . The name of the types for which automatic support will be provided is described in regular expression(? i). * DATA. You can check on the fly whether this or that string matches the template, in this case, the name of your type.

Type name templates for supporting languages in literals fall into Settings / Preferences → Editor → Language Injections.

You can now check the string against the regular expression anywhere. According to Alt + Enter , select the appropriate language, and then again on the Alt + Enter Select Check Regexp.

Another way to tell the environment about the language in a string literal is to use a comment of the form language =% name% . The following example uses dynamic SQL- Inside the line, autocompletion and navigation started working: the environment understood which objects are used in the request within the line.

Table editor
For the values inside the table, we added an addition by values to the field, which is called by Ctrl (Cmd) + Space. This is reminiscent of an already existing type of add-on, which is called by Alt + / - it searches for all used words in all open files.

Specific improvements for PostgreSQL : fields with range types can be edited.

And fields with time zones.

Column size now changes by Ctrl (Cmd) + Shift + Left / Right . All columns are selected by Shift + Space , as in Excel.

Console
Like all other IntelliJ development environments, we now support ligatures. To do this, they must be supported by the font itself, which you install. It can be FiraCode , Hasklig , Monoid or PragmataPro .

It turns out this: A

nice feature for those who use several languages, that is, for you and me: auto-completion will help if you forgot to switch the layout.

The Surround with function item appeared in the Surround with menu ( Ctrl / Cmd + Alt + T ) - the selected expressions will be bracketed and the cursor will be placed before the first bracket. Previously, this thing did not work with multicursors, now everything is fine. For PostgreSQL

we supported search path - add and remove schemes from the menu at the top of the console.

Connection
In the connection window, the addition of names in the fields of the server, instance, and database now works.

Last time, there were a lot of comments about problems connecting to SQL Server . We have written a small guide to solve the main problems with this.
Recompiling packages in Oracle
The corresponding item is added to the context menu, and only those packages that need this can be recompiled. To do this, select Invalid objects only.

Schema Export
Now you can export the entire schema or selected tables at once. We started work on integrating DataGrip with the external tools pg_dump and mysqldump , so write your wishes in the comments!

Images as IDE Background
In the Find Action menu (Ctrl (Cmd) + Shift + A), find Set Background Image or select the corresponding item in the context menu of the image file. Then adjust the transparency and other background settings. This has appeared in all IntelliJ IDEs.

If you want to know more, welcome to the What's new page , and do not forget to look into Features , suddenly didn’t know something?
We will be happy if you try DataGrip 2016.2 and tell us about your impressions while we are preparing the first small update.
DataGrip Team.