Skip to content

Add support for Memgraph #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Starting with v1.31.6, this file will contain a record of major features and upd

## Upcoming
- Added `--explain-type` option to `%%gremlin` ([Link to PR](https://github.com/aws/graph-notebook/pull/503))
- Added Memgraph as an additional graph database and the supply chain analysis notebook ([Link to PR](https://github.com/aws/graph-notebook/pull/513))

## Release 3.8.2 (June 5, 2023)
- New Sample Applications - Healthcare and Life Sciences notebooks ([Link to PR](https://github.com/aws/graph-notebook/pull/484))
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Instructions for connecting to the following graph databases:
| [Blazegraph](#blazegraph) | RDF | SPARQL |
|[Amazon Neptune](#amazon-neptune)| property graph or RDF | Gremlin or SPARQL |
| [Neo4J](#neo4j) | property graph | Cypher |
| [Memgraph](#memgraph) | property graph | Cypher |

We encourage others to contribute configurations they find useful. There is an [`additional-databases`](https://github.com/aws/graph-notebook/blob/main/additional-databases) folder where more information can be found.

Expand Down Expand Up @@ -192,6 +193,7 @@ Configuration options can be set using the `%graph_notebook_config` magic comman
| sparql | SPARQL connection object | ``` { "path": "sparql" } ``` | string |
| gremlin | Gremlin connection object | ``` { "username": "", "password": "", "traversal_source": "g", "message_serializer": "graphsonv3" } ```| string |
| neo4j | Neo4J connection object |``` { "username": "neo4j", "password": "password", "auth": true, "database": null } ``` | string |
| memgraph | Memgraph connection object |``` { "username": "", "password": "", "auth": false, "database": "memgraph" } ``` | string |

### Gremlin Server

Expand Down Expand Up @@ -345,6 +347,31 @@ Ensure that you also specify the `%%oc bolt` option when submitting queries to t

To setup a new local Neo4J Desktop database for use with the graph notebook, check out the [Neo4J Desktop User Interface Guide](https://neo4j.com/developer/neo4j-desktop/).

### Memgraph

Change the configuration using `%%graph_notebook_config` and modify the fields for `host` and `port`, `ssl`.

After local setup of Memgraph is complete, set the following configuration to connect from graph-notebook:

```
%%graph_notebook_config
{
"host": "localhost",
"port": 7687,
"ssl": false
}
```

Ensure that you specify the `%%oc bolt` option when submitting queries to the Bolt endpoint. For example, a correct way of running a Cypher query via Bolt protocol is:

```
%%oc bolt
MATCH (n)
RETURN count(n)
```

For more details on how to run Memgraph, refer to its [notebook guide](./additional-databases/memgraph/README.md).

## Building From Source

A pre-release distribution can be built from the graph-notebook repository via the following steps:
Expand Down
49 changes: 49 additions & 0 deletions additional-databases/memgraph/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Connecting graph notebook to Memgraph Bolt Endpoint

[Memgraph](https://memgraph.com/) is an open-source in-memory graph database built for highly performant and advanced analytical insights. Memgraph is Neo4J Bolt protocol compatible and it uses the standardized Cypher query language.

For a quick start, run the following command in your terminal to start Memgraph Platform in a Docker container:

```
docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 -e MEMGRAPH="--bolt-server-name-for-init=Neo4j/" memgraph/memgraph-platform
```

The above command started Memgraph database, MAGE (graph algorithms library) and Memgraph Lab (visual user interface). For additional instructions on setting up and running Memgraph locally, refer to the [Memgraph documentation](https://memgraph.com/docs/memgraph/installation). Connection to the graph notebook works if the `--bolt-server-name-for-init` setting is modified. For more information on changing configuration settings, refer to our [how-to guide](https://memgraph.com/docs/memgraph/how-to-guides/config-logs).


After local setup of Memgraph is complete, set the following configuration to connect from graph-notebook:

```
%%graph_notebook_config
{
"host": "localhost",
"port": 7687,
"ssl": false
}
```

If you set up an authentication on your Memgraph instance, you can provide login details via configuration. For example, if you created user `username` identified by `password`, then the following configuration is the correct one:

%%graph_notebook_config
{
"host": "localhost",
"port": 7687,
"ssl": false,
"memgraph": {
"username": "username",
"password": "password",
"auth": true
}
}

To learn how to manage users in Memgraph, refer to [Memgraph documentation](https://memgraph.com/docs/memgraph/reference-guide/users).

You can query Memgraph via Bolt protocol which was designed for efficient communication with graph databases. Memgraph supports versions 1 and 4 of the protocol. Ensure that you specify the `%%oc bolt` option when submitting queries to the Bolt endpoint. For example, a correct way of running a Cypher query via Bolt protocol is:

```
%%oc bolt
MATCH (n)
RETURN count(n)
```

Another way of ensuring that Memgraph is running, head to `localhost:3000` and check out Memgraph Lab, a visual user interface. You can see node and relationship count there, explore, query and visualize data. If you get stuck and have more questions, [let's talk at Memgraph Discord community](https://www.discord.gg/memgraph).
Loading