Skip to main content

pgvector-zerodb

Drop-in pgvector wrapper with auto-provisioned Postgres. Zero config vector database.

pip install pgvector-zerodb

Quick Start

from pgvector_zerodb import auto_connect

# Automatically provisions a free Postgres with pgvector if no DATABASE_URL is set
conn = auto_connect()

cur = conn.cursor()
cur.execute("CREATE TABLE items (id serial PRIMARY KEY, embedding vector(3))")
cur.execute("INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]')")
conn.commit()

cur.execute("SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5")
print(cur.fetchall())

That's it. No database setup, no config files, no cloud console.

How It Works

  1. You call auto_connect()
  2. It checks for DATABASE_URL or PGVECTOR_ZERODB_URL environment variable
  3. If neither exists, it provisions a free managed Postgres with pgvector via AINative
  4. Credentials are saved to ~/.ainative/pgvector-config.json for reuse
  5. Returns a standard psycopg2 connection with pgvector types registered

Use Your Own Postgres

If you already have a Postgres instance with pgvector:

export DATABASE_URL="postgresql://user:pass@host:5432/dbname"
from pgvector_zerodb import auto_connect
conn = auto_connect()  # Uses your DATABASE_URL, no provisioning

Same pgvector API

Everything from pgvector is re-exported. Existing code works unchanged:

from pgvector_zerodb import register_vector
import psycopg2

conn = psycopg2.connect("postgresql://...")
register_vector(conn)

With SQLAlchemy

from pgvector_zerodb import get_connection_string
from sqlalchemy import create_engine

engine = create_engine(get_connection_string())

With Django

Add to settings.py:

from pgvector_zerodb import get_connection_string
import dj_database_url

DATABASES = {"default": dj_database_url.parse(get_connection_string())}

Environment Variables

Variable Description
DATABASE_URL PostgreSQL connection string (highest priority)
PGVECTOR_ZERODB_URL Alternative env var for connection string
AINATIVE_API_KEY API key for provisioning (optional, enables higher limits)
ZERODB_API_KEY Alternative API key env var

Free Tier

The auto-provisioned Postgres includes:

  • pgvector extension pre-installed
  • 256 MB storage
  • Shared compute
  • No credit card required

Upgrade at ainative.studio for dedicated resources.

License

MIT

Metadata

Release files for pgvector-zerodb 0.1.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 pgvector-zerodb 0.1.0
File Size Uploaded Provenance
pgvector_zerodb-0.1.0.tar.gz 7.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pgvector-zerodb 0.1.0
File Interpreter ABI Platform
pgvector_zerodb-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / pgvector_zerodb-0.1.0.tar.gz

Download URL pgvector_zerodb-0.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4639147ca767ed3f89371a837b05ff2f862cd748d37364b0b501ee1285eeb86e
BLAKE2b-256 checksum
How to use checksums
4e0d74c38412649392f08fa7328991bc0d594d5bc95fb64f720306a658c3b949
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / pgvector_zerodb-0.1.0-py3-none-any.whl

Download URL pgvector_zerodb-0.1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7daad4ebbdb96bc226462ec931c8d87edade89ce4daf8ae858f8e9546b2a67b0
BLAKE2b-256 checksum
How to use checksums
10776bc03cfe2cbf6ef2185f341dccc1e7219a331757c26fb8b95f2c11173722
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for pgvector-zerodb 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No 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