DataGrip 2019.1.2

Hi! This is the second update for DataGrip 2019.1.

Formatter

First and foremost, now the code style can be configured separately for different dialects.

CodeSTy

Please note, you can paste examples of your code to the preview panel on the right-hand side to check that the style you have configured formats the SQL correctly. More dialects come later.

Code insight

DBE-1837: Columns from outer queries are now highlighted.

Screenshot 2019-04-30 13.14.04

DBE-3778: Better support for aggregate functions. DataGrip will warn if you use them in the wrong place.

Screenshot 2019-04-30 13.47.50

DBE-5368: Unnecessary keywords for ORDER BY are highlighted

Screenshot 2019-04-30 13.49.49

Using the HAVING clause with no aggregates will also generate a warning

Screenshot 2019-04-30 14.05.28

Snowflake

We’re continuing to improve the Snowflake native introspection. Warehouses and stored procedures are now supported!

Important fixes

DBE-8217 [Cassandra] Support for lightweight transactions
DBE-8037 [MySQL] Support for JSON_TABLE()
DBE-8180 No more freezes when pasting big chunks of text

Posted in Uncategorized | Leave a comment

DataGrip 2019.1.1

Hi! This is the first update for DataGrip 2019.1. We’ve made some improvements regarding positional column references.

Column references are resolved in GROUP BY (before the resolve worked only in ORDER BY).

Screenshot 2019-04-25 16.32.11

If the column reference is unresolved, DataGrip will highlight it.

Screenshot 2019-04-24 16.44.28

By the way, unresolved references are now highlighted in red. This is consistent with all our IDEs. Red helps draw your attention to something that’s not normal, and generally, unresolved references are not normal! Have everything resolved makes navigation and code insight features work as they should.

We’ve also introduced a couple of intention actions:

  • Replace column number with a name
  • Replace column name with an ordinal number

IntentionRefs

It is also possible to set the timezone for the session.

Untitled-2

And a few other important fixes:

DBE-3024 The first version of the native introspection for Snowflake was introduced
DBE-2056 [SQLite]: ROWID is shown in the column list
DBE-3315 COUNT(*) works for queries with JOINs and GROUP BY
DBE-4533 Access to the last page of the query is not slow anymore

That does it. Cheers!

The DataGrip Team

Posted in Uncategorized | Leave a comment

DataGrip 2019.1

Hello everybody!

We are excited to release DataGrip 2019.1 today! As usual, we thank all our early adopters who have helped us make the IDE better during this release cycle.

image

If you wish to see the detailed overview of this update, please visit our What’s new page. Read on for a list of all the enhancements waiting for you in 2019.1.

Support for new databases

In this release cycle, we focused a lot on supporting several new databases.

Greenplum is an analytics database based on PostgreSQL. It is currently developed by Pivotal and the open source community.

Vertica is column-oriented storage designed to handle large volumes of data.

Apache Hive is a data warehouse built on top of Apache Hadoop for providing data query and analysis.

Snowflake is a cloud-based data-warehouse. In 2019.1 DataGrip supports only SQL dialect, the introspection support comes later.

ThreeGraces

Connectivity

— The connection dialog has a new look.
— Startup scripts.
— Keep-alive and auto-disconnect options.
— Now you can choose not to remember your password at all. (In previous versions, unselecting Remember password meant that it was remembered only until the next DatGrip restart.)
— Possibility to save password until you disconnect from the data source.
— Possibility to set an empty password.
— Separate section for DDL data sources in the connection dialog.
— DataGrip offers to download drivers after you click Test Connection.
Test Connections results are now inline.

Options

Navigation and search

— New Recent Locations popup.
— Better usability for Find in Path.
— All navigation actions work from the Go-to popup.

Recent

Code insight

— Code completion supports combined statements for CREATE and DROP, i.e. CREATE TABLE.
— New inspections: Illegal cursor state, Named arguments should be used, and Usages of GOTO statements.
— [MariaDB] Oracle mode support.

