ybq -h mywh -U admin -d mydb -c "SELECT COUNT(*) FROM users" ybq -h mywh -U admin -d mydb -W mypassword -c "SELECT 1" Read query from file ybq -h mywh -U admin -d mydb -f /path/to/long_query.sql 7. Output Formats Control how results are displayed. Human-aligned table (default) ybq -h mywh -U admin -d mydb -c "SELECT * FROM sales LIMIT 3" CSV output ybq -h mywh -U admin -d mydb --csv -c "SELECT * FROM sales" > sales.csv JSON output ybq -h mywh -U admin -d mydb --json -c "SELECT * FROM sales LIMIT 2" Tab-separated ybq -h mywh -U admin -d mydb --tuples-only -c "SELECT * FROM sales" Quiet mode (no headers, no row count) ybq -t -c "SELECT name FROM products" 8. Environment Variables Set these to avoid typing connection details every time.
| Variable | Purpose | |----------|---------| | YB_HOST | Database host | | YB_PORT | Port (default 5432) | | YB_DATABASE | Database name | | YB_USER | Username | | YB_PASSWORD | Password (not recommended for scripts) | | YB_SSLMODE | SSL mode | export YB_HOST="mywh.yellowbrick.cloud" export YB_PORT="5432" export YB_DATABASE="analytics" export YB_USER="readonly_user" export YB_SSLMODE="verify-full" Then simply run: yellowbrick query tool
ybq -h mywh.yellowbrick.cloud -U admin -d mydb | Command | Description | |---------|-------------| | \? | Help | | \q | Quit | | \d | List tables | | \d table_name | Describe table | | \dt | List only tables | | \dv | List views | | \di | List indexes | | \l | List databases | | \dn | List schemas | | \timing | Toggle query execution time display | | \copy ... | Execute copy command | | \! [cmd] | Execute shell command | Example session \dt SELECT COUNT(*) FROM orders; \timing SELECT SUM(amount) FROM orders WHERE date >= '2025-01-01'; \q 6. Single-Shot (Script) Mode Run a single query and exit. Great for cron jobs and ETL scripts. ybq -h mywh -U admin -d mydb -c
TechSansar.com, ICT For Media Pvt Ltd, Regd #249079/077/078, VAT #609868175.
By continuing to use this site, you agree to our cookies and privacy policies.
Here is our Do Not Track (DNT) Guide. Hosted on a VPS and uses this free PDF tool. You can also subscribe to our newsletter.
Creating tech contents for the b̶o̶t̶s̶ humans since 2009 • Team TechSansar • ICT4M with ❤ from Nepal