-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Berkay Günaydın edited this page Aug 6, 2026
·
1 revision
Ready-to-use recipes. All of these assume servers are defined in propq.toml.
# Version + current database on a set of servers (per-server mode, ~50 ms each)
propq -s "www1|www6|www7" --sql "SELECT VERSION()"
# Same server, per-database mode with filter
propq -s www6 -a -d "^kwebticari_30" --sql "SELECT ps_no FROM tbpersonel LIMIT 5"
# Count users across every database whose name contains "300"
propq -s www6 -a -d "300" --sql "SELECT COUNT(*) FROM users"# JSON to a file (AI / reporting)
propq --json -o report.json --sql "SHOW TABLE STATUS" -s prod
# CSV for Excel
propq -s local --csv --sql "SELECT id, name, email FROM users" > users.csv
# Stream results live as they complete
propq -s www6 -a -d "300" --sql "SELECT COUNT(*) FROM users" --stream
# History of recent queries
propq --history# Run a migration file on all databases starting with "shop_"
propq -f migration.sql -d "^shop_"
# Run once per server (not per DB)
propq -f migration.sql -s prod
# Pipe a query straight in
echo "ALTER TABLE users ADD INDEX idx_email (email)" | propq -s staging --force# See exactly what would run, without running it
propq --json --dry-run --sql "DROP TABLE temp" -s prod
# Ask before committing a mass DELETE (per-database mode)
propq -s www6 -a -d "300" --ask-for-commit \
--sql "DELETE FROM logs WHERE date < NOW() - INTERVAL 30 DAY"
# Destructive SQL is blocked without --force — add it explicitly
propq -s prod --sql "TRUNCATE TABLE staging_cache" --force# Retry flaky connections 3 times with exponential backoff
propq -s "www1|www7" --retry 3 --sql "SELECT 1"
# Raise the global concurrency limit
propq -s prod --concurrency 10 --sql "SELECT COUNT(*) FROM users"
# Longer timeout for heavy queries
propq -s prod --timeout 120 --sql "OPTIMIZE TABLE big_table"# All servers tagged "prod" (OR semantics)
propq -t prod --sql "SELECT COUNT(*) FROM users"
# All servers tagged "eu" OR "us"
propq -t "eu,us" --sql "SELECT 1"# Write SQL in $EDITOR (history pre-fills)
propq -e
# Pick databases interactively from an editor list
propq -e -S
# Browse servers
propq servers
propq servers -s "www1|www7" --json# Exit-code signal for reachability
propq config check && echo "all servers up"
# Machine-readable status
propq -q --json -s prod --sql "SELECT 1" | jq -r '.[] | "\(.server) \(.status) \(.elapsed)"'
# Suppress rows, keep only the summary
propq -N --sql "SELECT 1" -s prodNext: AI-Agents
This wiki is community-maintained. Found something outdated? Open an issue on the repository.
propq — Async SQL executor for MySQL/MariaDB
- Home
- Installation
- Getting-Started
- Configuration
- CLI-Reference
- Output-Formats
- Safety
- Examples
- AI-Agents
- Development
External links