CompletionCreate

Working with files

— The Default Directory setting works.
Save console as… uses the default directory and respects the last choice.
Detach directory in the Files tool window.
— Files can be formatted from the context menu without opening them.

Detach

Database tree view

— [DB2] New objects are displayed in the database tree view: trigger, method, module, data type, variable, sequence, role, and others.
— The database tree view keeps the data source name at the top as you scroll.
— Logo icons are added for Firebird, Presto, Teradata, Snowflake, and Informix.
— Library of cutom icons.

DB2

Other

— Customizable IDE themes.
— The filter in the data editor suggests the current clipboard value.
— [MySQL] We’ve finally fixed the problem with NULL instead of the empty date for all connectors.
— [MySQL; MariaDB] Support for DEFINER attributes.
— [SQL Server] No more wrong COUNT() results.

ThemePurple

And more…

You already know all of this, but still:
— Get your 30-day trial of DataGrip.
— Tweet @ us!
— Discuss anything in the forum.
— Report bugs to our issue tracker.

Thanks for reading this!

Your DataGrip Team
_
JetBrains
The Drive to Develop

Posted in Features, Releases | Tagged | Leave a comment

DataGrip 2019.1 EAP 3

Let’s have a look at what’s new and improved in DataGrip 2019.1 EAP 3.

Connectivity

A new option in Save password: For Session. It will save your password until you disconnect from the data source.

PassSave

Test connection results are now inline and can be copied to the clipboard via a small dedicated button. The link to the troubleshooting page is also added.

TestConnectionRes

Find in path

DataGrip can search in source codes of the objects. This was available only if you chose the All Places scope. We’ve cleaned up this UI a little bit and removed the Module and Project tabs.

A new scope, Attached Directories, is available. Use it if you want to search through files in the Files tool window.

FindInPath

Go-to popup

All navigation actions now work from here.

FindTable_blog

For instance, if you’re searching for a table, see what you can open from right here:

Table’s DDL: Ctrl/Cmd+B.
Table’s data: F4 (Enter does the same for tables).
Modify Table dialog: Ctrl/Cmd+F6.
Locate in… popup: Alt+F1 (Use it to see the object in the database tree view).
Quick doc popup: Ctrl+Q/F1.
SQL generator: Alt+Ctrl/Cmd+G.

There are many more actions related to the objects you see here!

Also, don’t forget about Navigation settings in Database | General. Feel free to create your own flow, as DataGrip now really does cover all possible use cases.

NavigationOptions

Code insight

We added the support for Snowflake SQL.

Screenshot 2019-03-28 14.46.47

The support for database objects comes later. Now JDBC-based introspection works.

New inspections

DataGrip will warn you if the cursor you use is not opened when inside a procedure or function.

InspectionCursor_blog

The next two new inspections are turned off by default as only some developers want these things to be reported.

InspectionsList

Named arguments should be used

NamedParams

Usages of GOTO statements

This inspection has three options:
-Report all GOTO statements;
-Report uses of GOTO statements to exit a loop;
-Report backward GOTO statements;

GotoInspection

Customizable themes

This release adds the possibility to fully customize the appearance of the IDE as now you’ll have the power to design your own theme from scratch. We’ve created a few brand new themes to get you started. They can be downloaded as plugins:

ThemesAsPlugins

Here’s what they look like:

Dark Purple theme

ThemePurple

Cyan Light theme

ThemeCyan

We’ve made significant changes in our codebase so that you can tweak the entire IDE appearance, including icon colors, radio buttons, arrows, the color scheme, and everything else you can think of. You can literally change the color of anything.

You can create your own theme plugin using the DevKit and modify the IDE appearance via a JSON file. Here are some links that you may find useful:

That’s it!

Your feedback is extremely welcome in our twitter or forum! By the way, this version introduces a handy feedback method: just click Help -> Report problem… to raise a new issue in our issue tracker!

DataGrip team

