schema
module wittgenstein_kg_client.schema
Bootstrap the knowledge_graphs/nodes/edges tables on a fresh Postgres instance.
Functions
-
ensure_schema — Create the KG tables (and pgvector extension) if they don't exist yet.
wittgenstein_kg_client.schema.ensure_schema
ensure_schema(pg_dsn: str) → None
Create the KG tables (and pgvector extension) if they don't exist yet.
Idempotent — safe to call on every app startup. Only needed for
standalone consumers; the platform's agent_platform database manages
this schema via Alembic instead (see repository_structure_reference).
Also creates the HNSW index used by the RAG similarity search path (see schema.sql). Building that index for the first time against a table that already holds a large number of embedded rows can be slow/memory-heavy — see the comment above the index in schema.sql before calling this against a pre-populated database.