Piggie
One PostgreSQL instance replaces your graph database, your vector database, and your ETL pipeline.
Piggie is a Python SDK for Apache AGE + pgvector on PostgreSQL. Cypher graph queries, vector similarity search, and hybrid graph+vector operations — all through a single connection string, with no vendor lock-in.
┌──────────────────────────────────────────────────┐
│ Your Application │
├──────────────────────────────────────────────────┤
│ Piggie SDK (Python) │
│ Cypher │ SQL │ Vector Search │ Hybrid │ KM API │
├──────────────────────────────────────────────────┤
│ PostgreSQL │
│ Apache AGE │ pgvector │ Core SQL │
│ (graphs) │ (vectors) │ (relational) │
└──────────────────────────────────────────────────┘
Quick Start
# Start the database (Docker, any platform, ARM + x86)
git clone https://github.com/gregfelice/tomo.git && cd piggie
docker compose up -d
# Install the SDK
pip install piggie
import piggie
db = piggie.connect("postgresql://piggie:piggie@localhost:5488/piggie", graph="my_graph")
# Cypher queries → DataFrames
df = db.cypher("MATCH (n:Person) RETURN n.name, n.age").to_df()
# Vector search
results = db.vector_search("documents", "embedding", query_vec, k=10).to_df()
# Hybrid: graph traversal + vector similarity
results = db.hybrid_search(
cypher="MATCH (p:Paper)-[:CITES]->(cited) RETURN cited",
vector_table="papers",
vector_column="abstract_embedding",
query_vector=query_vec,
k=10,
).to_df()
Installation
pip install piggie
# With pandas support
pip install piggie[pandas]
# With all optional dependencies
pip install piggie[all]
Database Setup
Piggie requires PostgreSQL with Apache AGE (graph) and pgvector (vectors).
Docker (recommended) — multi-arch image (ARM + x86), hardened config, everything pre-configured:
docker compose up -d
Verify the stack:
python docker/smoke-test.py
Other platforms: See the Install Database guide for Ubuntu, macOS, Fedora, and from-source instructions.
Cloud deployment: Terraform modules for AWS, GCP, Azure, DigitalOcean, and Hetzner — one terraform apply and you're running.
Docker Image
The piggie/db image ships PostgreSQL 18 + Apache AGE 1.7.0 + pgvector 0.8.2 with:
- Multi-arch: linux/amd64 + linux/arm64 (native on Apple M-series, AWS Graviton)
- scram-sha-256 authentication (no trust or md5)
- TLS enabled with self-signed cert (replace for production)
- Audit logging for connections, disconnections, and DDL
- Minimal attack surface — multi-stage build, no build tools in runtime
Benchmarks
We benchmarked AGE + pgvector against Neo4j, Kuzu, and NebulaGraph across 12 workloads at three scales (10K, 100K, 1M). AGE won all 12 workloads at every scale. At 1M nodes:
| Workload | AGE | Neo4j | Speedup |
|---|---|---|---|
| Point Lookup | 0.29ms | 0.97ms | 3x |
| Pattern Match | 0.14ms | 1.8ms | 13x |
| VLE Traversal | 0.18ms | 0.62ms | 3x |
| Concurrent Queries | 52ms | 1,323ms | 25x |
| Bulk Load | 59ms | 133ms | 2x |
The Piggie SDK also won 14/16 algorithm benchmarks against Neo4j GDS, using igraph (C) and networkit (C++) backends.
Read the full analysis: Can One PostgreSQL Replace Your Graph Database and Your Vector Database?
Graph Algorithms
19 algorithms across 7 categories with automatic backend selection:
# Auto-selects igraph C backend
df = db.centrality(measure="betweenness")
# Auto-selects networkit C++ backend
df = db.centrality(measure="closeness")
# Community detection
df = db.communities(method="louvain")
Backends: igraph (C), networkit (C++), NetworkX (Python). The SDK detects installed backends and routes each algorithm to the fastest available implementation.
Integrations
- LangChain —
PiggieVectorStoreandPiggieGraphStorefor RAG pipelines - LlamaIndex —
PiggieGraphStore(triplets) andPiggiePropertyGraphStore(labeled property graph) - NetworkX —
to_networkx()conversion + built-in PageRank, community detection, shortest path, centrality - PyTorch Geometric —
FeatureStoreandGraphStorefor GNN training on AGE data
Notebooks
| Notebook | Description |
|---|---|
| Quickstart | Getting started with Piggie |
| Hybrid Search | Graph + vector search combined |
| Bulk Load | Bulk load and export |
| Algorithms | Graph algorithms with igraph/networkit backends |
| RAG Pipeline | RAG with LlamaIndex and LangChain |
| GNN Training | GNN training with PyTorch Geometric |
Documentation
- Quick Start — 5-minute getting-started guide
- Install Database — Docker, Ubuntu, macOS, Fedora, from source
- API Reference — full method signatures and parameters
- Graph Algorithms — algorithm catalog and backend selection
- Integrations — LangChain, LlamaIndex, NetworkX, PyG
- Compatibility — tested version matrix
- Cloud Deployment — Terraform for AWS, GCP, Azure, DO, Hetzner
- Troubleshooting — common issues and fixes
- Security — TLS, authentication, credential handling
- Hardening — CIS benchmark alignment
Security
See SECURITY.md for vulnerability disclosure policy and security model.
Community
- GitHub Discussions — questions, ideas, show and tell
- Issue Tracker — bug reports and feature requests
- Contributing Guide — how to set up and contribute
Requirements
- Python 3.10+
- PostgreSQL 16–18 with Apache AGE and pgvector extensions (or use the Docker image)
License
Apache 2.0
Metadata
Release files for tomo-sdk 1.0.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 |
|---|---|---|---|---|
| tomo_sdk-1.0.0.tar.gz | 1.4 MB | Without provenance | Details for tomo_sdk-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tomo_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for tomo_sdk-1.0.0-py3-none-any.whl |
Total release size: 1.5 MB
Release files / tomo_sdk-1.0.0.tar.gz
| Download URL | tomo_sdk-1.0.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9390151a5bc50fad32db113ab06b27f18f97294d0fc9a9a95327f86aa6368566
|
|
BLAKE2b-256 checksum How to use checksums |
c44463dd05eb92f1797b9b074b29e06c85f6778d3ac02e4efec3d8f73e2e41b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tomo_sdk-1.0.0-py3-none-any.whl
| Download URL | tomo_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 117.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7310347a2c6b0d97b1ffc139a86d790b881437d55cd64477a1eba004a9ef909
|
|
BLAKE2b-256 checksum How to use checksums |
672f10e1a3cf276f11d9a06685dfb7328c0d3225ab556a06f577a892765b3219
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for tomo-sdk 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.