Posted in Uncategorized | Leave a comment

DataGrip 2019.1 EAP 2

We have a new build for the 2019.1 EAP available. The major release of DataGrip 2019.1 is planned for early April.

Connectivity

We’ve completely reworked the connection dialog. Some changes are only related to the UI, but there are some new features as well.

General

We’ve re-arranged the fields here to make the connection process more user-friendly.

Comparing to the previous EAP build, password saving is now implemented via a drop-down. Now it has three options: Never, Until restart, and Forever. We are still thinking of adding some more options. Also, the empty password now can be set via UI: use the context menu.

06-PassWord

The Connection type field is what before was URL type. It determines the whole UI of this dialog, which is why now it’s on top along with the driver chooser.

The Database field goes after the credentials because sometimes credentials are needed to provide the database list. The list should be invoked by Ctrl/Cmd+Space.

05-General

Options

Read-only, Auto-Sync and Transaction control settings have been transferred here from the General tab.

Newly introduced settings:

Run keep-alive query every N seconds will help you keep the connection alive. You can define the custom query in the driver settings for unsupported databases.
Auto-disconnect after N seconds. Pretty self-explanatory.
The startup script is an SQL query which will be run each time you establish a connection. Remember that if the Single connection mode is unchecked, each new console creates a new connection.

04-Options

Renamed setting:

Warn if editing an outdated DDL is the new name for Notify when the outdated object is opened.

Schemas

– Object filter is transferred here from the Options tab.

02-ObjFilter

There’s a new Recent Locations popup that lists you recently visited/changed code locations. It presents them as code snippets with a couple of lines before and after the location.

This popup was inspired by Recent Files, but with an ability to search by visited code locations. This should come in handy when you remember what the code was about but can’t recall where it’s located. Especially if you work with several query consoles: they usually have similar names!

08-Recent

Press Delete/Backspace to remove locations from the popup.

The default shortcut for this popup is Ctrl/Cmd+Shift+E. If you’re used to pressing Ctrl/Cmd+Shift+E to call up Recently changed files, please use double Ctrl+E for that instead.

07-ShowEdited

Support for databases

We’ve implemented introspection and code generation for Greenplum. Even partitions, an important type of objects in Greenplum, are shown in the database tree view.

01-GP

DB2 now shows triggers in the database tree view.

03-Db2Triggers

Bug fixes:

DBE-2114: No more wrong COUNT() results in SQL Server. The driver problem isn’t fixed yet, so we’ve made changes on our side.
DBE-7743: Fixed error during introspection in MariaDB.

That’s all for today. Your feedback is extremely welcome in our twitter or forum.

Click Help -> Report problem… to raise a new issue in our issue tracker.

The DataGrip Team

Posted in Uncategorized | 5 Comments

DataGrip 2018.3.4

Hi! We have an update for 2018.3. Some bug-fixes are inside.

SQL formatter: we’re still improving it!

DBE-7362: Formatter works in SQL-injections.
DBE-7376: Better WITH formatting.
DBE-6937: Better arrays formatting in PostgreSQL.
DBE-4805: We keep the case of quoted identifiers in PostgreSQL.
DBE-7881: Support for ON CONFLICT clause in PostgreSQL.
DBE-7890: No more line break after PERFORM in PostgreSQL.
DBE-7605: INTO TEMP TABLE support in PostgreSQL.
DBE-7806: Better formatting for variables in SQL Server.

Other

During data import errors are written into a file by default.
DBE-7838: Fixed bug with missed reference when creating a foreign key.
DBE-7840: Autoscroll from the editor works correctly.
DBE-7896: No more raw HTML in notifications.

Posted in Uncategorized | Leave a comment

Top 9 SQL Features of DataGrip You Have to Know

DataGrip is a universal tool for dealing with databases. It supports PostgreSQL, MySQL, SQL Server, Oracle, and many other databases.

TOP9-2

DOWNLOAD A 30-DAY TRIAL FOR DATAGRIP

