Local Postgres (Staging DB)¶
Purpose: Staging and ETL database for data cleaning and normalisation before promoting records to Neon (canonical cloud store).
URL/Endpoint: localhost:5432 — database ai_memory
Auth: Username ai_memory, password ai_memory_local. Only accessible from within Docker network or the host machine — not reachable from cloud workers.
Key Operations¶
- Connect via CLI:
docker exec postgres psql -U ai_memory -d ai_memory - Browse via Adminer UI:
http://localhost:8181(server:postgres, user:ai_memory, password:ai_memory_local, db:ai_memory) - Run migrations:
docker exec postgres psql -U ai_memory -d ai_memory -f /path/to/migration.sql - Use
from ops.db_connect import get_connectionin Python — the helper returns local or Neon fallback automatically
Dependencies¶
- Docker stack (core — always running)
- pgvector extension (
pgvector/pgvector:pg16, vector dimension 768)
Related ADRs¶
- ADR-128: Data governance — historical/cleaning work stays in local Postgres
Runbook¶
All raw imports and data cleaning land here first. Once clean and deduplicated, sync to Neon via the daily sync_local_to_neon Task Scheduler job (runs at 5am). Never write unvalidated data directly to Neon.