kumpul2 is a lightweight, configurable ETL (Extract, Transform, Load) service written in Go. It executes SQL queries against multiple configured PostgreSQL databases, writes the results to target tables, and optionally dumps them to JSON files. It supports both one-off execution and cron-based scheduling, with built-in Slack alerting.
- Multi-Database Support: Execute queries across multiple configured PostgreSQL connections (pgx).
- Flexible Configuration: Split configuration for runtime options (schedule, alerts, DBs) and query definitions.
- Scheduling: Built-in cron scheduler or run-once mode.
- Alerting: Slack notifications with configurable severity thresholds (
error,warning,info). - Output Options:
- Write results directly to target tables.
- Dump results to JSON files for debugging or external processing.
- Safety & Observability:
- Dry-run mode to validate configuration.
- Structured logging via
log/slog. - Timeout management for queries.
- Go 1.25 or higher
- Docker (required only for running integration tests)
Configuration is managed via TOML files.
Defines the environment, database connections, and scheduling.
cron: Cron expression for scheduling (e.g.,"*/5 * * * *").slack_alert_url: Webhook URL for Slack notifications.slack_alert_level: Alert threshold (error,warning,info).timeout_seconds: Global timeout for query execution.[[db]]: Array of database configurations (id,connectionstring).
Defines the ETL tasks.
[[query]]: Array of query definitions.id: Unique identifier for the query.query: The SQL statement to execute.target_table: The table where results should be written.
See config.example.toml and queries.example.toml for templates.
The default mode runs the scheduler continuously.
go run ./cmd/etl --option options.toml --query queries.tomlRun immediately and exit. Useful for manual runs or external schedulers.
go run ./cmd/etl --option options.toml --query queries.toml --once| Flag | Description |
|---|---|
--option |
Path to the options configuration file (default: options.toml). |
--query |
Path to the queries configuration file (default: queries.toml). |
--verbose |
Enable debug logging. |
--dry-run |
Validate configuration and connections without executing queries. |
--dump |
Save query results to JSON files. |
--once |
Execute all queries once and exit. |
To build the project, run:
go build -o bin/etl ./cmd/etlThe binary will be located in the bin/ directory.
Unit tests:
go test ./...Integration tests (requires Docker):
go test ./internal/integration/...