Search and navigation tips
When you work with a software tool, you often need to find something or other. In DataGrip, you could be looking for things like:
— Database objects: tables, views, procedures, columns and so on.
— Data: enough said.
— Code: for example a piece of code in a big script or the source code for a database object.
— Lots of other things: files, settings, IDE actions, etc.
Finding what you need easily is crucial to user experience, which is why we focus heavily on making search and navigation intuitive in DataGrip. Let’s look closer at how not to get lost in the IDE and your databases.
First, any tree (list, pop-up, drop-down) in IntelliJ-based IDEs supports speed search. Simply start typing! Note though that a matching database object will only be highlighted if its node is already open.
Another nifty thing about speed search is that it supports abbreviations. For instance, ‘fa‘ is enough to find ‘film_actor‘.
Navigate to any database object with Ctrl+N (Cmd+O for OS X) such as a table, view, procedure, etc. Just type the name or an abbreviation of the object you need. Ctrl+Alt+Shift+N (Alt+Cmd+O for OSX) includes more objects in the search scope like column, indexes etc.
If you are looking for a table or view, Enter will open the data editor (with a DDL tab in case you need the code). For functions or procedures, Enter will open the source code.
If you want DataGrip to open DDL for tables and views, turn off Prefer data editor over DDL editor in Preferences → General.
If you want to see the object in the database tree turn on Auto-Scroll from editor. It will work whichever option you choose in the previously described setting.
And a small tip for searching for the columns in any result-set or table. Open Structure view by Ctrl+F12 and start typing! Speed search saves you again and filter columns. Press Enter to navigate to the particular column.
To quickly find data inside a table, without writing a statement, call up text search with Ctrl/Cmd+F. It’s especially helpful if you don’t know which exact column contains the data you’re looking for. You can see only rows with matches if you prefer.
Note that this searches only within the current page of the result-set. To configure the page size of the result set, go to Settings → Database → Data views → Result page size. Enter -1 to avoid paging. But remember, that it can affect the performance of the queries.
When working with a table, enter a filtering condition written in SQL in the corresponding field, as if you were writing it a WHERE clause.
This field can be automatically populated from the context menu.
Find is of course a must-have feature for any editor. As usual, in DataGrip it is available via Ctrl/Cmd+F.
What many people don’t know (including some at JetBrains!) is that completion works here as well. Press Ctrl+Space to complete the value, based on the words you have in the current context. Set multicursors on the search results: Ctrl+Alt+Shift+J (Ctrl+Cmd+G for OSX).
Notice the settings icon, which lets you exclude comments and literals, or conversely search only within comments and literals.
Find in path (Ctrl/Cmd+Shift+А) looks for code in other consoles, attached files and even in the source code of views and routines.
In our example, if you select ‘In Project‘, it only looks for code in dump files attached to the project. But if you choose ‘All scopes,’ it will also look inside source codes and thus locate the procedure in our database.
Find usages in the context menu of the object (or press Alt+F7) will show you where it is used, be it scripts or source codes of other projects. In our example, the actor table is found in dump-files, database consoles with different queries and several objects: one rule and three views.
To navigate to a file with the specified name press Ctrl+Shift+N (Shift+Cmd+O for OSX).
Speed search works in Settings as well. Earlier in this post we described the way to set the page size; follow the same steps to locate this setting.
Find action (Ctrl+Shift+A) will lend a helping hand when the going gets tough. By the way, it also searches in settings, so ‘Result page size‘ setting can be found here as well.
What’s most important, if you know something is possible in DataGrip but you don’t know how access it, just type it here. For instance, if you forget how to open a new console, press Ctrl/Cmd+Shift+A, type “open new console” and press Enter. Voila!
When all hope is lost, go with ‘Search everywhere‘. This feature makes it possible to look for any item in databases, files, actions, elements of the user interface, etc., all via a single action. Below, ‘actor‘ takes us not only to various database objects, but to the ‘Refactor‘ action as well. The refactoring can be performed from the drop-down with the search results.
Define the scope of ‘Everywhere’ with the gear icon.
When all else fails, tweet at us. If DataGrip can do it, we’ll find it for you!
Your DataGrip Team