Skip to content

How-to guides overview

This section will teach you how to use object graph mapper (OGM) and query builder from the GQLAlchemy. Here you will find step-by-step guides for the most common usage of OGM and query builder, depending on the current GQLAlchemy capabilities. If you are a Python developer not that familiar with Cypher query language, you will find the how-to guides very useful.

Object graph mapper

Object graph mapper (OGM) in GQLAlchemy maps Python classes to nodes and relationships in graph database and converts function calls to Cypher queries. To learn more about how to use OGM, take at OGM how-to guide.

Query builder

When working with GQLAlchemy, you can connect to the database and execute Cypher queries using the query builder. To learn more about how to create a query using query builder, check out the query builder how-to guide.

Stream & trigger support

You can create streams and database triggers directly from GQLAlchemy. Check out the following guides:

Import data from different sources

Info

The features below aren’t included in the default GQLAlchemy installation. To use them, make sure to install GQLAlchemy with the relevant extras.

You can translate table data from a file to graph data and import it to Memgraph. Currently, we support reading of CSV, Parquet, ORC and IPC/Feather/Arrow file formats via the PyArrow package.

You can use loaders.py which implements loading data from the local file system, as well as Azure Blob and Amazon S3 remote file systems:

The other way to import data is to implement a custom file system importer:

Instance runner

There are two ways of managing a Memgraph instance with the instance_runner module:

On-disk storage

Since Memgraph is an in-memory graph database, the GQLAlchemy library provides an on-disk storage solution for large properties that don’t need to be used in any of the graph algorithms. Learn how to use on-disk storage in the following guide:

Graph projections

As subgraphs are mainly used with Memgraph's query modules (graph algorithms), QueryBuilder's call() method enables specifying the subgraph to use with a certain algorithm.

Transform Python graphs into Memgraph graphs

GQLAlchemy holds transformations that can transform NetworkX, PyG and DGL graphs into Memgraph graphs. These transformations take the source graph object and translate it to the appropriate Cypher queries. The Cypher queries are then executed to create a graph inside Memgraph.