Memgraph Lab user manual

Memgraph Lab is a visual user interface that enables you to import and export data to and from Memgraph database, write and execute Cypher queries, visualize graph data, view and optimize query performance, develop query modules in Python or connect to data streams.

Here is a short overview of the Lab's interface, features it provides, and links to resources that will help you achieve your graph goals. At the end of the page, there is a Lab demo video from the Memgraph Cloud launch if you need more visual input.

Overview

💡

If you're having trouble using Ctrl + V for copy-paste actions in Memgraph Lab over HTTP, it's likely related to security protocols implemented by your web browser. To avoid this you can allow clipboard access for specific unsecured domains, but be cautious as this lowers browser security.

Here's how you can do it in Chrome:

  1. Go to chrome://flags/#unsafely-treat-insecure-origin-as-secure.
  2. Enter the unsecured domain URL in "Insecure origins treated as secure".
  3. Enable the setting and restart Chrome.

Use this method only for trusted sites due to the security implications.

Every time you open Memgraph Lab, it will greet you with an Overview, offering resources and actions depending whether your database is empty or not, and whether you ran any queries or not.

At the top of the screen, you will find information about:

  • Connection status
  • Memgraph version, IP address, and port of the database
  • Set up multi-tenancy
  • Storage mode
  • Number of nodes and relationships currently in the database
  • Disk storage used, and total and available RAM

In the top right corner, you can find the help and notification buttons. The help section provides you with helpful documentation and links to the Memgraph community, while the notification section is used to inform you about important events within the Memgraph ecosystem.

All the Memgraph Lab sections are listed in the left side menu, below which you can find the Layout options and Memgraph Lab version along with the release notes and notifications about new software versions.

💡

The data associated with your setting, including saved queries, run history, and collection configurations, is stored directly in your browser's storage (local storage and IndexedDB) or within the Memgraph Lab desktop app's storage. This storage approach links your Query Collections to your current browser profile or the specific installation of the Memgraph Lab desktop app.

  • Browser dependency: Your access to collections or query history is tied to the browser you use. Switching browsers means you won't see your previously saved collections.
  • Private browsing: Using private browsing mode will not display your existing collections or query history, and any collections saved during such a session will be lost once the session ends.
  • User Profiles: Different user profiles or logins within the same browser will each have their own set of Query Collections or query history, separate from one another.

To ensure you can always access your collections, it's important to use the same browser and user profile.

Query execution

In this section, you can write and run queries, as well as see their tabular or graphical results.

Cypher editor

Here is where you write and run your Cypher queries. A keyword suggestion tool can help you with clause completion and give information about signatures and parameters. If you need help writing Cypher queries, check out the Cypher manual.

Once you Run a query (by clicking a button or pressing CTRL + Enter), you can Cancel it, but if the query has already reach Memgraph database, the action won't actually stop the query's execution. In the case of running complex algorithms on a large dataset, you need to be a bit patient and wait for Memgraph to complete running the query, or you can terminate the transaction.

If the Cypher Editor contains multiple queries, you can execute a single one by selecting it and pushing the "Run Selected".

Graph Style editor

The Graph Style editor allows you to customize the visual appearance of the graph results by editing the System Style or create a custom style and change the color, size, and shape of graph elements, even add pictures or backgrounds.

When saving a style, the graph results of an executed query will be used as a preview picture of the style. Custom styles can be defined as a default style applied to all following query runs.

Be sure to check the GSS reference guide and a tutorial on how to style your graphs.

Parameters

Here you can define query parameters in JSON format and run parameterized Cypher queries.

Data results

When the query has executed or failed, below the Cypher editor, you can see a Query successful message or an error. In the case of successful execution, the Lab returns the query execution times - how much it took Lab to send the query to Memgraph and show results, and how long it took Memgraph to execute the query.

The bar als shows the number of rows the query generated as well as nodes and relationship the query returned (if any).

Here you can also copy the query to your clipboard or add it to an existing or new query collection.

Depending on the results generated by the query, they can be shown in a table, as a graph, or both.

When rendering a graph that exceeds the set rendering limits, which might take considerable amount of time to preview, you will be asked if you want to proceed with the graph visualization or switch to the data view.

The rendering limit can be set in the Settings section.

If the Cypher Editor contains multiple queries and all of them were executed, you can select to view the results of each separate query.

Here, you can also Download results in JSON, CSV and TSV format.

Table rows can be expanded to show additional information about entities.

Graph results

When results are shown as a graph, you can click on each node or relationship to see additional information. You can also Expand a node to see its relationships, Collapse a node to hide its relationships, or Hide the node from the canvas. You can also expand and collapse nodes on double-click.

In the bottom left corner, you can Enable physics, that is, make nodes interact with each other, by pulling away or closing in to one another, depending on the strength of the relationships between them.

In the top right corner of the graph you can open Graph Preferences and set the collision radius that dictates the margin radius for each node from its center, the repel force that dictates how strongly nodes repel each other, and the link distance that dictates the minimum required distance between two connected nodes.

Another interesting feature you can use on graph data results is the map background. This feature automatically turns on when the result nodes have numeral lat and lng properties.