One of the most important activities for anyone working with databases is writing SQL. Built on IntelliJ Platform, DataGrip makes coding an enjoyable experience by automating repetitive tasks: as an SQL developer, you probably have many!

Let’s have a closer look at some of the nice SQL-related perks inside DataGrip.

1. Live Templates

DataGrip has code snippets called Live Templates. Use them to generate repetitive parts of SQL code.

There are some pre-built snippets for the most common tasks. Every live template has its own abbreviation — just type the abbreviation and then press Tab to fill in the rest of the code. For example, sel can be used for SELECT * FROM, while ins will provide the INSERT statement. Look at the Live Templates in action:

06_LiveTemplates

It is even possible to create custom templates for even greater efficiency. To do this go to Settings | Editor | Live Templates.

2. Introduce alias

This SQL refactoring is arguably one of the most important. Get your stopwatch ready as you are about to see how much time this saves you! Put the caret on the table name and press Alt+Enter (Opt+Enter for macOS) → Introduce table alias.

05-InlineRefactoring

3. Expand wildcard

Since using wildcards is not recommended in many cases, DataGrip can expand it to list all the columns of the table for you. In the event of conflicts, identifiers will be qualified with the table or alias names. JOINs are also respected!

01-ExpandWildcard

4. Postfix completion

This type of code completion is especially useful when real life doesn’t match the logic of how the code should be written. The best example is the SELECT statement: you need to think about the table you want to select fields from, and then you can decide which particular fields to select. Postfix completion lets you choose which order you do your coding.

An example would be if you type table_name.afrom you will get a list of all the table’s columns. Or, typing identifier.cast will generate the casting code for you.

02-PostfixCompletion

5. Multiple carets

Multiple cursors can be an efficient way to modify code. Especially in SQL, where similar rows are often used. To do this in DataGrip, press Ctrl (Opt for macOS) twice and hold it, then place new cursors with the arrow keys.

There is the option to place cursors everywhere matches have been found. Invoke Select All Occurrences by Shift+Ctrl+Alt+J (Ctrl+Cmd+G for macOS) when the caret is on the word you want.

03-MultipleCarets

Did you notice? The clipboard is also multiline!

6. Inline renaming

When you rename an object inside SQL, it also renames all the other usages of it inside your code. To rename, press Shift+F6.

05-InlineRefactoring

7. Abbreviation completion

Databases often have names with the same prefixes or first words which makes the normal kind of code completion not very useful: you may need to type the whole word to define a particular object. Abbreviation completion will save you here!

If you have names in camelCase or objects-with-hyphenated-names, just use the first letters of the words – it’s all you need, the rest will be completed with the suggestion.

04-Abbreviation

The same for keywords: ob works for ORDER BY.

8. Code formatting

You can have your SQL code formatted automatically, based on flexible user-defined code styles. Don’t spend time formatting legacy code – let DataGrip do it for you with a single shortcut Ctrl+Alt+L (Cmd+Opt+L for macOS)!

Adjust the code style in Settings | Editor | Code Style | SQL where you can, for example, define whether you capitalize keywords or not. Your style can be shared with your colleagues, so you are all working to the same standard.

07-Fromatter

9. Toggling comments

Toggle with your comments to make it easier to manage your code. Choose what type of comments you want to use – block or line-by-line (if it’s supported by your SQL dialect).

To comment with a line comment press Ctrl+/ (Cmd+/ for macOS).
To comment with a block comment press Ctrl+Alt+/ (Ctrl+Opt+/ for macOS).

08-TogglingComments

That’s it! We hope this article was useful for existing DataGrip users and also helps those who have never tried DataGrip learn a little bit about it.

DOWNLOAD A 30-DAY TRIAL FOR DATAGRIP

Some more information:
Tweet @ us!
— Discuss anything in the forum.
— Report bugs to our issue tracker.

Your DataGrip Team
_
JetBrains
The Drive to Develop

Posted in Features | 7 Comments

