Insert from Python
A Python script (plain psycopg 3, run through uv) enqueues a job with the SQL contract foreman_insert_job(kind, args, opts); a Go worker runs it. The script inserts the same unique job twice and gets the same id back. Requires uv (it fetches Python 3.12 and psycopg into its cache on first run).
Run
docker compose -f deploy/docker-compose.yml up -d --wait postgres
go run ./examples/insert-from-python
The example connects to FOREMAN_DATABASE_URL (default
postgres://foreman:foreman@localhost:55432/foreman?sslmode=disable) and recreates its own schema
on every run.
Expected output
python inserted job 1; unique duplicate returned job 1
go worker sending "welcome" to ada@example.com
job 1 completed