skillfed

pgvecto-rs

Python binding for pgvecto.rs

pgvecto-rs v0.2.2 231.6K downloads/30d#9,084 on PyPI
Permissive license Apache-2.0 DORMANT released

What it is and what it does

pgvecto-rs is a Python client library for PGVecto.rs, a PostgreSQL extension that adds native vector data types and approximate nearest-neighbor search capabilities. It bridges Python applications to PostgreSQL by providing type mappings and helper functions for four vector types: standard vectors, sparse vectors, half-precision vectors, and binary vectors. The library integrates with three major Python database frameworks—SQLAlchemy, Psycopg3, and Django—allowing developers to store, index, and query embeddings through their ORM or query interface.

The package handles vector insertion, approximate indexing via HNSW and IVF algorithms, and distance-based queries. It requires a running PGVecto.rs PostgreSQL instance and supports Python 3.8 through 3.12. Because the package is dormant with no recent updates, users should verify compatibility with their target PostgreSQL and PGVecto.rs versions before adopting it in production.

Use it for:

  • Store and query embeddings from machine learning models in PostgreSQL using ORM without writing raw SQL.
  • Perform approximate nearest-neighbor searches on vector embeddings with HNSW or IVF indexing for semantic search or recommendation systems.
  • Bulk-load large sets of vectors into PostgreSQL via Psycopg3's COPY interface for efficient data ingestion.
  • Define vector fields in Django models and run similarity queries through the ORM without custom database functions.
  • Support multiple vector representations (full-precision, sparse, half-precision, binary) in a single PostgreSQL database for different use cases.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python bindings for PGVecto.rs, a PostgreSQL vector database extension, with support for multiple vector types and integration with SQLAlchemy, Psycopg3, and Django.

Yes, if you are already committed to PGVecto.rs and need Python ORM integration. The library has low install friction, but its dormant maintenance status (675 days since last release) means no updates for security, compatibility, or bugs. Install only if you can tolerate stalled upstream development and verify compatibility with your PostgreSQL and PGVecto.rs versions independently.

Install

pgvecto-rs on PyPI

pip

pip install pgvecto-rs

uv

uv add pgvecto-rs

poetry

poetry add pgvecto-rs

Installing pgvecto-rs

Before you install

Low install friction with only two runtime dependencies (numpy and toml). However, the package is dormant—last release was 675 days ago—so maintenance updates and bug fixes are unlikely.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions.

Quickstart

pip install pgvecto_rs

from pgvecto_rs.sqlalchemy import Vector

# Define a model with a vector column
class Item:
    embedding = Vector(3)

# Insert vectors and query by distance
# session.execute(insert(Item).values(embedding=[1, 2, 3]))
# session.scalars(select(Item).filter(Item.embedding.l2_distance([3, 1, 2]) < 5))

Requires a running PGVecto.rs PostgreSQL instance (e.g., via Docker) and the vectors extension enabled in the database.

Verify before relying

  • Whether the package remains compatible with current PostgreSQL and PGVecto.rs server versions despite dormant maintenance status.
  • Performance characteristics and scalability limits for different vector types and index strategies.
  • Community support or active forks available if upstream development remains stalled.

Package facts

License Apache-2.0 (permissive)
Python support capped below the current Python release (<3.13,>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 2 — numpy, toml
Maintenance dormant — 675 days since the last release
First released
Downloads 231,563/month — #9,084 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pgvecto_rs-0.2.2-py3-none-any.whl

Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

postgresql vector database pythonpgvecto.rs python bindingsvector similarity search postgresvector embeddings databaseapproximate nearest neighbor indexpostgres vector typesvector indexing python
vector-databaseorm-integrationembeddings

More Database packages