DataGrip 2019.1 EAP is started

For those eager to try the newest things, we invite you to join our Early Access Program for DataGrip 2019.1. As you may know, these builds don’t require a license – we just want everybody to try the new features out before the official release. Let’s go!

yCCKAB58

New databases: Greenplum, Vertica, and Apache Hive

In this release cycle, we focused a lot on supporting several new databases.

ThreeGraces

Greenplum is an analytics database based on PostgreSQL. It is currently developed by Pivotal and the open source community. For now, we have only SQL support for Greenplum; native database introspection will come later.

Vertica is column-oriented storage designed to handle large volumes of data.

Apache Hive is a data warehouse built on top of Apache Hadoop for providing data query and analysis.

Connectivity enhancements

Starting with 2019.1, the Test Connection button will not be disabled if there are no downloaded drivers. When you click Test Connection, DataGrip will offer you to download JDBC drivers.

TestConnection

We’ve also reworked the way passwords are stored, so now there are two options for Remember password:

Forever: Pretty self-explanatory. You will not be requested to enter the password again, period. Note the password will be stored separately (i.e. not within DataGrip).

For session: The password is saved until DataGrip is closed. Every time you re-open DataGrip, you’ll be requested to enter your password. Note this was the behavior when Remember was not selected, before v2019.1.

If you unselect Remember in 2019.1, entering the password will be required for every new connection. By default, every new console or data editor requires the new connection, unless you use Single Connection Mode.

Database tree view

We’ve improved database introspection for IBM DB2. You should now see these new objects in the database tree: module, data type, variable, condition, and global temporary table.

DB2

The tree itself now saves the context, so you’ll always see the data source name at the top.

TreeContext

We’ve also added icons for some databases we don’t support yet. Before, if you had many data sources of unsupported databases, they could all make a mess in the Database Tool window. Now we hope it looks a little bit better.

CustomLogos

We’ve added some combined options to the completion list for CREATE and DROP statements. For example, when you start typing CREATE, you can select CREATE TABLE.

CompletionCreate

One more benefit is that you can use abbreviations!

CompletionCaf

For MariaDB, DataGrip now highlights statements when running Oracle mode.

MariaOracle

For as long as we can remember, the Ctrl+Y shortcut has been assigned to Delete Line in the default Windows keymap. This seems to confuse many of our users because in many text editors, the Ctrl+Y shortcut is assigned to Redo. So, starting with 2019.1, when you first use the Ctrl/Cmd+Y keystroke, you will be prompted to assign the shortcut either to Delete Line or Redo. If you change your mind later, you can always customize the shortcut in Settings | Keymap.

Redo

Other

The filter in the data editor is now a little nicer: it offers you to use values from the clipboard.

FilterClipboard

We’ve added support for the DEFINER attribute in MySQL and MariaDB.

First, you can choose whether the SQL Generator should add a DEFINER attribute into the generated code.

SkipDefiner

Second, you may ignore DEFINER attributes during migration.

IgnoreDefiner

Bug fixes:

DBE-7640: Now you can set the default folder for a project.
DBE-7297: Tables in SQL Server were duplicated sometimes. No more.
DBE-7604: Schemas not chosen for introspection are not used in comparison now.
DBE-4993: Schema qualifier is no longer missed when creating the foreign key.
DBE-7560: Foreign key’s referenced column is no longer omitted in the Modify Table dialog.
DBE-4702: The Enable DBMS_OUTPUT button used in Oracle is back.
DBE-7443: Fixed the problem with temporary segments in Oracle.
DBE-6768: The source code of packages and functions is introspected properly.
DBE-7554: Fixed false positives while detecting unreachable code detection.

That’s all for today. Your feedback is welcome in our twitter or forum. By the way, this version introduces a handy feedback method: just click Help -> Report problem… to raise a new issue in our issue tracker!
The DataGrip Team

Posted in EAP, Features | Tagged | 22 Comments

DataGrip 2018.3.3

