How to Find Things in DataGrip
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, or even something from the past!
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.
Database objects
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 neat 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) such as a table, view, procedure, and so on. Just type the name or an abbreviation of the object you need. Ctrl+Alt+Shift+N (Alt+Cmd+O) includes more objects in the search scope like columns, 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.
All navigation actions now work from here.
For instance, if you’re searching for a table, see what you can open from right here:
– Table’s DDL: Ctrl+B (Cmd+B).
– Table’s data: F4 (Enter does the same for tables).
– Select the table the database explorer: Alt+Shift+ (Opt+Shift+B).
– Modify Table dialog: Ctrl+F6 (Cmd+F6).
– Quick doc popup: Ctrl+Q (F1).
– SQL generator: Ctrl+Alt+G (Cmd+Opt+G).
If you want to see the object in the database tree, turn on Auto-Scroll from editor. It will work with whichever option you choose in the previously described setting.
Here’s a small tip for searching for columns in any result-set or table. Open Structure view by Ctrl+F12 and start typing! Speed search will save you again by filtering the columns. Press Enter to navigate to a particular column.
Data
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, use the corresponding drop-down list. Enter -1
if you want to avoid paging, but keep in mind that this 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.
DataGrip also provides the ability to apply a full text search query to your database. This can be helpful if you don’t know where the data is located. To do this, select the data sources, groups of data sources, or separate tables you want to search through and then select ‘Full text search’ from the context menu.
There is, of course, a shortcut for this: Ctrl+Alt+Shift+F (Cmd+Opt+Shift+F).
In the dialog that opens, enter the string that will bring up a list of the data sources through which you can search. You will then be able to set some options for your search. Furthermore, you can see which particular statements DataGrip will run to perform the data search.
After running the search, you will see the results and be able to open them.
Click on a result to open the data editor. The filter will be pre-defined to display only those strings where the data are found. If you cannot locate the data because there are too many columns, use the shortcut Ctrl+F (Cmd+F) to search for text in the data editor.
Code
Find is a must-have feature for any editor. As usual, in DataGrip it is available via Ctrl+F (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. To set multicursors to the search results, press Ctrl+Alt+Shift+J (Ctrl+Cmd+G).
Notice the filter icon, which lets you define where to search.
Find in Files Ctrl+Shift+F (Cmd+Shift+F) 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 places’, 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/Opt+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.
Other stuff
To navigate to a file with the specified name, press Ctrl+Shift+N (Shift+Cmd+O).
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/Cmd+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.
Finally, DataGrip lets you travel back in time and search for something from the past, be it deleted code, a forgotten query, clipboard value from one hour ago, or even a deleted file. Learn more by watching our new tutorial, Don’t Lose Your Work! Stay Safe With DataGrip.
When all else fails, tweet at us. If DataGrip can do it, we’ll let you know how!
Your DataGrip team