Skip to content
Berkay Günaydın edited this page Aug 6, 2026 · 2 revisions

propq — Async SQL Executor

propq runs SQL queries across multiple MySQL/MariaDB servers concurrently from a single command. One binary, one TOML config file, zero daemons.

# Run a query on every production database
propq --sql "SELECT COUNT(*) FROM users" -s prod

# Migration file with filter
propq -f migration.sql -d "^shop_"

# Pipe it
echo "SELECT NOW(), DATABASE()" | propq -s staging

# Live streaming results
propq -s "www1|www6|www7" --sql "SELECT VERSION()" --stream

# CI-friendly JSON
propq --sql "SHOW TABLE STATUS" -s prod --json

# See what would happen, safely
propq --sql "DROP TABLE temp" --dry-run

Highlights

  • Async execution — goroutine pool + per-server semaphores. Default mode runs once per server (~50 ms); -a switches to per-database mode.
  • 📥 4 SQL sources — inline (--sql), file (-f), pipe (stdin), editor (-e).
  • 🎯 Smart filtering — regex on server names (-s), database names (-d / -D), tags (-t).
  • 📊 3 output formats — table (human), --json (AI/scripts), --csv (Excel).
  • 📖 Pager integration — auto-pages through less -SRFX; --no-pager to disable.
  • 🛡️ Safety first — destructive SQL requires --force, confirmation when no filter is set, --ask-for-commit.
  • 🔄 Retry--retry N with exponential backoff for flaky connections.
  • 🔴 Live streaming--stream prints results as they complete.
  • 🎛️ Config-oriented — everything lives in propq.toml; CLI flags override.

Quick start

# 1. Install
go install github.com/v0id00/propq/cmd/propq@latest

# 2. Create config
cp propq.toml.example propq.toml   # or: propq config generate
# edit propq.toml with your server details

# 3. Verify
propq servers              # list servers + live DB counts
propq config check         # validate config, test connections

# 4. First query
propq -s local --sql "SELECT VERSION(), NOW()"

Documentation

Page What's in it
Installation Go install, binaries, build from source, completion
Getting-Started First steps: config → servers → query
Configuration Every propq.toml key explained
CLI-Reference All flags and subcommands
Output-Formats Table, JSON, CSV, pager, streaming, history
Safety Destructive SQL protection, transactions, dry-run
Examples Real-world command recipes
AI-Agents JSON output + propq skill install
Development Build, test, lint, contributing

How it works

SQL → Scanner → Config → Runner → Display → stdout
                    ↓
               Filter (regex + tags)
                    ↓
               Async executor (goroutines + per-server semaphore)
                    ↓
               Result collection (with optional streaming)
  1. Scanner reads SQL from argument, file, pipe, or editor (with history)
  2. Config loads server connections from TOML
  3. Filter applies -s / -d / -D / -t regex and optional editor picker
  4. Runner executes concurrently with per-server semaphores, retries on failure
  5. Display formats results as table, JSON, or CSV (optionally paged)

License

MIT — see LICENSE.

Clone this wiki locally