Skip to main content

grafeo

Python bindings for Grafeo, a high-performance, embeddable graph database with a Rust core.

Installation

uv add grafeo
# or: pip install grafeo

Quick Start

from grafeo import GrafeoDB

# In-memory database
db = GrafeoDB()

# Or persistent
# db = GrafeoDB("./my-graph")

# Create nodes
db.execute("INSERT (:Person {name: 'Alix', age: 30})")
db.execute("INSERT (:Person {name: 'Gus', age: 25})")
db.execute("INSERT (:Person {name: 'Alix'})-[:KNOWS]->(:Person {name: 'Gus'})")

# Query the graph
result = db.execute("MATCH (p:Person) WHERE p.age > 20 RETURN p.name, p.age")
for row in result:
    print(row)

API Overview

Database

# Create or open: one of
db = GrafeoDB()                # in-memory
# db = GrafeoDB("./path")      # persistent: created, or opened if it exists
# db = GrafeoDB.open("./path") # open existing
# db = GrafeoDB("./path", query_timeout=5)  # queries fail after 5 s (None: no limit)

db.node_count   # number of nodes
db.edge_count   # number of edges

Query Languages

result = db.execute(gql)                        # GQL (ISO standard)
result = db.execute(gql, {"name": "Alix"})     # GQL with parameters
result = db.execute_cypher(query)               # Cypher
result = db.execute_sparql(query)               # SPARQL
result = db.execute_gremlin(query)              # Gremlin
result = db.execute_graphql(query)              # GraphQL
result = db.execute_sql(query)                  # SQL/PGQ (SQL:2023)

Node & Edge CRUD

node = db.create_node(["Person"], {"name": "Alix", "age": 30})
edge = db.create_edge(source_id, target_id, "KNOWS", {"since": 2024})

n = db.get_node(node_id)   # Node or None
e = db.get_edge(edge_id)   # Edge or None

db.set_node_property(node_id, "key", "value")
db.set_edge_property(edge_id, "key", "value")

db.delete_node(node_id)
db.delete_edge(edge_id)

Transactions

# Context manager (auto-rollback on exception)
with db.begin_transaction() as tx:
    tx.execute("INSERT (:Person {name: 'Harm'})")
    tx.commit()

# With an isolation level: "read_committed" or "snapshot" (the default)
with db.begin_transaction("read_committed") as tx:
    tx.execute("MATCH (n:Person) SET n.verified = true")
    tx.commit()

# Per-transaction CDC override
with db.begin_transaction_with_cdc(True) as tx:
    tx.execute("INSERT (:AuditedEvent {action: 'login'})")
    tx.commit()

A commit that fails (a write conflict, gql_status 40000, is_retryable True) ends the transaction: tx.is_active is False after it and tx.rollback() does nothing. Transaction control statements (START TRANSACTION, COMMIT, ROLLBACK) are refused inside tx.execute() (gql_status 25000): end a transaction with tx.commit() or tx.rollback().

Named Graphs and Schemas

db.create_graph("social")
db.set_graph("social")
print(db.list_graphs())       # ['social']
print(db.current_graph())     # 'social'
db.reset_graph()
db.drop_graph("social")

db.execute("CREATE SCHEMA v1")
db.set_schema("v1")
print(db.current_schema())    # 'v1'
db.reset_schema()

Graph Projections

db.create_projection("people", node_labels=["Person"], edge_types=["KNOWS"])
print(db.list_projections())  # ['people']
db.drop_projection("people")

Data Import

count = db.import_csv("users.csv", "Person", headers=True)
count = db.import_jsonl("events.jsonl", "Event")

Backup and Restore

db.backup_full("/backups/full")
db.backup_incremental("/backups/incr")
GrafeoDB.restore_to_epoch("/backups/full", epoch=100, output_path="./restored")

Errors

Errors from the database raise grafeo.GrafeoError, with error_code (such as GRAFEO-T001), gql_status (the ISO GQL status, such as 22012) and is_retryable. A database file that another handle of this process or another process holds raises grafeo.GrafeoLockedError (GRAFEO-S004, gql_status 08000), a subclass of GrafeoError.

QueryResult

result = db.execute("MATCH (n:Person) RETURN n.name, n.age")

result.columns          # column names
len(result)             # row count
result.execution_time_ms  # execution time (milliseconds)

for row in result:      # iterate rows
    print(row)

result[0]               # access by index
result.scalar()         # first column of first row
# Create an HNSW index
db.create_vector_index("Document", "embedding", dimensions=384)

# Insert vectors
node = db.create_node(["Document"], {"embedding": [0.1, 0.2, ...]})

# Search
results = db.vector_search("Document", "embedding", query_vector, k=10)

Features

  • GQL, Cypher, SPARQL, Gremlin, GraphQL, and SQL/PGQ query languages
  • Full node/edge CRUD with native Python types
  • ACID transactions with configurable isolation levels
  • HNSW vector similarity search
  • Property indexes for fast lookups
  • Named graph and schema management
  • Graph projections (filtered virtual views)
  • CSV and JSON Lines import
  • Incremental backup and restore
  • Per-transaction CDC control
  • Async support via asyncio
  • Type stubs included

