{"id":23981,"library":"llama-index-storage-kvstore-postgres","title":"LlamaIndex KVStore Postgres Integration","description":"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.","status":"active","version":"0.5.0","language":"python","source_language":"en","source_url":"https://github.com/run-llama/llama_index/tree/main/llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-postgres","tags":["llama-index","kvstore","postgres","vector-store","storage"],"install":[{"cmd":"pip install llama-index-storage-kvstore-postgres","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"PostgreSQL async client","package":"asyncpg","optional":false},{"reason":"ORM for schema management","package":"sqlalchemy","optional":false},{"reason":"Core LlamaIndex abstractions","package":"llama-index-core","optional":false}],"imports":[{"note":"Old import path before 0.5.0","wrong":"from llama_index.kvstore.postgres import PostgresKVStore","symbol":"PostgresKVStore","correct":"from llama_index.storage.kvstore.postgres import PostgresKVStore"}],"quickstart":{"code":"from llama_index.storage.kvstore.postgres import PostgresKVStore\n\nkvstore = PostgresKVStore(\n    connection_string=\"postgresql://user:pass@localhost:5432/dbname\",\n    table_name=\"kvstore\",\n    schema_name=\"public\"\n)\n# Example: set and get\nkvstore.put(key=\"test_key\", val={\"data\": \"value\"})\nresult = kvstore.get(key=\"test_key\")\nprint(result)","lang":"python","description":"Initialize a PostgresKVStore with connection string and perform basic put/get operations."},"warnings":[{"fix":"Update imports: from llama_index.storage.kvstore.postgres import PostgresKVStore","message":"In version 0.5.0, the import path changed from llama_index.kvstore.postgres to llama_index.storage.kvstore.postgres.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Set create_table=True on initialization or run CREATE TABLE IF NOT EXISTS statement.","message":"PostgresKVStore does not automatically create the specified table; it must exist or be created via the `create_table` parameter or manually.","severity":"gotcha","affected_versions":"all"},{"fix":"Use synchronous put/get methods; if async needed, use asyncio loop with run_in_executor.","message":"The `async_put` and `async_get` methods are deprecated in favor of synchronous versions; async support may be removed in future releases.","severity":"deprecated","affected_versions":">=0.4.0,<1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use from llama_index.storage.kvstore.postgres import PostgresKVStore","cause":"Import path changed in 0.5.0","error":"ModuleNotFoundError: No module named 'llama_index.kvstore'"},{"fix":"Set create_table=True or pre-create the table: CREATE TABLE IF NOT EXISTS public.kvstore (key TEXT PRIMARY KEY, data JSONB);","cause":"Table not created automatically","error":"sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation \"kvstore\" does not exist"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}