DataGrip 2017.3 EAP 4

This EAP build doesn’t bring you any important new features, but it does include some major bug-fixes:

— IDE doesn’t freeze while building database diagram
— Fixes in SSH support: DBE-5434, DBE-5409, IDEA-181525

DataGrip team

Posted in Uncategorized | Leave a comment

Export data in any way with IntelliJ-based IDEs

In DataGrip, or any other JetBrains IDE featuring database support, there is a powerful engine to export data in many formats. You can even create your own export format.

ExportSq1

Let’s look closer at this engine.

Export directions

Any table/view or result-set can be exported to a file or copied to the clipboard.

To export to file:
      — Context menu on a table/view and → Dump data to file.
      — Context menu on a query and → Execute to file.
      — In the toolbar of the result-set or data editor, select Dump data button → To File…

DumpToFile

To export to clipboard:

      — Select the data you need within a result-set or data editor and press Copy or Ctrl/Cmd+C.
      — In the toolbar of a result-set or data editor, select Dump data button → To Clipboard

Default extractors

We’ll talk about copying data to the clipboard from the data editor, but the same applies to other described ways to export data.

Look to the left of the Dump data button for a drop-down where you can choose the extractor — the format to export data in.

ChooseSQLInserts

There are several built-in formats as you can see. Some of them let you export data as a set of INSERT/UPDATE statements, while others export data as text such as CSV, JSON, HTML, etc. For more details on how they work, please visit this page.

Still, users may need to extract data in many different ways.

Twitter

Creating a DSV-based extractor

Let’s see how we can extend the default functionality.

To create your own format based on CSV (or any DSV format), select Configure CSV formats…

ConfigureDSV

In this dialog, in addition to changing the existing CSV and TSV extractors, you can create your own. For example, Confluence Wiki Markup.

ConfluenceWikiMarkup

Once created, it appears among the other extractors.

ConfluenceWikiMarkuipInMenu

Creating any text extractor with scripting

For the more complicated cases, consider using scripting extractors. Several of them are already there such as CSV-Groovy.csv.groovy, HTML-Groove.html.groovy, and others. These scripts are written in Groovy, but they can also be written in JavaScript. Our examples use Groovy.

Looking closely at the file name, CSV-Groovy.csv.groovy:

      CSV-Groovy is just the name of the script;
      csv is the extension of the result file if you extract to file;
      groovy is the extension of the script itself. It helps IntelliJ IDEA highlight your code if that’s where you create/edit your scripts.

Scripts are usually located in Scratches and Consoles/Extensions/Database Tools and SQL/data/extractors. Or you can select Go to scripts directory in the extractor menu to navigate there.

ChooseGoToSCriptsDirewctory

You should edit an existing extractor or just add your own to this folder.

Let’s create an extractor which will dump your data to CSV format, but to just one row. It can be useful if you are going to paste these values into an IN operator in a WHERE clause.

Here is the diff view of two scripts: the existing CSV-Groovy.csv.groovy and our new one which we’ll name CSV-ToOneRow-Groovy.csv.groovy.

ScriptsDif

Note the available context bindings:

These objects are equal when dumping the whole page to file.

Where:

 

DasTable has two important methods:

Before v2017.3

Since v2017.3

 

Additional information about the API can be found here.

When you create or edit Groovy scripts in IntelliJ IDEA, and have Groovy installed, coding assistance is available.

CodingAssistance

Once the new script file is in the folder, you can use the extractor!

ChooseCSVGToOneRow

Copy these values and paste them into the query.

ToOneRowSQL

Here’s another example based on SQL-Insert-Statements.sql.groovy. MySQL and PostgreSQL allow using multi-row syntax. To use this type of extractor, create a new SQL-Inserts-MultirowSynthax.sql.groovy file in the scripting folder.

SQLInsertsMultiRowExtractor

Again, simply select it in the menu.

ChooseSQLMultiRow
The result:

InserMultiRowSQL

There are already some user-generated extractors on GitHub which everybody can use:

Extractor to copy tab separated query results to paste into Excel with comma decimal separator.
DBunit XML.
Txt-file with fixed length columns. (Here’s a very similar one).
Php array.
Markdown.

We hope this tutorial will help you tweak DataGrip to your specific needs and encourage you to share extractors for all to use.

The DataGrip Team

Posted in Features, Tutorial, Uncategorized | 2 Comments

DataGrip 2017.3 EAP 3

Hi there! In this post, I’ll tell you all about what our team has been up to and what the latest EAP build has in store for DataGrip 2017.3.

SQL generator