Hi all,

Here’s a list of important bug-fixes in 2018.3.3:

DBE-7745: No more false positives in Unreachable Code inspections in case of FOREACH statements.
DBE-4399: Fixed the problem with resolving objects in files.
DBE-7699: UTF-16 is always used in the data editor.
DBE-5850: No more -1 day changes to dates.
DBE-1465: Fixed a regression issue with synchronizing read-only data sources.
DBE-7795: Fixed problems with rename cancellation.
DBE-7694: The correct script is generated for changing table comments.
DBE-7712: All MySQL functions are correctly highlighted in the editor.

If you use the Toolbox App, it can install the update for you. Otherwise, click Check for Updates if you’re running DataGrip 2018.3.2. And of course, you can just download the update from the website and install it manually.

Your DataGrip Team

Posted in Uncategorized | Leave a comment

Working with files in DataGrip

People working with databases write SQL. A lot of SQL. In this post, we’ll go over whether it’s better to just use a temporary SQL editor in DataGrip or if it’s more convenient to work directly with SQL files stored on your computer.

Spoiler: it all depends on your needs. You might already have a working directory with tons of scripts; we will tell you how you can use DataGrip to deal with them too.

DG_WorkingWithFiles_wo_text_1

There are four types of files where you can write SQL in DataGrip:

1. Query console is an SQL editor attached to a particular data source. When you create a data source, a database console is created automatically. But you can add more consoles to a data source, each of them will then create a new connection, unless that is, you use Single Connection Mode.

2. Scratch files are like consoles, but they are not attached to a data source. We refer to scratch files as temporary notes or drafts for code ideas which are outside of the project context. If the scratch file is an SQL file, then it is also an SQL editor which can be associated with any of your connections.

3. User files are SQL scripts you store on your machine. You know where they are located and you can put them in Version Control.

In DataGrip, you can run all the files we’ve mentioned above, without opening them.

4. Object editors are internal files where you edit the DDL of each object: procedure, view, etc. We’ll not be talking about these in this tutorial.

Let’s have a closer look at these first three cases.

Query console

From our experience, the query console is the best place to write normal everyday SQL. Every data source has its own default console. To open it, go the context menu and click Open Console. Or use the shortcut (F4 or Cmd+Down).

00-OpenDefaultConsole

You can write SQL here, then run it and get the result! It is as simple as that. Located in the top right-hand corner of the query console, is a switcher where you can choose the database/schema you are working with, or, in the case of PostgreSQL, define a search path.

01-JustAConsoleMan

If for any reason you want to create another console for a data source, this is also possible: Context menu | New | Console

02-NewCopnsoleMenu

In fact, every console is a file. To see the details of a file, you can take a look at the tooltip on the console’s tab. If you want to create a separate file from the console, you can use the Save As… action for this.

05-ConsoleIsAFiletooltip

You can see that all the consoles you’ve created are stored in the internal Database Consoles folder. To open this folder open the Files tool window (Alt/Cmd+2) and go to Scratches and Consoles | Database Consoles.

If you want to get to the current console in the Files tool window, press Alt+F1 (Select the object in the other view) and choose Files.

06-ConsoleOpenInFilesView

Here you can also rename a console file, which can then later help you to locate it.

Another way to rename a console file, without opening the Files tool window, is to open the Navigation bar (Ctrl/Cmd+Up) and then rename the console from there.

Scratch Files

Scratch files are similar to query consoles; the only difference is that they are not attached to a data source. They can be of any type: JSON, XML, or text files, but we’ll speak specifically about SQL scratch files. They are SQL editors which can be associated with any of your connections.

There are several ways to create a new scratch file:

Shift+Ctrl/Cmd+N
File | New | Scratch file
— Invoke Find Action (Ctrl/Cmd+Shift+A) then type ‘scratch’ and press Enter.

00-ScrtchNew

Then choose the language you want this file to be highlighted as. Let’s say it’s PostgreSQL.

