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

llama-index-storage-kvstore-postgres

JSON →
library0.5.0pypypi✓ verified 85d ago

PostgreSQL-backed key-value store for LlamaIndex, enabling persistent storage of index metadata and documents. Currently at version 0.5.0, follows LlamaIndex's release cadence but is a relatively stable integration.

pip install llama-index-storage-kvstore-postgres
INSTALL
IMPORT
SIG · LLAMA-INDEX-STORAG
L
llama-index-storage-kvstore-postgres
llm-agentspythonv0.5.0
Install
19.1s avg
Import
5746ms
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 4.796s · 253.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 19.1s · import 4.398s · 255MB
267MB installed
● package 267MB
Code
Verified usage

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

PostgresKVStore
from llama_index.storage.kvstore.postgres import PostgresKVStore
from llama_index.kvstore.postgres import PostgresKVStore
Old import path before 0.5.0

Initialize a PostgresKVStore with connection string and perform basic put/get operations.

from llama_index.storage.kvstore.postgres import PostgresKVStore kvstore = PostgresKVStore( connection_string="postgresql://user:pass@localhost:5432/dbname", table_name="kvstore", schema_name="public" ) # Example: set and get kvstore.put(key="test_key", val={"data": "value"}) result = kvstore.get(key="test_key") print(result)
Debug
Known issues
breakingIn version 0.5.0, the import path changed from llama_index.kvstore.postgres to llama_index.storage.kvstore.postgres.
fix
Update imports: from llama_index.storage.kvstore.postgres import PostgresKVStore
affects: >=0.5.0
gotchaPostgresKVStore does not automatically create the specified table; it must exist or be created via the `create_table` parameter or manually.
fix
Set create_table=True on initialization or run CREATE TABLE IF NOT EXISTS statement.
affects: all
deprecatedThe `async_put` and `async_get` methods are deprecated in favor of synchronous versions; async support may be removed in future releases.
fix
Use synchronous put/get methods; if async needed, use asyncio loop with run_in_executor.
affects: >=0.4.0,<1.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'llama_index.kvstore'
Import path changed in 0.5.0
fix
Use from llama_index.storage.kvstore.postgres import PostgresKVStore
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "kvstore" does not exist
Table not created automatically
fix
Set create_table=True or pre-create the table: CREATE TABLE IF NOT EXISTS public.kvstore (key TEXT PRIMARY KEY, data JSONB);
Upgrade
Version history
0.5.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
asyncpgrequiredPostgreSQL async client
sqlalchemyrequiredORM for schema management
llama-index-corerequiredCore LlamaIndex abstractions
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
2
Resources
llama-index-storage-kvstore-postgres — pip install llama-index-storage-kvstore-postgres · libregistry