Press Ctrl/Cmd+Alt+G or choose Context menu → SQL Scripts → SQL Generator… and get the generated DDL of any object (table, schema, procedure, whatever) or even several objects simultaneously.

SQL-Generator

Paste multiple rows from an external source

We were asked to implement pasting from Excel tables. Generally to do this, it means that we need the ability to paste data in DSV format. In DataGrip you can define any format or you can let the IDE detect the format automatically.

PasteDetect

That’s how it works now.

PasteTSV

SSH tunneling

SSH

From this build DataGrip supports:

— Reading OpenSSH config files (~/.ssh/config и /etc/ssh/ssh_config).
— Showing dialogue for One Time Password.
— Using Ssh-agent and Pageant in authentification.

P.S. And for those who use DataGrip with Exasol, we added Exasol 5 support!

That’s all for today. Take DataGrip 2017.3 EAP for a spin!

Your DataGrip Team

 

Posted in 2017.3, EAP, Uncategorized | 9 Comments

DataGrip 2017.3 EAP 2

Hi there! Meet the new DataGrip 2107.3 EAP build.

Database view

Closing a ticket with a number less than 100 is not something that frequently happens. Especially when it’s a long-awaited feature. We are happy to introduce our new feature: group data sources. Press F6 or choose Move to group… from the context menu.
Groups

Users and roles are now displayed in PostgreSQL and AWS Redshift.
UsersRoles

Foreign Data Wrappers and as a consequence, foreign tables, are now displayed in PostgreSQL.
ForeignData

 

References navigation

In one of the minor updates to 2017.2 we introduced a new flow for navigation. To cover all the use-cases, and for those who are used to the previous versions, in 2017.3 we added the option Navigate references to DDL editor.

NavigateToDDL

With the Auto-scroll from Editor option you can get several types of behavior by pressing Navigate to declaration (Ctrl/Cmd+B or Ctrl/Cmd + Click)

AutoScrollToEditor

Navigate references to DDL editor On
Auto-scroll from Editor On
You’ll be taken to the DDL of the objects, the objects will be highlighted in the Database View. Focus in the Editor.

Navigate references to DDL editor On
Auto-scroll from Editor Off
You’ll be taken to the DDL of the object, nothing will be highlighted in the Database View. Focus in the Editor.

Navigate references to DDL editor Off
“Old” behavior. The object will be highlighted in Database View, the Editor tab will remain as it is. Focus in the Database View.

 

Compare cells

Values of two or three cells can be compared in Diff Viewer. Select them and press Shift+Ctrl/Cmd+D

CellDiff

PostgreSQL 10 grammar support

Postgres10

If you are already using PostgreSQL 10 and see any incorrect code highlighting, please report it to us.

Other enhancements

Adding support for automatic Regexp detection in regexp_replace function, we added automatic detection of Regexp, JSON, XML and XPath to many functions and operators in various databases. To use XPath injection, please, install XPath view + XSLT Support plugin. View all of the new injections in Settings → Editor → Language injections.

Synchronization of your settings across devices.

Better PIVOT support.

— Expand column list deals well with table aliases.

That’s it! Your feedback is welcome on our twitter, forum and the issue tracker.

Your DataGrip Team

Posted in 2017.3, EAP, Uncategorized | Leave a comment

We open DataGrip 2017.3 EAP

Hello! There is a long tradition of letting you try out our new product features before the official release, so welcome DataGrip 2107.3 Early Access Program.

EAP_DataGrip_20173EAP@2x_splash

This version improves the workflow with consoles and files, adds new Execute actions and introduces right alignment of numbers. Let’s take a closer look at the new features:

Ability to choose a console

The context menu in the data source was upgraded. Choose Jump to Console and you’ll now have a menu which allows you to quickly switch between consoles which were created already.

EAP_JumpToConsole

The same options will appear when attaching the console to a file.

EAP_AttachConsole

Several Execute actions

There was only one Execute action before; now there are three of them. Change the behavior, and assign shortcuts: they are completely independent. For example, you can create an action which will execute the whole script, without having to choose the exact query from the script.

EAP_ExecuteActions

JOIN statement completion

It became even smarter! Now it offers you the variant with the complete clause.

EAP_JoinCompletion

Right-side alignment of numerical data

For better readability, now DataGrip aligns the numerical data in the table editor with the right hand side of the column.

EAP_Align

Choosing schemas

We moved Schemas… node from the database tree, now use Context menu → Database tools → Manage selected schemas or simply press Alt+Enter on the data source.

EAP_schemas

DataGrip now prompts you to choose a database/schema along with a data source when you try to run an SQL file from the context menu.

EAP_SchemasInRun

