In working with any tool it is important to easily find what you need. In DataGrip search:
– Database objects: tables, views, functions, columns, etc.
– The data itself.
– Code, for example a piece of code in the script or the source of the object.
– Other: settings, actions, files.
We’ll figure out how not to get lost in the IDE and its databases.
Any tree (as well as menus, lists, pop-ups) in the IDE on the IntelliJ platform supports a quick search: just type the name of what you need. Remember that an object will only be found if its node in the tree is opened.
The abbreviations work: ‘fa’ will find ‘film_actor’.
Navigate to the object of the database by Ctrl + N (Alt + O for OSX). Type the name or abbreviation of the database, schemas, tables, views, procedures in the field.
If you are looking for a table or view, Enter will open the data editor (with the DDL tab if you need the code), and F4 will show the object in the tree.
Same for functions and procedures: Enter will open the source in the editor, F4 will show the object in the tree.
A small trick for finding columns in a table or query result: open Structure view (Ctrl / Cmd + F12) and start typing. A quick search will filter out the required columns. Enter will move the focus to the desired column.
Text search (Ctrl / Cmd + F) works in tables and query results. Suitable if you do not know in which particular column the data you need.
The data will be searched only on the current page. The number of lines per page is specified in Settings → Database → Data views → Result page size. If you enter -1, all rows will be displayed at once. But this can affect the speed of query execution.
When viewing data in a table, write filter conditions in the text field from above, as if you write SQL in the WHERE clause.
In this field, you can insert the values automatically, from the context menu.
The search works in any editor. But not even everyone in JetBrains knows that there is an autocompletion 🙂 Called by Ctrl + Space and offers options from an open file.
In the settings, specify where to look for: include or exclude lines, comments. For all search results, you can put the multicursor: Ctrl + Alt + Shift + J (Ctrl + Cmd + G for OSX).
Searching by path searches for code in other consoles, files, and in the source of views, procedures, and functions.
In our example, if you select ‘In Project’, the code will only be found in the dump file attached to the project. But if you select ‘All scopes,’ the same piece will be found in the procedure of our database.
Find usages in the context menu of the object (or Alt + F7) will show its usage in queries, scripts or source codes of other objects. For example, the actor table is found in dump files, consoles, and several sources: it is used in rules and views.
Ctrl + Shift + N (Shift + Cmd + O for OSX) will open the file by name.
Quick search also works in the settings. To find Result page size, type it.
When you do not know how to do something, Find action (Ctrl + Shift + A) will help. Here you can search for settings, but most importantly, search here for any action in the IDE. Do not know how to open a new console? Write Open new console.
And when it’s absolutely unclear where to look, try ‘Search everywhere’. Database objects, actions, files, settings – all can be found here. For example, ‘actor’ showed not only objects from the database, but also the action ‘Refactor’, which can be performed directly from here.
The icon in the form of the gear will help determine where to look.