License

Apache-2.0

Metadata

Release files for grafeo 0.6.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grafeo 0.6.3
File Size Uploaded Provenance Actions
grafeo-0.6.3.tar.gz 6.4 MB With provenance Details for grafeo-0.6.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for grafeo 0.6.3
File Actions
grafeo-0.6.3-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for grafeo-0.6.3-cp312-abi3-win_amd64.whl
grafeo-0.6.3-cp312-abi3-win32.whl CPython 3.12 abi3 Windows x86-32 Details for grafeo-0.6.3-cp312-abi3-win32.whl
grafeo-0.6.3-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for grafeo-0.6.3-cp312-abi3-musllinux_1_2_x86_64.whl
grafeo-0.6.3-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for grafeo-0.6.3-cp312-abi3-musllinux_1_2_aarch64.whl
grafeo-0.6.3-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for grafeo-0.6.3-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
grafeo-0.6.3-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for grafeo-0.6.3-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
grafeo-0.6.3-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for grafeo-0.6.3-cp312-abi3-macosx_11_0_arm64.whl
grafeo-0.6.3-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for grafeo-0.6.3-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 75.5 MB

Release files / grafeo-0.6.3.tar.gz

Download URL grafeo-0.6.3.tar.gz
Size 6.4 MB
Tags Source
SHA-256 checksum
How to use checksums
5b310cca8d5908e34e06f4fcbc908626b30bd04e62fffbb11d5d5ee1d5e952dc
BLAKE2b-256 checksum
How to use checksums
27f8e34c268663685bd0a156ff463ab3546f95e5eee5704d4ab3ef0e1d443238
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-win_amd64.whl

Download URL grafeo-0.6.3-cp312-abi3-win_amd64.whl
Size 8.9 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d870f5b88a1923bf77ec3d13fe102bdc2363f00faf35085168def0c3adab53f9
BLAKE2b-256 checksum
How to use checksums
0a6f57d843175a67a01731e9af66ee10114cd7d99afefcb121935c7d41955a34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-win32.whl

Download URL grafeo-0.6.3-cp312-abi3-win32.whl
Size 8.3 MB
Tags CPython 3.12 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
85c33e28a3c7c48c29a0a6c9714d420a258f249901b6e5d6f62d97d58e3128e4
BLAKE2b-256 checksum
How to use checksums
6bc1384053856f3741bc9bfdf2ecde0e43b49f10de47f764b6d735f9e2a29ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL grafeo-0.6.3-cp312-abi3-musllinux_1_2_x86_64.whl
Size 9.2 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
500a5b120cf4fe1406b837597fe480303910f77c6d753c54760d05cfd97dd11c
BLAKE2b-256 checksum
How to use checksums
4dac35bc5d7c40f85287c5f6d9a484fb33399ba626e5c7707827bea296063c93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL grafeo-0.6.3-cp312-abi3-musllinux_1_2_aarch64.whl
Size 8.7 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
09d54554824551cb0666fa543558b3a33e0fc70a4f9da337102b8825468665ab
BLAKE2b-256 checksum
How to use checksums
543456ef6a8fb9f3dab2492f186a69d5bdd520c35a9adca017c4d24d510c2bac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL grafeo-0.6.3-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.9 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
bceb6d705edaafd42aff8be4eb635ef35b5ff1c930beb49ab316d791ab9a5de3
BLAKE2b-256 checksum
How to use checksums
bdcbd363fb1f9c042b1dabafb25a4f6a2d7f3f8691b364410c8f54d08cc5a7e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL grafeo-0.6.3-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 8.5 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
0b39f206daab153faa11f203d746e5d8e8a67692f46ce21fddf03580eea4ecd4
BLAKE2b-256 checksum
How to use checksums
0b12336630d788237cd466ef4b84629516e30540ca58a616498b9866bbeb04d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-macosx_11_0_arm64.whl

Download URL grafeo-0.6.3-cp312-abi3-macosx_11_0_arm64.whl
Size 8.1 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
849041b7c2a3bdf3a314684b394551891bbfbb6441a3d4ab06b74fffd63375ab
BLAKE2b-256 checksum
How to use checksums
7bf9253fab75ce6104759fcef5acb2a3887a9e662cabcb637aa43868891eebec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / grafeo-0.6.3-cp312-abi3-macosx_10_12_x86_64.whl

Download URL grafeo-0.6.3-cp312-abi3-macosx_10_12_x86_64.whl
Size 8.7 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3f58622971a57801212fb743e980fd4d2a4247f9e2dac4405a046345a47f2d42
BLAKE2b-256 checksum
How to use checksums
491501f49aa2367a34d1c7dcb47e90ab92fad55327c9756153c4a78a9d31954a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for grafeo 0.6.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for grafeo-0.6.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.3 This release

9 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page