Neo4j DevTools Update: Workspace, MultiDB, Editors

These last few months, we’ve been working hard to make your development experience in Workspace better, finally bringing you some features you’ve been accustomed to in Neo4j Browser (multi-db support!) and powering up existing features with greatly improved Cypher editors and table rendering. Read on to find out more…

Query: NEW Cypher Query Editor

We’ve been working hard over the last few months to drastically improve the language support we provide. The new editor is now derived from the same grammar as the latest versions of Cypher. For a start, this means that syntax highlighting and code completion are now much more reliable. The two screen grabs below illustrate before and after shots for the same Cypher statements:

Old editor
New Editor

You’ll see the completeness and contextual accuracy of highlighting is much improved too, one example being key in the context of a key/value pair is no longer incorrectly colored as the Cypher keyword KEY. There’s also better support for highlighting Labels (like “Interest” above), so important concepts now stand out better.

This same greater understanding of Cypher also powers more accurate completions, like proposing the correct keyword options at the end of this CALL clause:

Greater code completion accuracy

We’ve got more improvements in the pipeline, including immediate feedback on the syntactic and semantic correctness of your queries as you type.

If you want to learn more about how we’re building out improved language support, be sure to check out our NODES 2023 talk “Re-Inventing Cypher Editing: Neo4j Meets Language Servers” on October 26, where Oskar Damkjaer and Nacho Cordon will be giving a deep dive into how we’ve been building this, not just to power our own web UIs, but also IDEs (like VS Code) and your own web apps.

To take the new (experimental) editor for a spin, simply enable it from the … (more) menu of the main editor in Query.

Enable experimental editor from the main editor … (more) menu

Query: New Representation for Nodes, Relationships, and Paths in Tables

Nodes, relationships, and paths in tables in Query have, until now, had quite a basic representation, largely shown as raw renders of data structures. Since the table view is really useful for seeing related graph elements on the same return line, we wanted to do a better job of making them easier to identify in the table.

So, we’ve now switched to using a rendering that closely resembles the Cypher patterns you’d use to create such elements. This includes efficient syntax highlighting, making node labels and relationship types much easier to spot. For huge results or very fast scrolling, the highlighting is disabled for performance reasons.

Cypher-style table return of paths

Import: Preview Selected

Import users have been enjoying the ability to preview their graphs before running a full load for some time now.

This is really useful to check everything is just right with your configuration, but with more complex models, it can sometimes be difficult to spot or troubleshoot specific issues. This is because it might be hard to see past all the other parts of the model and focus on specific nodes and relationships.

To address this, we’ve made a slight tweak to the Preview feature, allowing you to optionally preview only the selected parts of your graph.

Previewing only the PART_OF relationship with adjoining nodes

In the example above, you can see how we’re able to validate whether the PART_OF relationship is working as we expect it to.

Import: Generate Cypher Script

The Import UI gives you a convenient way to create your graph model and map data, but what happens if you want to take the import logic and use it somewhere else without the UI? Or what if the Import UI doesn’t quite allow the complex transformations that you need?

For these scenarios, we now provide the option to view and download a Cypher script representing a model and mapping. You can use the script as-is or adapt it for more complex needs.

Generate Cypher Script

Examples of where you might use this generated code include:

  • The Workspace Query UI. Note that the CSV files will need to be accessible to the DBMS you are connected to. At present, this means Aura customers will need their files accessible on a public URL for the LOAD CSV command to access them.
  • On the command line via cypher-shell.
  • Driver code — De-compose the script and re-use the CREATE CONSTRAINT and MERGE statements to implement your loads.

The load script itself has comments to help you understand the purpose of the different parts and where you might need to make changes, depending on where you’re running it. See an example of the Northwind configuration here.

You can also choose to download just the script or the data, which will give you a handy zip file of the script and your CSV files.

Workspace: Now Has Access to Unsecured localhost Instances

Workspace has been available in Aura for some time, but until this point, it’s been impractical to use the Aura-hosted Workspace app to connect to your local instances.

Neo4j Workspace

This was primarily because we prevented access to unsecured neo4j instances from the secure web app. To address this specifically for unsecured instances running on your machine, you can now connect with the neo4j:// or bolt:// schemes to a Neo4j instance running on your own computer.

Conencting to unsecured local instance

Currently, you need to first type localhost:7687 in the connection URL (assuming you are running on port 7687) and you’ll then get the option to choose one of the insecure schemes from the dropdown. As the connection form warns you, this will establish an insecure connection, but connections in these scenarios will be between the web app running locally in your browser and your machine.

Note that owing to security restrictions, this way of connecting is not supported in Safari.

With this new support, you can now use Workspace to connect to Neo4j Desktop or any other Neo4j instances you have running locally. Please let us know if you run into any issues with this.

Workspace: Multi-Database Support

The ability to switch between databases in Neo4j editions that support it is now supported in Workspace.

When you connect to a multi-database Neo4j instance, you’ll see all the available databases listed under the connection dropdown.

You can now create new databases using the CREATE DATABASE command in the query tab and switch to them via the connection manager. It’s also now possible to use the :use command to switch to a new DB without using the connection manager.

Creating and using a new database “db7”

Since you’ll now have the ability to have result frames open that relate to different databases and different connections, you’ll see colored “pills” in frames to remind you which DB a frame corresponds to.

If a frame corresponds to a DBMS that you are no longer connected to, the “pill” will appear disabled and remind you of the DBMS and DB it pertains to, and provide a shortcut for connecting to that instance.

Disconnected result frame

That’s all for this edition of Neo4j User Tools News. As a reminder, below are the useful links you need. Until next time!

Neo4j AuraDB Free — If you haven’t already, get a free Neo4j AuaDB Free cloud instance and open Workspace from there.

Neo4j Workspace — Go straight to Neo4j Workspace and connect it to your local Neo4j instance.

Feedback — We love to hear your feedback. Please do drop by if you have any.

Changelog — More detailed changes to the user tools can be found here.

Neo4j DevTools Update: Workspace, MultiDB, Editors was originally published in Neo4j Developer Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.