Graph database integration (cypher-graphdb) for sonnet-server applications
Project description
sonnet-graph
Graph database integration (cypher-graphdb) for sonnet-server applications.
Provides reusable infrastructure for sonnet-server apps that need a cypher-graphdb connection pool:
GraphDBExtension-- sonnet-server extension managing pool lifecycle (startup/shutdown), with optional mode for apps where graph is not required.- Pool context --
borrow_graphdb()context manager andget_current_graphdb()ambient session accessor viaContextVar. - Readiness checks --
GraphdbStagewith initialization and health checks for the sonnet-server readiness pipeline. - FastAPI dependencies --
get_graphdb_session()async generator for router-level ambient sessions.
Installation
pip install sonnet-graph
Usage
from sonnet_graph import GraphDBExtension, borrow_graphdb, get_current_graphdb
# In app.py -- register the extension
_extension_registry = create_extension_registry(
DatabaseExtension(),
GraphDBExtension(), # required (raises on missing CGDB_* settings)
GraphDBExtension(optional=True), # or optional (skips if unconfigured)
...
)
# In service code -- borrow a connection
with borrow_graphdb() as db:
db.execute("MATCH (n) RETURN count(n)")
# In service code -- ambient session (within borrow_graphdb scope)
db = get_current_graphdb()
Configuration
Graph connection is configured via cypher-graphdb's own environment variables (not duplicated in consumer settings):
| Variable | Description |
|---|---|
CGDB_BACKEND |
Backend type: age or memgraph |
CGDB_CINFO |
Connection string / DSN |
CGDB_GRAPH |
Graph name |
CGDB_READ_ONLY |
Read-only mode (default: false) |
CGDB_CREATE_GRAPH_IF_NOT_EXISTS |
Auto-create graph, AGE only (default: false) |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sonnet_graph-0.1.1.tar.gz.
File metadata
- Download URL: sonnet_graph-0.1.1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e4c94ceafbc40019bfe823e91146977b20d55310e32f9cd021c4b34e8732c99
|
|
| MD5 |
ac3ccf6ee4c3cca38bb6c21bfa197731
|
|
| BLAKE2b-256 |
4efd7effd7a13045351112e19e011532f7b8d0e1ec80746f3e4be42d56abba77
|
Provenance
The following attestation bundles were made for sonnet_graph-0.1.1.tar.gz:
Publisher:
publish.yml on petrarca/sonnet-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sonnet_graph-0.1.1.tar.gz -
Subject digest:
7e4c94ceafbc40019bfe823e91146977b20d55310e32f9cd021c4b34e8732c99 - Sigstore transparency entry: 1635030582
- Sigstore integration time:
-
Permalink:
petrarca/sonnet-server@b9d2f15dceed7b935813be16f065b7fc993f296c -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/petrarca
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9d2f15dceed7b935813be16f065b7fc993f296c -
Trigger Event:
push
-
Statement type:
File details
Details for the file sonnet_graph-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sonnet_graph-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4df4785e5f5620ad1f3857afb1938b52cf7e3e44417a6bf150e1a93203d6cf3
|
|
| MD5 |
bd8fa41df7ea16b7f530fc3a099760e9
|
|
| BLAKE2b-256 |
616d1980959371d3aca4100be08bce5de8498b84c871a68d4cca9bd677c6635c
|
Provenance
The following attestation bundles were made for sonnet_graph-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on petrarca/sonnet-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sonnet_graph-0.1.1-py3-none-any.whl -
Subject digest:
c4df4785e5f5620ad1f3857afb1938b52cf7e3e44417a6bf150e1a93203d6cf3 - Sigstore transparency entry: 1635031201
- Sigstore integration time:
-
Permalink:
petrarca/sonnet-server@b9d2f15dceed7b935813be16f065b7fc993f296c -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/petrarca
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b9d2f15dceed7b935813be16f065b7fc993f296c -
Trigger Event:
push
-
Statement type: