Cognee Community Graph Adapter - pgGraph (experimental)
Use pgGraph as a graph traversal layer on top of Cognee's
standard Postgres graph tables (graph_node, graph_edge).
Status: Experimental. Works without the pgGraph extension (SQL fallback). Install pgGraph on
Postgres for accelerated graph.traverse() queries.
Installation
pip install cognee-community-graph-adapter-pggraph asyncpg
Or from this directory:
uv sync
Quick demo (Docker + adapter test)
cd examples/docker
docker compose up -d
cd ..
export GRAPH_DATABASE_PROVIDER=pggraph
export GRAPH_DATABASE_HOST=localhost
export GRAPH_DATABASE_PORT=5433
export GRAPH_DATABASE_NAME=cognee
export GRAPH_DATABASE_USERNAME=cognee
export GRAPH_DATABASE_PASSWORD=cognee
export DB_PROVIDER=postgres
export DB_HOST=localhost
export DB_PORT=5433
export DB_NAME=cognee
export DB_USERNAME=cognee
export DB_PASSWORD=cognee
export ENABLE_BACKEND_ACCESS_CONTROL=false
uv run python examples/example.py
Usage
import asyncio
import os
import cognee
from cognee.infrastructure.databases.graph import get_graph_engine
from cognee_community_graph_adapter_pggraph import register
async def main():
register()
cognee.config.set_graph_database_provider("pggraph")
cognee.config.set_graph_db_config(
{
"graph_database_host": os.getenv("GRAPH_DATABASE_HOST", "localhost"),
"graph_database_port": int(os.getenv("GRAPH_DATABASE_PORT", "5433")),
"graph_database_name": os.getenv("GRAPH_DATABASE_NAME", "cognee"),
"graph_database_username": os.getenv("GRAPH_DATABASE_USERNAME", "cognee"),
"graph_database_password": os.getenv("GRAPH_DATABASE_PASSWORD", "cognee"),
}
)
graph = await get_graph_engine()
await graph.initialize()
# ... add_nodes, build_graph(), get_neighbors, etc.
asyncio.run(main())
Environment variables
| Variable | Description |
|---|---|
GRAPH_DATABASE_PROVIDER |
Set to pggraph after calling register() |
GRAPH_DATABASE_HOST / PORT / NAME / USERNAME / PASSWORD |
Postgres connection |
PGGRAPH_BUILD_MODE |
manual (default), on_write, or scheduled |
ENABLE_BACKEND_ACCESS_CONTROL |
Set false for single-database demos |
pgGraph extension
The adapter checks pg_available_extensions before CREATE EXTENSION graph. To use the real
extension, run Postgres with pgGraph installed — see
pgGraph quickstart.
Core Cognee integration
This community package registers via use_graph_adapter("pggraph", PgGraphAdapter). A future
upstream PR to topoteretes/cognee may add native
GRAPH_DATABASE_PROVIDER=pggraph support.
Related
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 cognee_community_graph_adapter_pggraph-0.2.0.tar.gz.
File metadata
- Download URL: cognee_community_graph_adapter_pggraph-0.2.0.tar.gz
- Upload date:
- Size: 207.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.10.18 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
101b1405392703ddf57798cee78cd54f3f307911d4385c9e58a0f943362f2893
|
|
| MD5 |
e3ed6d2e68fb809b04c211315c8484d3
|
|
| BLAKE2b-256 |
e1207d2b28227556fc5101b5857374a8e592b64bfb2cdb2fbc7f940d74f4e989
|
File details
Details for the file cognee_community_graph_adapter_pggraph-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cognee_community_graph_adapter_pggraph-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.10.18 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77fa26087f24e42b9458f00ac01664bfca1c834fbe76737156a269912b8167c9
|
|
| MD5 |
63c3cf1c2a93ef8d9d65a302185beace
|
|
| BLAKE2b-256 |
697022209f181dfd144cac231436ac20de8e14219fa5c64bd8d6177ffe91d129
|