insert-from-python

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

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

Documentation

Overview

Command insert-from-python runs a Go worker for jobs enqueued by a Python script through the SQL contract foreman_insert_job (CONTRACTS C5).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL