We open EAP for DataGrip 2018.1

Yes, it has finally happened! :) We hope that in the next month you’ll use our early builds and share your feedback with us. As usual, our issue tracker, twitter and forum are open for you.

Let’s have a look at the goodies inside this EAP.

Data editor SQL log

Now, while updating data you can see which particular queries DataGrip is running. We have nothing to hide!

SQLLog

Connectivity and introspection

Now you can tell DataGrip how to switch schemas. The following settings are available:

Automatic: DataGrip can switch schemas during internal operations when defining the context. This is the default behavior for all databases except PostgreSQL.
Manual: DataGrip cannot switch schemas during internal operations when defining the context. However, you can switch them manually via the switcher in the top-right corner. This is the default behavior for PostgreSQL: if you work with pg_bouncer, no more wildcat switches!
Disabled: Note that manual switching is also disabled in this mode.

SwitchSchema

We’ve added MariaDB to our list of supported databases.

MariaDB

DataGrip now supports external schemas in Redshift and virtual schemas in Exasol.

ExtrenalObjects

Events in MySQL are shown in the database tree. Source code generation is also available. Icons will be delivered soon :)

Events

SQL editor

Now DataGrip lets you navigate to the next or previous identifier occurrence by using two shortcuts, Alt + Wheel down and Alt + Wheel up. (Or enter ‘highlighted element usage’ in Find Action.) Before, you could only navigate to the next text occurrence. It should be noted that text occurrence and reference are not always the same.

GoToUsage

Another new action in DataGrip is Move element left or right. This works for different kind of lists including parameters inside functions, fields in INSERT statement, and the column list. Note that it doesn’t spoil the comma while working with the column list, while Move Line surely would.

MoveElements

Completion for file references now works for Oracle and Exasol.

FileCompletion

SQLite commands used to spoil highlighting. No more.

SQLiteCommands

Common table expressions are supported in MySQL.

CTE

Navigation
We’ve merged two navigation actions: Go to class and Go to table.

EnterCalssName
In DataGrip, you can now navigate to classes if you use any of the other supported languages.
In other JetBrains IDEs, you can finally see database objects here like tables, stored procedures, etc.

IntelliJ Platform enhancements
— In the Replace in Path window, the IDE now provides an ability to preview a regex replacement.
— Now, the Search Everywhere pop-up receives focus (IDEA-124160).
— When you search through the current file, the IDE now highlights folded code regions if they contain the matching occurrences.

That’s about it! Thank you in advance for taking these EAP builds for a spin. Do let us know what you think!
Your DataGrip Team

Posted in Uncategorized | 1 Comment

DataGrip 2017.3.5

Hello! Here is the new bug-fix update for 2017.3.

There is even a new feature in the release: object filter. Define which objects you want to see in the database tree.

Filter

The most important bug-fixes are:

— Code completion respects number input: DBE-4965
— Paste from CSV format is now correctly detected
— New types of fields are available for editing in PostgreSQL: point, polygon, line, lseg, box, path, circle, pg_lsn, tsquery, tsvector

Posted in Uncategorized | Leave a comment

Generate simple classes from database objects in DataGrip

twitter_post_feb_2018_blog

DataGrip lets you run scripts against the selected schema objects. For example, you can generate Java classes from tables or, if you want, classes in any other language: C#, Python, etc. You can alter or extend the default functionality, for instance, generate an HTML or Markdown report.

Out of the box, DataGrip can generate Java classes. To do this, go to the context menu of a table (or several tables) and press Scripted Extension → Generate POJO.groovy.

ContextMenu

Choose a destination folder, and that’s it! The class-file is ready.

ScriptItself

Generate POJO.groovy is just a script written in Groovy. It means that you can modify it and create a new script based on it, for example, for generating classes for other languages. From the same context menu, click on Go to scripts directory to see where this file is placed.

ActorJava

You can edit the existing one or create new scripts. Just place your new script into this folder, and it’ll be available from the context menu.

Some examples from our users:
Improvement of default script: comment support and replacing underscores in names.
POJO Generators for Entity
Generator of classes for Kotlin Squash
Export structure as markdown into the clipboard

Groovy is not the only language you can use, JavaScript is also available.

