📜 ⬆️ ⬇️

DataGrip 2019.2: Connection management, data search, filtering in navigation

Hello! We talk about what we did in DataGrip in four months. If you use database support in our other IDEs, this post is for you too.



Services Toolbox


The IntelliJ platform IDE has a new tool window: Services. In DataGrip, connections are displayed here.


')
Each tree node, whether it is a service, data source, connection, can be opened in a separate tab: click Show in New Tab on the toolbar. Or use drag-and-drop. If a green circle is lit on the connection, it means that it is active. You can close the connection from the context menu.

Query results are attached to the corresponding connections. If you want to return the view “as before”, turn off the services tree in the display settings by clicking on the gear icon.



Request Timer


In the Services window, they added the ability to see how long the request takes: the clock is ticking to the right of the console from which it is running.

Docker


Another service that may appear in this window is Docker, if you use the appropriate plugin.



The keyboard shortcut for showing / hiding the Services window is Alt / Cmd + 8 .

Data Search


Look for data, even if you don’t remember where it is stored. Select a data source, a group of sources, or, conversely, only individual tables, and press Ctrl / Cmd + Alt + Shift + F. Or select Full-text search from the context menu.



In the dialog box, enter what to search. On the left is a list of data sources. The bottom of the window shows the queries that DataGrip will execute for the search.



The results look like this:



By clicking on the result, the data editor will open, in which a filter will be applied to show only the found lines. If there are too many columns and it is not clear where what you found is, use the text search: Ctrl / Cmd + F.



Details:
- In PostgreSQL , MySQL and MariaDB, you can only search by indexed columns. To do this, select ' Only columns with full-text search indexes ' in the 'Search in' list.
PostgreSQL will have this query: where col @@ plainto_tsquery('query')
In MySQL and MariaDB, this is: where match(col) against ('query' in natural language mode)
- In Oracle , DataGrip will use the context, ctxrule, ctxcat indexes, if any.
- In SQL Server, if full-text indexes are built, DataGrip generates a query with the clause ` WHERE CONTAINS (col, N'text ') `.
- Search searches in columns for which LIKE is not supported. For example, JSON columns will be pre-converted to a string.
- For Cassandra, DataGrip runs multiple queries for the same table because the OR statement is not supported.

Data editor


Quick Resize


Change the page size in the data editor without going to the settings.



Tab Names


Now you yourself can name the tabs for the results: write a name in the comments before the request.



If you do not like that any previous comment becomes a name, indicate the word after which there will be a line for the heading. This is done in the appropriate settings.



Database explorer


Fast backup tables


You can copy tables using drag-and-drop for a long time, but before this did not work if you drag it into the same scheme. It works now! It is convenient if you backup data before an important operation.



Quick group creation


Create groups of data sources by dragging one source to another. If you need to move the data source to an existing group, this is also done with the mouse. We remind keyboard lovers that there is an F6 key for this.



Forced update


The new Force Refresh action will load information about all the objects in the database, having previously cleared the cache. It may be useful if something is “stuck” in your memory and you do not see the actual picture.



Active compounds


From this version, a small green circle on the icon of the data source means that the connection to it is active.



Comments on tables


After turning on View | Appearance | Descriptions in Tree Views table comments are displayed in Explorer.



Data Source Filtering


If you have many similar databases, it was inconvenient to search for objects: for example, if you are looking for a table, and you have ten such tables, they all showed up in the output.
Now you can specify where to look: select a specific data source or group of sources.



The same thing works when searching for code in Find In Path .



Help writing code


System objects


Databases have system directories - metadata is stored there: information about tables, procedures, built-in functions.

Objects from these directories are often used in queries, so they need to be shown in auto-completion and correctly highlighted: the IDE should not think that these are some unknown objects.

Previously, for this to work, system circuits had to be added to the explorer, because DataGrip only knew about those objects that were introspected. But system circuits do not change, it does not make sense to receive information about them every time. In addition, they are not always needed in the conductor and interfere with work schemes there.

The lightning bolt in front of the diagram means that DataGrip always has information about its objects, even if you have not added it to the explorer.



Here are some examples of system diagrams:
PostgreSQL : pg_catalog, information_schema
SQL Server : INFORMATION_SCHEMA
Oracle : SYS, SYSTEM
MySQL : information_schema
DB2 : SYSCAT, SYSFUN, SYSIBM, SYSIBMADM, SYSPROC, SYSPUBLIC, SYSSTAT, SYSTOOLS

Warnings and Corrections


Now, from the warning window, you can immediately solve the problem that you were informed about. For example, in a typo window, DataGrip offers to fix it, and if the IDE warns that there is no alias, you are prompted to enter it. To do this, click on the action in the lower left or press Alt + Shift + Enter .


Alt + Enter still works and shows a list of all the possible actions in this context.

We also added some new inspections.

Optional CASE

If the CASE statement can be removed and the code readable, DataGrip will offer to do this.

Using IF :



Using COALESCE :



Possible line cropping

The IDE will warn if the value being written is longer than the expected value.



Convert GROUP BY to DISTINCT

Now you can convert GROUP BY to DISTINCT, if all the columns in the SELECT clause are also in GROUP BY .



Code editor


New settings for carriage movement


We changed the default carriage movement behavior. DataGrip now moves the carriage to the end of the current word if you are jumping over words. This behavior is configured in the settings : Editor | General



Typically, this action is performed by arrows when Ctrl is pressed for Windows / Linux and Opt is pressed for MacOS. The default behavior in different operating systems is different: now in our IDE it works “like on a Mac”.
Earlier:



Now:



Query Highlight


Added a new action: Select current statement. It can be found using Find Action (Ctrl / Cmd + Shift + A). If you use an action frequently, assign a keyboard shortcut.



Folding numbers


Larger numbers can be collapsed using Ctrl / Cmd + Minus.



Still



That's all!


DataGrip Team

Source: https://habr.com/ru/post/461725/


All Articles