And there is a small improvement for those who didn’t like to use the mouse to choose the schema of the console or the search path.

EAP_ShortcutForChooser

Now there is an action called Set Current Schema. You can assign a shortcut or invoke it from Find Action (Cmd/Ctrl+Shift+A).

EAP_SetCurSChema

Support for Exasol

We added the support for Exasol database, thanks to authors for their help! And we’ll be happy to hear the feedback from those, who use Exasol.

EAP_Exasol

Other enhancements
– Time is always displayed in UTC.
– Generate DDL on tables node doesn’t include views anymore.
– DDL generation for tables is better.
– DDL generation in MySQL works with escaped quotation marks. But the fix can raise performance problems. See details.
– All attributes (except obj_file and ink_symbol) are generated in the function DDL for PostgreSQL.

That’s it! Your feedback is welcome in our twitter, forum and the issue tracker.

Your DataGrip Team

Posted in 2017.3, EAP, Uncategorized | 4 Comments

Meet DataGrip team in USA this September

dg_meet_us_800x418_twitter_card_5

Hello! This September a couple of folks from DataGrip team will take part in several events in the United States. Maksim Sobolevskiy (Product Marketing Manager) and Vasiliy Chernov (QA Engineer) will give a DataGrip tips’n’tricks talk at various meetups and will be running a booth at SQL Saturday conference in Spartanburg.

Sep 13th, 17:30, New York. SQL Training wheels user group.
https://www.meetup.com/SQL-Training-Wheels/events/242799854/

Sep, 19th, 18:00, Austin.  Meetup hosted by TableauHelp and data.world.
http://tableauhelp.com/event/event09192017-datagrip/

Sep. 22nd, 12:00, Atlanta. PHP user group Special JetBrains Event.
https://www.meetup.com/atlantaphp/events/243171976/

Sep 23rd, Spartanburg. SQL Saturday. Meet us at the booth all through the day!
http://www.sqlsaturday.com/681/eventhome.aspx

Sep, 25th, 18:00, Chicago. PostgreSQL Meetup.
https://www.meetup.com/Chicago-PostgreSQL-User-Group/events/242887113/

We kindly ask you to register for the events — it will help both the organizers and us. At every event you’ll have a chance to grab some swag and 20% discount coupons for DataGrip!

See you in the States!

DataGrip team.

Posted in Uncategorized | Leave a comment

DataGrip 2017.2.2

This is a new minor update for DataGrip 2017.2.

There are many important fixes in this build:

— Export options are enabled again, but some issues persist, so we don’t close this issue.
— Custom dialect data sources are visible in the Run against list.
— Many people complained about UI freezing, we investigated this and fixed bugs raising the problem.
— Editing data in DB2 is back.
— Stored procedures code is generated correctly in SQL Server.

See all fixes in 2017.2.2.

DataGrip team.

Posted in Uncategorized | 4 Comments

DataGrip 2017.2.1: Improved navigation

Hello! The first update for DataGrip 2017.2 is rather important.

In this release cycle, we are focused on improving navigation. As we wrote in our release blog-post, we divided Data and DDL tabs in the table data editor. There was a problem (well, our fault) that Edit Source wasn’t very visible on the toolbar and it was the only way to see the DDL of the table.

We added several enhancements:

— To see DDL of any database object go to Context menu → DDL and sources → Source editor.

SourceEditorFromCM

— Use Cmd/Ctrl+Alt+B to switch between table’s Data and table’s DDL. It works in both directions. Also, there is the DDL button in the data editor toolbar

DDLInDataEditor

And the Data Editor button in the DDL editor.

DataFRomDDL

— A new action is introduced called Select in the database view. Now there is no UI shortcut, but you can invoke it by Ctrl+Shift+A or define your own shortcut. Remember, that the same can be done in a more general way: press Alt+F1 on any object and choose Database view.

Sidv

We continue working on that. If we still don’t cover your use case, please describe it in the comments.

Other fixes:

— Dump actions now work on files with attached console.
— DBE-4505 No wrong rounding in Oracle during import.
DBE-4902 More… link now works in Quick Evaluate.
— DBE-4953 Scrolling works in the database switcher for PostgreSQL.

DataGrip team
JetBrains

Posted in Uncategorized | 6 Comments

DataGrip 2017.2 Released!

DataGrip 2017.2 Released!

Hello!

Please give a warm welcome to our new release, DataGrip 2017.2.

DataGrip_20172_splash

We thank all of the EAPers who have helped us by testing all the new features we added in this release. Let’s have a look at them.