Before we also had Clojure engine and some people used it for scripting. For instance, here is the script for generating C# classes. If you strongly wish to use Clojure for scripting, please download Clojure runtime and scripting engine files here and place them in the lib folder inside the installed DataGrip folder.

We hope this post helps, feel free to ask questions if any.

Posted in Uncategorized | 5 Comments

DataGrip 2017.3.4

Here is the first bug-fix update this year. Many issues have been fixed, the most important of which are:

Collations are now placed after schemas in the database tree. If you want to hide them, put collation:-.*  into Data source properties → Options tab → Object filter.

Colations

DBE-5703: А correct DDL statement is now generated when a PostgreSQL function with defaults is dropped.
DBE-5608: Amazon Redshift data source synchronization works now.
DBE-5404: The editor now recognizes the WITH NO SCHEMA BINDING syntax in Redshift.
DBE-2465FETCH ALL IN <cursor name> doesn’t return errors anymore.
DBE-5274: FOR EACH ROW WHEN in triggers shows the correct clause.
DBE-4983: SQL generator doesn’t add the ‘n’ character in new lines in Oracle anymore.

Fixed freezes:
DBE-2536: While introspecting schemas with many tables.
DBE-5532: After updating a function.

DataGrip team

Posted in Uncategorized | 15 Comments

DataGrip 2017.3.3

This update brings an important fix of  “Out of memory” problem: IDEA-183889

Posted in Uncategorized | 2 Comments

DataGrip 2017.3.2

Hello! This is another minor update for 2017.3. It brings several important bug-fixes:

DBE-5031 – Enum fields are now available for editing. Completion is not yet implemented.
DBE-5512 – Fixed bug with saving LOBs.
DBE-4426 – DataGrip now can connect to FrontBase. There are still some known issues with transactions.

DataGrip team

Posted in Uncategorized | 15 Comments

DataGrip 2017.3.1

Only a week has passed since we released DataGrip 2017.3, and we are already delivering you the first minor update. Among various bug-fixes there is something new to try!

IDE-level read-only mode

For ages DataGrip had a Read-Only mode that could be turned on in the data source properties.

image2

It just turned on read-only mode in the corresponding jdbc-driver. This denied running modification queries in MySQL, PostgreSQL, AWS Redshift, H2 and Derby. In other DBMS’s it did nothing.
In DataGrip 2017.3.1 we have added an IDE-level read-only mode. Now it is activated along with the jdbc-level one, the check-box turns on both. Thus, in read-only mode every DDL or DML query will be underlined.

image7

If you execute it, there will be a warning.

image5

Anyway, it is possible to press Execute on this bar if you’re totally confident in what you are doing.

We also now index the source codes of functions and procedures, and build a call-tree behind. It means that if a function executes another function (repeat n times) which executes DDL or DML statements, you’ll also see the warning.

image4
That’s it. Please, report to us if you have any need for two independent check-boxes for jdbc-level and IDE-level read-only modes.

Background images

If you set a background image via Preferences/Settings → Appearance → Background images, now there are new alignment options: center image, stretch image or make a texture. The very right square lets you to choose the anchor.

image6

Snap packages

DataGrip is now also available as a snap package. If you’re on Ubuntu 16.04 or later, you can install DataGrip from the command line:

sudo snap install datagrip --classic

Thank you for reading this, we hope you got a lot out of it!
Your DataGrip Team
_
JetBrains
The Drive to Develop


Posted in Uncategorized | Leave a comment

DataGrip 2017.3 is Released!

Please welcome DataGrip 2017.3, the third big update of 2017, packed with various enhancements. Let’s have a look what it has to offer!

Database tree view
SQL
Executing queries
Connectivity
Data editor
Navigation

Database tree view

Group data sources

Closing an old outstanding ticket with a number less than 100 is not a situation that we frequently find ourselves in; especially when it’s for such a long-awaited feature. We are happy to introduce you to our new feature: group data sources. Press F6 or choose Move to group… from the context menu.
01 — Groups

Group is the attribute of the data source. Now you cannot create an empty group and add existing data sources to it. Please, usе New group as shown on the screenshot.

Managing schemas

