Course

Get Started with Relate in Python

Install Relate, the embedded Cypher database, as a Python package. Seed a graph from a Python list and a CSV file, write data by hand and with an agent, then read it back.

50 minutes7 lessons across 1 module
About this lab

In this 50-minute lab, you will learn

Relate is an open-source embedded graph database that speaks CypherNeo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it.. It runs inside your own process, so there is no server to deploy and no account to create. You get a database from a single Python package and a single file.

In this lab you will install Relate with pip and run your first statements from Python. You will then build a small graph of people and projects from more than one source, add to it by hand and through an AI agent, and read it back with queries that are safe to repeat.

Everything runs on your own machine. You do not need an Aura instanceA single Neo4j database running in Aura. or the relate command line tool. You need Python 3.9 or later, and you should be comfortable reading a short Python script. The lab uses MERGE, LOAD CSV and query parameters, and explains each one the first time it appears, so you only need to be comfortable reading a short Cypher statement. An AI coding agent is optional. The one step that uses an agent has a version you can do by hand.

  • Install and run Relate from Python

    Install the relate-db package and run your first Cypher statements from Python in an in-memory database.

  • Seed data from different sources

    Load a graph from a Python list, a CSV file and a Parquet file, using MERGE so a re-run creates no duplicates.

  • Write and read data

    Write to a persistent .rl file by hand and through an agent, then read the data back with read-only, parameterized queries.