drivine-python
Docs: drivine.org, for Python, TypeScript, and Kotlin & Java.
▶ Watch Drivine in four and a half minutes: graph RAG on any database (4:26, with captions)
A graph database client for Python, supporting Neo4j, Memgraph, FalkorDB, Oracle (SQL/PGQ), Postgres and SQLite as graph stores, plus Amazon Neptune through the low-level API. Async first, with a sync API written from it, typed, and fast: one statement per round trip, no session cache, no lazy loading. It gives you two ways to work with a graph:
- PersistenceManager: a low-level API where you write the queries yourself.
- Object manager (
StatelessGraphObjectManager): a high-level API that maps Pydantic models, with a query DSL whose typed references are stubs generated from your models.
Cypher you write runs on Postgres, Oracle and SQLite too, compiled to SQL. 0.5 is an alpha release: the API may still change.
Install
pip install "drivine[neo4j]" # Neo4j, Memgraph, Neptune
pip install "drivine[falkordb]" # FalkorDB
pip install "drivine[oracle]" # Oracle 23.9 or later, through python-oracledb in thin mode
pip install "drivine[postgres]" # Postgres 14 or later, through psycopg 3
pip install drivine # SQLite 3.45 or later, a graph in a file, through Python's own sqlite3
Python 3.11 or newer.
Quick start
Describe the database in the environment (DATABASE_TYPE=NEO4J, DATABASE_HOST=localhost, DATABASE_USER,
DATABASE_PASSWORD), declare a fragment for a node, then save and load it, each in one statement:
import asyncio
from typing import Annotated
from drivine import DrivineAssembly, NodeFragment, NodeId, refs
class Person(NodeFragment, labels=["Person"]):
uuid: Annotated[str, NodeId()]
name: str
async def main() -> None:
async with DrivineAssembly() as drivine:
gom = drivine.graph_object_manager()
await gom.save(Person(uuid="p1", name="Ada"))
print(await gom.load_all(Person, where=refs(Person).name.eq("Ada")))
asyncio.run(main())
Views that compose fragments and relationships, queries, transactions, schema and the sync API are in the full quick start and the pages after it.
SQLite
A graph in a file, with no server: DATABASE_TYPE=SQLITE, and DATABASE_NAME the file's path. The file holds
drivine4j's tables, so drivine4j and Drivine for TypeScript read and write it too. What a transaction gives there:
- One writer at a time: a transaction takes the file's write lock as it begins, so even one that only reads waits for the lock, for up to the busy timeout (30 seconds). One that holds it longer than 5 seconds is logged as a warning.
- Reads outside a transaction don't wait for a writer.
- Saves and deletes outside a transaction are run again when SQLite turns them away as contended.
- Each statement Drivine writes applies whole or not at all.
- A connection you open yourself, with
sqlite3.connect, gets none of this.
Cypher you write is compiled to SQLite's SQL (pip install "drivine[sqlite]"): see
Cypher on a relational database.
Documentation
- drivine.org/py: the full documentation.
- docs/ on GitHub: the same pages, as Markdown.
- RELEASING.md: how a release is made.
- Building and AGENTS.md: building and testing, and notes for contributors.
- Drivine and drivine4j are its TypeScript and Kotlin & Java twins, sharing its storage format.
License
Apache 2.0.
Metadata
Release files for drivine 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| drivine-0.5.0.tar.gz | 1.9 MB | With provenance | Details for drivine-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| drivine-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for drivine-0.5.0-py3-none-any.whl |
Total release size: 2.8 MB
Release files / drivine-0.5.0.tar.gz
| Download URL | drivine-0.5.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a2ca0b3303ea3679ca9dcf3b792362042093ddd7ff6731cb2b6b2e939ed783f
|
|
BLAKE2b-256 checksum How to use checksums |
e89dc95b1010c1c6c3aa8019b215ff27ffaff2e43bb3f97d50064b78edb9fa39
|
| 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 8, 2026.
Transparency logRelease files / drivine-0.5.0-py3-none-any.whl
| Download URL | drivine-0.5.0-py3-none-any.whl |
|---|---|
| Size | 920.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7a480af7887d04106d342aa02b1542f72cdb1bd158ec2a3bf0eb14a900c0df0
|
|
BLAKE2b-256 checksum How to use checksums |
07d34e51d5ad4b5617e18d85b41f7b83260ba6579cf6287b28bfffde5879fa12
|
| 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 8, 2026.
Transparency logSecurity for drivine 0.5.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
Both files in this release have been uploaded with provenance metadata.
Attestation for drivine-0.5.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 Nov 8, 2026.
Transparency logA 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.