All IntelliJ-based IDEs are getting closer to the 2017.2 release. Here is DataGrip 2017.2 RC. Let’s have a look at what has been added since the latest EAP.
Integration with restore tools for PostgreSQL and MySQL
In 2017.1 we integrated DataGrip with mysqldump and pg_dump, so it’s logical to add integration with the restore tools of these databases as well. Now they can be accessed from the context menu. If there’s only one tool available, this option will look like ‘Restore with pg_dump’, etc.
In the case of PostgreSQL, the restore operation can be done with pg_dump or psql: there is a chooser in the Restore dialog:
And it looks like this in MySQL:
Automatic scrolling from a result-set
If you switch result-sets, the corresponding consoles are switched as well.
Database objects in bookmarks
Press F11 (F3 for OSX) to add any database object to Bookmarks. Then you can find all your Bookmarks via Shift+F11 (Cmd+F3) and then navigate to the object source by pressing F4.
Remember that the active DataGrip subscription is required for the RC build. And don’t miss the blog post about all new features in this release!
In this build, you’re going to meet the Transaction Control feature that replaced the Auto-commit option.
First, define what kind of transaction control you want to use when working with a particular data source. This option is available in data source properties. In the Auto mode you don’t need to commit any transactions executing the commit statement., while in the Manual mode, you, obviously need to do this.
This also can be defined for each query console along with the isolation level.
The behavior of the data editor has also changed for the Manual mode. We’ve added two new buttons to the toolbar: Commit and Rollback. The Revert button is moved to the context menu. So, now it works like this:
Auto and Manual mode
Submit button or Ctrl/Cmd+Enter → submits your data, which means that your local changes (they are highlighted) are submitted to the database. If you are in the Manual mode this transaction is not committed.
Revert Selected from the context menu or Ctrl/Cmd+Alt+Z (it used to be Ctrl+Z, but Revert isn’t Undo, right?) on selected rows → reverts unsubmitted local changes of the selected rows.
Only in Manual mode
Commit button or Shift+Ctrl+Alt+Enter → Commits the transaction. If you have unsubmitted local changes (again, they are highlighted) they will be automatically submitted before the commit.
Rollback button → Rollbacks transaction if it’s uncommitted.
We have divided the Data and DDL tabs when viewing a table. Actually, there are no more tabs. Now, when you open a table by a double-click, you just see data. Where is DDL? It can be opened by Edit Source on the toolbar or by Ctrl/Cmd+B.
The same DDL editor will open when pressing Ctrl/Cmd+B on the table name in the SQL script. As you may remember, Ctrl/Cmd+click does the same. In the previous versions this action was bringing you to the database tree. If you still need this, press Alt+F1 on any object and choose Database view.
It became easier to open Data editor for a table. Just click F4 on the table name, either in the database tree or in SQL.
And another small enhancement: when you execute a query with subqueries, the outer statement is selected in the drop-down by default. Well, nested statements are often just cannot be executed at all.
A small update for the current version. The most important fixes:
DBE-2771 — Important fix with “column reference is ambiguous” for Postgres EDB users. DBE-4753 — “Invalidate Caches/Restart” is enabled in the Find action menu. DBE-4733 — Empty rows are removed from the console output tab.
We hosted our very first webinar on Wednesday, July 14th. Thanks to all who joined us and especially those who asked questions. We hope it all was useful for you and your feedback on the webinar is very welcome!
Here is the recording. Let me briefly describe what we talked about.
DataGrip is a standalone IDE for SQL based on IntelliJ Platform. All of DataGrip’s features are also available in other IDEs from JetBrains like IntelliJ IDEA, PhpStorm, PyCharm, RubyMine, as well as the upcoming Rider and Gogland. DataGrip supports the most popular databases, and will add support for Amazon Redshift and Microsoft Azure this July.
To surround one query with another, or to make a common table expression, use the Surround With action by Cmd/Ctrl+Alt+T. Func(exp) means that the caret will be placed before the parentheses, not after.
DataGrip lets you define what particular query you wish to execute after pressing Cmd/Ctrl+Enter: only a subquery, the whole statement where the caret is, or the whole script.
If you have two result-sets, they can be compared in Diff Viewer.
The grid is editable: when you observe table data, you can apply any changes just like you would in Excel. All your changes are stored locally and can be submitted at once. Local changes are colored, so you can see which changes you are going to save, be it updating, inserting or deleting rows. Submit with Ctrl+Enter. Ctrl+Z is for reverting, but works in a tricky way — only the currently selected changes are canceled. If you wish to cancel all changes, select all cells with Ctrl+A before using Ctrl+Z.
Several fields can be edited at once — just select them and begin typing. Of course, it works only if the columns you are editing are not unique and have the same type. Copy and paste works here as well.
Use foreign keys navigation to see referencing data. For example, when you press Cmd+Down/F4 on the actor_id field with some particular value, you see the list of referencing tables. In our case it was only the film_actor table. Choose ‘referencing rows only’ and see the rows with actor_id = 6. Obviously, it’s just the list of films where the actor with id = 6 took part in. And again, pressing Cmd+Down/F4 on any row can bring you to this film’s row in the film table.
The Transpose view option lets you, surprisingly, transpose data! In other words, it flips your table: rows become columns and vice versa.
Any result-set or data can be extracted in many ways. The most obvious one is the CSV format. Just choose the extractor and then extract the data to the file or to the clipboard. Extracting to the clipboard is also mapped for the Copy action (Cmd/Ctrl+C), and this is what we use for the demonstration.
Paste your CSV data anywhere you want to. We used a scratch file – a temporary file which can be created at any moment just from the IDE.
There are several text formats to export data in, including JSON, HTML, and XML. You can even create your own format with Groovy. Existing extractors can be found in Files (Cmd/Ctrl+2) → Scratches → Extensions → DataGrip → data → extractors.
Here are a couple of useful extractors: SQL Updates and SQL Inserts. You data will be presented as a batch of SQL statements. We showed a couple features which can help when you edit a batch of INSERT statements. First, ‘Edit as Table’ — select all statements you need to edit and choose this option from the context menu. Then, in a temporary table, edit the values you’re going to insert.
Another way to edit several statements at once is multiple cursors. The easiest way to place them is to press Alt/Ctrl twice, hold it and press the Up or Down arrow keys.
You can navigate to the declaration of any resolved symbol with Cmd/Ctrl+Click, whether it is located in your SQL code or in the database.
Navigate to a database object (like a table, procedure and so on) by pressing Cmd+O/Ctrl+N. If it is a table, a table editor will open. Cmd+Shift+O/Ctrl+Shift+N will bring you to any file.
Ctrl+F will find text in the editor, which is trivial. What’s not trivial is that Ctrl/Cmd+Space will invoke the code completion based on the words in the corresponding file!
Ctrl+F in the data editor helps you quickly find data inside a table, without writing a statement. 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.
A small tip for searching for columns in any result-set or table: Open Structure view with Ctrl+F12 and start typing! Speed search saves you again and filters the columns based on what you’ve typed. Press Enter to navigate to a particular column.
When you get an SQL query from another application, it can be parameterized. DataGrip supports running this kind of queries. The UI for editing parameter patterns is available in Settings/Preferences → Database → User Parameters. Regular expressions are highlighted and you can choose in what dialect these patterns are valid.
That wrapped up the main part of the webinar.
Questions and answers
(the most interesting ones)
Q: Do you plan to support Hive or Impala?
A: DataGrip can connect to any database which has a JDBC-driver. It means that you can connect to Hive or Impala, see tables and other objects, and run queries. Special features of these kind of database are not supported and their syntax is not correctly highlighted. There is an issue in our tracker about adding the possibility to define custom dialects in DataGrip.
Q: What about version control systems?
A: DataGrip supports Version Control Systems like Git, SVN, Mercurial and some others. But this support doesn’t come out of the box: you need to install a JetBrains plugin for it. Go to Settings → Plugins → Browse repositories and search for the plugin you need. This plugin will bring first-class support for any VCS you need.
Q: Do you plan to add more management tools?
A: Not any time soon. We are focusing on developers for now, but we will consider adding administration support later.
Q: Is there a way to share data sources from DataGrip to other IDEs?
A: Select the data sources you want to share and then go to context menu → Database Tools → Copy Settings.
Press + to add a new datasource and choose Import from Clipboard. During the webinar I said that this feature would be coming in the new version, but it’s also available in 2017.1.4 as long as datasource information is already copied to the clipboard.
It didn’t work during the webinar only because I didn’t actually press Copy Settings.
Q: Is it possible to record DDL and DML actions?
A: We are thinking about logging all queries coming from DataGrip. The only thing we offer now is the Modify Table window, where all your changes to the table are reflected in the generated script.
Q: Can users configure the CSV format and use the custom delimiter?
A: Sure, simply choose Configure CSV formats… from the extractors drop-down.
Q: Is there a way to load CSV files to the database?
A: There are several ways to do that. The most common is to choose ‘Import data from file’ from the context menu of your database or schema. Or, you can just drag and drop your CSV file to the appropriate place in your database.
Q: What about data visualization, like graphs or pie-charts?
A: Sorry, there is no data visualization in DataGrip.
Q: Can we compare result-sets from different data sources?
A: Yes, you can.
That’s it! Thank you for your time, and if you’d like to have a webinar on a particular topic, let us know!
Hello! A new build of DataGrip 2017.2 EAP is available. It brings a small but a called-for feature: a notification is now displayed when a large query is finished. To disable it, in Settings look for the “Database queries that took much time” notification. It appears if it took more than 20 seconds to execute a statement.
We improved the introspection for Amazon Redshift which is now incremental. This means that only modified objects will be refreshed in a database tree after any operation instead of all objects.
Also, generation of DDL scripts for tables and functions has been enhanced.
Now DDL for tables contains the following attribute:
Hello! We’re opening the Early Access Program for DataGrip 2017.2 so you can try new features before the next official release. In this cycle there are many that we really need your feedback on during the development process. See for yourself:
Database сloud services are growing more popular with every day. We were asked to add support for these two, especially Redshift, and here they are.
Microsoft Azure is nearly the same as SQL Server, so we just added a dedicated driver and UI for adding the data source.
But with Amazon Redshift, we started to support specific cases in SQL grammar which are different from PostgreSQL. For example, UNLOAD statement is not only highlighted correctly, but has an SQL-injection inside.
In general, this means that if some part of your Redshift code is highlighted as an error but in fact isn’t, we consider it as a bug. Please report such cases to our issue tracker.
If you’re already using Azure and Redshift via SQL Server and PostgreSQL drivers, please re-select the driver in the data source properties window:
Several databases in one PostgreSQL data source
This was a really long-expected feature, but the wait is finally over. Thanks for bearing with us! We refactored a lot of code to implement this functionality, so some things can still be missing. Please give us feedback on your experience using data sources with multiple databases.
Data sources with several databases are also supported for Amazon Redshift, Microsoft Azure, and any unsupported databases whose drivers report about several databases.
This will help you see data without writing a query to the console.
On other IntelliJ-based IDEs, Ctrl+Alt+F8 on an object gives you quick evaluation. In DataGrip, invoke it on a table in a query to see the data of that table.
Ctrl+Alt+F8 on a column name will show the values of that column in the expected result-set.
If you invoke the same quick evaluate on the keyword of a query (or subquery), the pop-up will show you the result. Note that Alt+Click also works for this.
Press Alt+F8 to open an Evaluate pop-up, where any query can be run. If invoked on a table, it will show the data.
You can evaluate expressions here as well.
There is a new action for any file called Attach console. You can find via Ctrl+Shift+A or by opening the context menu for a file. After performing this action, this file can be run against the console. Switching consoles will be useful if you want to run the same script in several data sources.
Many of you have asked for result-sets to be switched along with the corresponding consoles. Done!
Schema switcher works in MySQL even with a read-only connection.
Objects are resolved by their OID values in PostgreSQL.
Sequences are resolved in scripts as well.
— Fixed bug with renaming schemas.
— Fixed bug with renaming sequences in PostgreSQL.
— You can now pause file indexing when you need to free the CPU for other tasks, and then resume it when appropriate.
— We added per-monitor DPI support for Windows. Font settings are automatically adjusted based on the display resolution.
Hi! We have a small update for DataGrip 2017.1, with a few fixes that will be important for some of you:
DBE-4570 – Trigger editor works properly now. DBE-4282 – Fixed bug with wrong column order in MySQL. DBE-2338 – Introspection in Sybase became faster. Thanks to Ian Moult for offering a better query to run!
The most important fixes in this update are:
– DBE-4387 – The bug with enrcypt() values for INSERT in PostgreSQL is fixed.
– DBE-4467 – Broken code generation for not officially supported databases is fixed.
– DBE-4444 – Cursor loop statements in procedures are now supported.
There are several ways to update your version of DataGrip: using the Check For Updates… menu or by downloading the new version from our web site; however, the most convenient way to keep your IDEs from JetBrains updated is Toolbox App!
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 supports abbreviations. For instance, ‘fa‘ is enough to find ‘film_actor‘.
Navigate to any database object with Ctrl+N (Alt+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), while F4 will switch you to the object in the database tree.
Same goes for functions or procedures: press Enter to edit the source code, or F4 to jump to the location in the database tree.
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!