How to search in DataGrip
Search and navigation tips
When working with a software tool, searching tends to be a very popular and frequently-used feature that is crucial to a good user experience. In DataGrip, you can look for things like:
Database objects: tables, views, procedures, columns and other objects.
Data: all data inside a table.
Code: code in consoles, attached files and even in the source code of views and routines.
Other things: files, settings, IDE actions, and other things.
Database objects
First, any tree (list, popup, list) in DataGrip supports a speed search. To activate the speed search, start typing.
Speed search supports abbreviations. For instance, fa
is enough to find film_actor
.
To navigate to a database object (like a table, view, procedure), press Ctrl+N and type a name or an abbreviation of the object that you need. If you want to broaden your search scope, press Ctrl+Shift+Alt+N. In this case, the search scope will include columns, indexes, and other objects.
After the search, if you select a table or a view and press Enter, you will see the data editor (with a DDL tab in case you need the code). If you select functions or procedures, you will see their source code.
If you want DataGrip to open the DDL view for tables and views, turn off the Prefer data editor over DDL editor option in Preferences | General.
If you want to see the object in the database tree, select the Auto-Scroll from editor option. This option takes priority over the settings that you have chosen previously.
In case you want to search for columns in a result set or table, invoke the Columns list action Ctrl+F12 and start typing. Speed search filters columns automatically. Press Enter to navigate to the column that you need.
Productivity tips
If you search for a table, you can also use the following actions:
- Open the table DDL
-
Ctrl+B
- Open the table data
-
F4
- Open the Modify Table dialog
-
Ctrl+F6
- Open the Select in popup
-
Alt+F1
- Open the Quick documentation popup
-
Ctrl+Q
- Open the SQL generator
-
Ctrl+Alt+G
Data
To quickly find data inside a table without writing a statement, call up a text search with the Find action Ctrl+F. It is especially helpful if you do not know what column contains the data that you are looking for. Select the Filter rows checkbox to see only rows with found matches.
You can enter a filtering SQL condition (like in the WHERE clause) in the <Filter criteria> field.
To filter a table according to a cell value, click this cell and select Filter by from the context menu.
Code
To search through the code, use the Find action Ctrl+F.
Code completion Ctrl+Space can help you to find a value that is appropriate in the current context. To edit a group of search results, set multi-cursors (Ctrl+Shift+Alt+J) and start typing.
You can tune a search scope to exclude comments and literals, or, otherwise, search only within comments and literals.
Find in path Ctrl+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, DataGrip only looks for your code in dump files attached to the project. But if you select All scopes, DataGrip will also look inside the source code and locate the procedure in our database.
Find usages Alt+F7 will show you where an object is used. It can be 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.
Speed search works in Settings as well. Earlier in this tutorial, we described the way to set the page size, follow the same steps to locate this setting (see the beginning of the Data section).
Find action Ctrl+Shift+A will lend you a helping hand when you forget how to call this or that action. By the way, it also searches in settings, so Limit page size to setting can be found here as well.
For instance, if you forget how to open a new console, press Ctrl+Shift+A, type open new console
and press Enter.
Search everywhere is another useful feature that makes it possible to look for any item in databases, files, actions, elements of the user interface, settings, and so on. In the following animation, when you type actor
, you see not only database objects, but also available actions (for example, Refactor This). The refactoring can be performed from the list with your search results.
Define the scope of Everywhere with the gear icon.