We replaced the Schemas… node in the database tree view with a lightweight hover option, which when used, will show the number of schemas currently displayed. Click on it to add or hide schemas.

02 — Hovers

It is also possible to use Context menu → Database tools → Manage selected schemas or you can simply press Alt+Enter on the data source.

New supported objects

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

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

Drag-and-drop multiple objects to the editor

Now you can drag-and-drop several objects from the database tree view to an editor.

06 — DragnDropColumns

Well, if you need all of them, then use the Expand wildcard with Alt+Enter, as it is definitely more suitable :)

SQL

It is now possible to use the SQL generator to generate DDL scripts with options. To do this, press Ctrl/Cmd+Alt+G or choose Context menu → SQL Scripts → SQL Generator… and get the generated DDL of any kind of object (table, schema, procedure, whatever) or even several objects simultaneously.

01 — SQL-Generator

The JOIN statement completion has become even smarter! It now offers you the variant with the complete clause.

02 — JoinCompletion

We have added PostgreSQL 10 grammar support.

03 — Postgres10

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

Executing queries

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

01 — SchemasInRun

Another similar enhancement we have made is that a list of data sources with related consoles will now appear when attaching the console to a file.

02 — AttachConsole

There was only one Execute action before; now there are three of them. Change the behavior, and assign shortcuts: they are all 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.

03 — ExecuteActions

There is a small improvement — made especially for those of you who don’t like to use a mouse — to be able to choose the schema of the console or the search path schema. Now there is an action called Set Current Schema. You can invoke it from Find Action (Cmd/Ctrl+Shift+A).

04 — SetCurSChema

Or just assign a shortcut! For example, Cmd/Ctrl+Up will enable you to switch the context for the query console.

05 — ChooseSchema

That shortcut is assigned to Show navigation bar by default in the platform, do you really use the Navigation bar? If yes, try Recent Files with Ctrl/Cmd+E.

Connectivity

Enhancements in SSH tunneling: this build of DataGrip supports:

— Reading OpenSSH config files (~/.ssh/config and /etc/ssh/ssh_config).
— Showing dialogue for a One Time Password.
— Using an SSH-agent and Pageant for authentication.

01 — SSH

Also, we added support for the Exasol database.

02 — Exasol

Data Editor

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

02 — PasteDetect

That’s how it works.

01 — PasteTSV

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

03 — Align

Before, DataGrip didn’t restore tabs after re-opening. It was inconsistent with our other IntelliJ-based IDEs and it was not so easy for people to adjust to. Performing many queries at the start is not the best idea, so now the tabs are restored, and you can load the data to the data editors manually.

04 — RestoreTabs

And the last enhancement in this section: values of two or three cells can be compared in the Diff Viewer. Select them and press Shift+Ctrl/Cmd+D

05 — CellDiff

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

01 — NavigateToDDL

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

01a — AutoScrollFromEditor

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
This will enable the “Old” behavior. The object will be highlighted in Database View; the Editor tab will remain as it is. Focus in the Database View.

The context menu in the data source has also been upgraded. Choose Jump to Console and you’ll now have a menu which you will be able to use to quickly switch between consoles which have already been created.

02 — JumpToConsole

DataGrip 2017.3 has the ability to replace the selected occurrences in the Replace In Path dialog.

04 — FindInPath

Scratches and Consoles are not found in a separate tab anymore; they are now placed in Files.

05 — Scratches

Other

Synchronize your settings across devices.
— Time is always displayed in UTC.
— Generating DDL on the tables node doesn’t include views anymore.
— DDL generation in MySQL works with escaped quotation marks. But the fix can improve performance problems. See details.
— All the attributes (except obj_file and ink_symbol) are generated in the function DDL for PostgreSQL.
Better PIVOT support.
— Expand column list deals well with table aliases.
— SQL extractors respect casing setting of the Code style
Ability to choose the current schema for custom database’s query console.

You already know all of this, but still:

— Get your 30-day trial of DataGrip here.
Tweet @ us!
Discuss anything in the forum.
— Report bugs to our issue tracker.

Thank you for your attention!
Your DataGrip Team
_

JetBrains
The Drive to Develop

Posted in 2017.3, Features, Releases | 11 Comments

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 | 4 Comments