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

db = GrafeoDB()              # in-memory
db = GrafeoDB("./path")      # persistent
db = GrafeoDB.open("./path") # open existing

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 isolation levels (string or enum)
from grafeo import IsolationLevel
with db.begin_transaction(IsolationLevel.SERIALIZABLE) 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()

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.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")

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.0

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.0
File Size Uploaded Provenance Actions
grafeo-0.6.0.tar.gz 4.7 MB With provenance Details for grafeo-0.6.0.tar.gz

Built distributions (wheels)

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

Total release size: 59.4 MB

Release files / grafeo-0.6.0.tar.gz

Download URL grafeo-0.6.0.tar.gz
Size 4.7 MB
Tags Source
SHA-256 checksum
How to use checksums
c26b245b5518773ba155b86e8be479ec3bb239f69d35e7f9a5664c0717990476
BLAKE2b-256 checksum
How to use checksums
0d8111293d9ab1499d925e8f459d0a56ebe54fb96b1a1804b97832ff18d10536
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-win_amd64.whl
Size 6.9 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3abbf7b8ce6e8171e5bf4f2b6e5f57e37e9bdb059cc813a3021c0bfb1d7f766f
BLAKE2b-256 checksum
How to use checksums
71107a12db039ae55596390ca5bd1d931168e1cda699b3d56143d0249c2ee56d
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-win32.whl
Size 6.5 MB
Tags CPython 3.12 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
4330d3a6806961bac87ce6567e7f8e340789f7bf3ae904ae70af4deb4155141c
BLAKE2b-256 checksum
How to use checksums
15d38f6372592bf98e247be7b03de6e736937fcd84bd77cefb7e4d7edb92c576
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 7.3 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
4abd021258fc1b9162ecd15025e1a3721e98fe97fc6e7150fb48ae795ad3caee
BLAKE2b-256 checksum
How to use checksums
bde7d1fbabdcb899b00add6867b110849fe886cb4e0adefadee243a827904cc2
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 6.9 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
0cfc85bc59f7848e368b6ab5492ff5264ac19f5e6bf25286f5cf1118c7a35a4b
BLAKE2b-256 checksum
How to use checksums
c159f3028d76261206e9dc2758a25f865d27f30d1e821f14519f38dd9b8f9232
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 7.0 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4ad64f604a2e8336282045e3103941a084d24aca9f85e65ebbaea3c46a48f452
BLAKE2b-256 checksum
How to use checksums
71ba2d32ab38e6446120ddbbbaf08b22568d7578ae7a67dd324203bb57550ac0
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.7 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9ffa7e36b91e7c8d48c00d6e7f33db2401afaae94a543ec4a106f821532d630b
BLAKE2b-256 checksum
How to use checksums
95a0a70f4c6fe7fb32d00a07f47fde36537b3ed4e3d16ed1f8c210661866d419
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-macosx_11_0_arm64.whl
Size 6.4 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
621839a6b7a4633d468eac49a31f01f27e6dee0fe62713c242b882aa64eb5b2d
BLAKE2b-256 checksum
How to use checksums
a6576caa51dddc7ff5e47c1be3ec9af0c181700eb02a59b1e602ebb9dd8ad9ea
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 Oct 23, 2026.

Transparency log

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

Download URL grafeo-0.6.0-cp312-abi3-macosx_10_12_x86_64.whl
Size 6.9 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7493acd72acd726a7eb7e623b7d0f7b84da3f1a5b0c68aed8c7beee65ba41ec3
BLAKE2b-256 checksum
How to use checksums
ad0af5540380289b018525d740aad0cbc8ec70e66274431b36f674a1fb7d32a2
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 Oct 23, 2026.

Transparency log

Security for grafeo 0.6.0

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.0.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 Oct 23, 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.0 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