– Amazon Redshift and Microsoft Azure support
– Several databases in one PostgreSQL data source
– Transaction Control
– Evaluate expression
– Table DDL
– Integration with restore tools for PostgreSQL and MySQL
– Executing queries
– Coding assistance
– Other

Amazon Redshift and Microsoft Azure support

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.

NewSupportedDatabases

Microsoft Azure is similar to SQL Server, so we just added a dedicated driver, UI for adding the data source and some enhancements in the introspection.

But there are many things we did for Amazon Redshift.  The introspection is now incremental. This means that only modified objects will be refreshed in a database tree after any operation instead of all objects.

Also, 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.

Unload

Another example: support for embedded Redshift functions that are absent in PostgreSQL.

RedshiftFunctions

Generation of the DDL scripts for tables and functions has been enhanced.

Now DDL for tables contains the following attribute:

column_attributes:

and table_attributes:

The source code of a function is now generated with the following section:

In general, our support means, that if a part of your Redshift code is highlighted as an error but in fact it isn’t, we consider this 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:

ChangeDriver

Several databases in one PostgreSQL data source

This was a really long-awaited 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 might still be missing. Please give us your feedback on your experience using data sources with multiple databases.

SeveralDatabasesForPostgres

Data sources with several databases are also supported for Amazon Redshift, Microsoft Azure, and any unsupported databases whose drivers report several databases.

Transaction Control

Transaction Control feature 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.

DataSourceProperties

This also can be defined for each query console along with the isolation level.

IsolationLevel

The data editor in the Manual mode also has Commit and Rollback buttons on toolbar. All actions are also available in the context menu.

CommitInDataEditor

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 → rolls back transaction if it’s uncommitted.

Evaluate expression

This will help you see data without writing a query to the console.

In 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.

QuickEvaluateTable

Ctrl+Alt+F8 on a column name will show the values of that column in the expected result-set.

QuickEvaluatecolumn

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.

EvaluateAltGif

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.

EvaluateTable

You can evaluate expressions here as well.

Table DDL

We have divided the Data and DDL tabs when viewing a table. Actually, there are no more tabs. Now, when you open a table with a double-click, you just see data. Where is the DDL? It can be opened by Edit Source on the toolbar or by Ctrl/Cmd+B.

Edit-source

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  brought 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.

CtrlBF4

Integration with restore tools for PostgreSQL and MySQL

In 2016.3 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_restore’, etc.

RestoreMenu

In the case of PostgreSQL, the restore operation can be done with pg_dump or psql: there is a chooser in the Restore dialog:

pg_restore

Psql

And it looks like this in MySQL:

mysqlrestore

Executing queries

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.

AttachConsole

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.

Notification

Many of you have asked for result-sets to be switched along with the corresponding consoles. Done!

SwtichResult-sets_preview

The same works in the opposite direction.

ScrollFromResult-set

These behaviors are on by default, look for the “Autoscroll ..” toggles in the gear-icon menu of the Database Console tool window.

AutoSCrollOff

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 often just cannot be executed at all.

Subqueries

Schema switcher works in MySQL even with a read-only connection.

MySQLSwitcher

Coding assistance

Completion now works for columns in table-valued functions.

TableValued

NEW and OLD references are resolved in PostgreSQL triggers.

NEWOLD

We’ve added support for MERGE statements for all databases where they are available.

Merge

Objects are resolved by their OID values in PostgreSQL.

OIDs

Sequences are resolved in scripts as well.

Sequence-1

Other

New features:

— Database objects can be added to Bookmarks.
— 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.
— Lines with two identical results are merged in Find in Path.
— Support for non-int-literal expressions in TABLESAMPLE and ALTER FOREIGN TABLE in Postgres.
— Support for ‘json_table’ function in Oracle.

Important fixes:

DBE-4600 with renaming schemas.
DBE-1288 with renaming sequences in PostgreSQL.
DBE-4507 in composite primary key editing.
DBE-4637 about a wrong error message in queries with GROUP BY.
— Faster data editor scrolling

Get your 30-day trial of DataGrip here.

That’s it! Don’t forget about twitterforum, and the issue tracker.

Your DataGrip Team
_
JetBrains
The Drive to Develop

Posted in Uncategorized | 29 Comments

DataGrip 2017.2 RC is Out!

Hello!

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.

RestoreMenu

In the case of PostgreSQL, the restore operation can be done with pg_dump or psql: there is a chooser in the Restore dialog:

pg_restore

Psql

And it looks like this in MySQL:

mysqlrestore

Automatic scrolling from a result-set

If you switch result-sets, the corresponding consoles are switched as well.

ScrollFromResult-set

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.

Bookmarks

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!

DataGrip team.

Posted in Uncategorized | 2 Comments