DataGrip 2022.2 EAP 2
DataGrip 2022.2 EAP build #2 is available. Let’s take a closer look at what’s inside.
Playground and Script resolve modes
Resolving database objects in SQL scripts takes an understanding of what the objects mean. This is necessary for the IDE to provide you with correct code completion and treat the usages of the objects as links.
In general, the resolve context should match the running context, but that is not a trivial task for DataGrip to handle. This is why there were, until recently, several resolve-related problems. Here’s what would sometimes happen:
- All the objects were resolved, but the script could not be run in the database.
- When the Auto-qualify option was turned on, the objects would sometimes stay unqualified if they were located in the default database/schema.
- If there were multiple objects with the same name in different databases/schemas, existing columns would fail to be resolved (or vice versa, there was a risk of resolving non-existing columns), and even the Expand column list action would sometimes generate the wrong list.
The cause of these and other issues was that, for each console or local file, DataGrip resolved their objects to the context (selected in the top right-hand drop-down) and the default database/schema (or the entry from the SQL Resolution scopes setting, if one was provided).
This was fine for working with scripts containing USE/SET SEARCH PATH statements, which switch the context. However, the IDE needs to know where to resolve right from the beginning of the file, too. So, it treated the default database/schema (or the entry from the SQL Resolution scopes setting, if one was provided) as the most appropriate context for the beginning of the file.
In other words, if there are no USE/SET SEARCH PATH statements in your file, then DataGrip shouldn’t try to resolve the beginning of the file somewhere out of context. To address this situation, we’re created a way for DataGrip to know which approach to follow, by introducing two resolve modes: Playground and Script.
In Playground mode, DataGrip resolves objects according to the context (which is the value in the schema chooser, the resolution scope, or, if none of those is set, the default database). It works best if your file is just a set of unconnected queries, independent of each other and having no particular sequence – kind of like a playground. Playground mode is now the default for query consoles.
In Script mode, the beginning of the file is resolved to the context (which is the value in the schema chooser, the resolution scope, or, if none of those is set, the default database), but any USE statements in the script change the context for the resolve because they are part of the script’s sequential logic. It is a good choice for when your queries have sequential logic and should be run as a single script. Script mode is now the default for local files.
Switching between the modes is easy – just use the drop-down on the toolbar (see the screenshot above).
That’s all for today. Please let us know what you think about these changes.
The DataGrip team
Subscribe to Blog updates
Thanks, we've got you!
DataGrip 2023.3 EAP 2 is Out!
Hello, DataGrip community! The second Early Access Program version for DataGrip 2023.3 is here. If you want to try the new features before the official release, this is for you! Introspection scheduler It's now possible to set an introspection interval for each data source. Materialized…
DataGrip 2023.3 EAP is Open
Hello! We’re starting our 2023.3 Early Access Program (EAP) and, as usual, we invite you to try the latest features and improvements we’re adding to DataGrip ahead of the official release. Let’s take a look at what’s inside the first EAP build. DataGrip takes a long time to introspec…
DataGrip 2023.2: New UI with toolbar icons in the header, AI Assistant, time zones in the data editor, support for Redis Cluster
DataGrip 2023.2 is out!Here’s a sneak peek at what it has to offer. For a detailed description of this update, please visit our What’s New page. User Interface New UI: The toolbar icons have been moved to the header Improved main toolbar customization Light theme with light …
DataGrip 2023.2 EAP 2: Redis Cluster, New Schema Migration Dialog and More
Hello, DataGrip community! The second Early Access Program version for DataGrip 2023.2 is here. If you want to try the new features before the official release, this post is for you! Support for Redis Clusters Now you can connect to Redis Clusters and have the same feature set as with standalo…