Registry / llm-agents / llama-index-storage-docstore-postgres

llama-index-storage-docstore-postgres

JSON →
library0.5.0pypypiunverified

A LlamaIndex integration for storing document metadata (docstore) in PostgreSQL. Current version 0.5.0 requires Python >=3.10 and <4.0. Release cadence follows LlamaIndex's package updates.

pip install llama-index-storage-docstore-postgres
INSTALL
IMPORT
SIG · LLAMA-INDEX-STORAG
L
llama-index-storage-docstore-postgres
llm-agentspythonv0.5.0
Install
19.1s avg
Import
Disk
267MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 253.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 19.1s · import 0.000s · 255MB
267MB installed
● package 267MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PostgresDocStore
from llama_index.storage.docstore.postgres import PostgresDocStore
from llama_index.storage.docstore.postgres import PostgresDocStore

Initialize a PostgreSQL-backed document store using a connection URI.

import os from llama_index.storage.docstore.postgres import PostgresDocStore # Set up connection (use environment variables for safety) connection_string = os.environ.get( "POSTGRES_CONNECTION_STRING", "postgresql+asyncpg://user:pass@localhost:5432/llamaindex" ) docstore = PostgresDocStore.from_uri( connection_string=connection_string, table_name="docstore", # optional schema_name="public" # optional ) print("PostgresDocStore created successfully")
Debug
Known issues
deprecatedThe class `PostgresDocStore` is deprecated in favor of unified storage backends. Expect removal in future LlamaIndex versions.
fix
Migrate to `llama-index-storage-docstore-postgres` with new API or use `VectorStoreIndex` with PostgreSQL.
affects: >=0.5.0
gotchaPostgresDocStore uses asyncpg by default, so you must use an async-compatible connection string (e.g., `postgresql+asyncpg://`). Sync drivers like `psycopg2` will fail.
fix
Use async driver prefix: `postgresql+asyncpg://...` or `postgresql+psycopg://...` if using psycopg3 async.
affects: >=0.3.0
gotchaTable and schema names must exist or be auto-created; auto-creation may fail in restricted environments.
fix
Ensure the PostgreSQL user has CREATE TABLE privileges on the schema, or manually create the docstore table beforehand.
affects: all
Upgrade
Version history
0.5.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
llama-index-corerequiredCore LlamaIndex abstractions
asyncpgrequiredPostgreSQL async driver
sqlalchemyrequiredORM for PostgreSQL
psycopg2-binaryoptionalPostgreSQL adapter
Agent activity
20 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
llama-index-storage-docstore-postgres — pip install llama-index-storage-docstore-postgres · libregistry