In this newly created file, you can write SQL. If you need to run it, then obviously, you need the attached connection. In DataGrip you need to attach the console. Again, there are several ways to do this:

— Just click Run (Ctrl/Cmd+Enter), and the IDE will offer to do it for you.
— Use the switcher in the top right-hand corner. There you’ll see only the consoles which are associated with the same language as your file. To attach a console from the data source of another DBMS, first, change the file’s language.
— Use the context menu of your scratch file.

01-ScratchAttachConsole

Once you have attached the console, the objects in your SQL will be resolved. This means that DataGrip now understands which particular objects are used there. As a result, you will be able to navigate from the SQL to the database tree.

All the scratch files you’ve created are saved in a virtual Scratches folder. Like Database Consoles, it can be found in the Files tool window in the Scratches and Consoles section.

02-ScratchesList

There are also files called scratch buffers which are almost the same, but they are created in a cyclical way: only 5 of them can exist at a time; when а the sixth scratch buffer is created the first one will be deleted.

User files

It is likely that you find the best way for you to work with SQL is to use the files as they are: you know where they are located, they can be modified from another place, and they can even be stored under Version Control System. Or they can be a huge legacy folder of scripts from the year 2005!

To work with files from your machine or any other place you have access to, attach the directory you need to the Files tool window. This can be done from the context menu. Or use the button on the toolbar.

00-Attach

Then you’ll see the folder that you need. Open and modify each file there with DataGrip. As with scratch files, every file should have its own language specified so it can use the correct highlighting and code analysis. The language (in our case, SQL Dialect) can be chosen from the top right-hand switcher.

01-ChooseDialectFromSwitcher

Sometimes DataGrip will detect the dialect automatically.

02-z_OfferToConfigureDialect

SQL dialects can be defined for the group of files in Settings | Database | SQL dialects.

02-SQLdialects

The dialect can be set for each file or for the whole script folder. If you define a Global SQL Dialect, this dialect will be used as the default to highlight all your files. It can be useful if you work on one DBMS.

As with scratches, once you’ve defined the dialect, it’s time to attach the console to the file. It can again be done from the different places.

When you run the statement, and the console isn’t attached, DataGrip will offer to do this.

03-AttachConsoleFromRun

Or you can do it from the context menu.

04-AttachConsoleFromContexMenu

The switcher in the top right-hand side also works.

05-AttachConsoleFromSwitcher

Once the console is attached, you can run statements in the context of the connection associated with that console. The resolve will work correctly as well.

There is also the possibility to resolve your scripts to CREATE and ALTER statements in other files. For this, you need to create a DDL Data Source from your DDL scripts.

A little more about resolve: If you just observe files, then you also need to have a correct resolve without attaching consoles to the file. In these cases use Settings | Tools | Database | SQL resolution scopes where you can map any SQL file or folder to any scope. If you do this, all unqualified objects from these locations will be resolved to the selected data source, database, or schema.

06-SQLResolutionScopes

The final thing to tell you about is that there is a file size limit which allows you to use the full set of code insight features. It is 2.56 MB by default. If the file you open exceeds this limit, you’ll get a notification. If the file is bigger than 20 MB, you will only see part of the file in the editor.

07-SizeLimitWarning

If you want to change this 2.56 MB limit, be aware that it can affect performance, do the following: Go to Help | Edit custom properties and in the open file (whether it’s empty or not) put the following string: idea.max.intellisense.filesize=3000 where 3000 is the new limit in bytes.

08-CustomProperties

Usually, if the file is too big and you just want to run the whole script, use the Run action from the context menu of the file. You can define several schemas and databases here so that your file will be run against all of them.

09-RunAgainst

If you want to know more about working with Version Control then check out our tutorials: How to work with Git in DataGrip and DataGrip and GitHub integration.

Thank you for reading! If you have any questions, please write them in comments or drop an email to datagrip@jetbrains.com.

DataGrip team

Posted in Tutorial | Tagged | Leave a comment