GraphChat

GraphChat is a feature within Memgraph Lab that allows users to query the Memgraph database using the English language instead of Cypher queries.

Run history

Here you can search or view ran queries or applied styles, with the information about the time of the last run, runtime and whether the execution was successful or not.

If the last action within the Query Execution was a query run, a clock icon will appear next to the query. If the last action was the application of a style, a clock icon will appear next to the style name. If the action included both the execution of a query and the application of the style, the clock icon will appear next to both.

If the Query Editor includes several queries, but only one query was selected and ran, the Query column of the Run History will show only that query, but the full contents of the Query Editor will be previewed by expanding the row. Expanding the Style Name column will show the Graph Style Script (GSS) code of the style.

In the Run History you can run rerun queries in the current or new execution view, copy them into clipboard, and save them to an existing or new collection.

You can filter the data to view just the query history, the style history or both.

You can clear the run history in the Settings section.

Collections

In the Collections section, you can gather your favorite queries so they are always at hand.

Queries can be added to the collection from the Query Execution and the Latest Queries section.

From the Query Collections section, you can directly run queries, copy them into the clipboard, and save them to an existing or a new collection.

Query collections can also be imported and exported to JSON file format.

Query modules

Query modules are collections of procedures written in C, C++, Python, and Rust (either *.so or *.py files) to extend the query language. Transformation procedures necessary to ingest data from data streams are also written as query modules.

Some query modules are built-in, and others, like those that can help you solve complex graph issues, are available as part of the MAGE library you can add to your Memgraph installation. The library is already included if you are using Memgraph Platform or Memgraph MAGE Docker images to run Memgraph, or you are connecting to a Cloud instance.

All the query modules and procedures are listed in the Query Modules section. By expanding the information about each query module, you can see the procedures it contains, as well as their signatures and examples.

In this section, you can also implement your own custom query modules written in Python by clicking on the + New Module. A new file will open with example procedures you can examine and learn from. Once you have written and saved the query module, Memgraph Lab will automatically detect procedures within it, which you can then call from queries.

If you need help writing custom query modules, check out the reference guide, or a tutorial on query modules.

Streams

In Memgraph Lab, you can connect to a data stream by running a series of Cypher queries or you can connect to it using the Streams section.

Once you enter basic information about the stream, such as type, name, server address and topics, the Streams section allows you to add an existing query module containing transformation procedure or to write a new one in Python.

When saving a new query module, Memgraph Lab will automatically detect transformation procedures within it, which you can then attach to the created stream.

Adding Kafka Configuration Parameters is also done via the Stream section, as well as managing the connection - starting, pausing or deleting it.

Check out the reference guide on streams, and check a how-to guide on connecting to data streams from Memgraph Lab.

Graph schema

If you need to check the data model of the data currently in the database, you can generate a graph schema that will show all the node types and relationships between them.

By selecting a certain node or relationship type, Lab will provide information about the current number of nodes or relationships of that type, as well as percentage of existence of each property across the nodes and relationships of that type.

Datasets

From the Datasets section, you can load interesting datasets varying in topics and size. You can use the datasets to explore the Cypher query language and Memgraph Lab features, or to experiment with data before you tackle your own more complex issues.

You can check the structure of the dataset by checking its graph schema, as well as reading the explanations of all the entities and their properties.

There are several tutorials you can use to explore the datasets available in Memgraph Lab.

Import

You can import data using a CSV file import tool, by connecting to a Kafka or Pulsar stream or using a CYPHERL format, which represents data in the form of Cypher queries.

💡

When importing .cypherl files via Memgraph Lab, please be aware that all existing indexes are automatically dropped during the import process. This means that any indexes intended to speed up the import will not be effective unless they are explicitly defined within the .cypherl file itself. To ensure optimal performance during data import, include CREATE INDEX queries at the beginning of your .cypherl file.

To import data from other sources, check the guides on importing.

Export

In this section, you can export data using a CYPHERL format.

To import data from other sources, check the guides on exporting.

Logs

To be able to see logs from Memgraph Lab application you need to open port 7444 when starting Memgraph with Docker.

Check how to access logs and modify logging.

You can set the number of visible logs in the Settings section.

Settings

In the Settings section you can check your unique application identification number and the Lab version.

You can also adjust the limits after which Lab will no longer give code completion suggestions, or automatically render graph results.

In the settings you can also clear the run history and set the number of saved records, as well as the number of log records.

In the Graph Style Library you can rename or delete styles, set them as the default style or see their code.

Here, you can also adjust the LLM settings.

Layout

You can split the work area horizontally to work with 2 sections at the same time, or vertically to work with up to 5 sections simultaneously.

You can also combine the horizontal and vertical split.

Versions

Memgraph Lab will notify you when a new version is available. By clicking on the version you can see what changes it brought compared to the previous version.

Memgraph Lab demo video

As a part of the Memgraph Cloud release, we've showcased different features of Memgraph Lab, and we invite you to check it out!

If you are interested in a particular topic, below is the breakdown of the video by the topics covered in the user manual, but there is a breakdown in the description of the video as well: