Prebuilt binaries for several platforms are available under Github releases.
On macOS, the prebuilt binary can be installed using Homebrew.
bash
$ brew tap bruceadams/utilities
$ brew install query-rds-data
If you have the Rust tool chain installed,
cargo install query-rds-data
will work.
This project is written in Rust. The way to install Rust is from
Rustup.rs. Once Rust is installed on your machine,
running cargo build
in the root of this checkout should just work
and produces a debug binary in target/debug/query-rds-data
.
```bash $ cargo build # The first build takes longer, with more output Finished dev [unoptimized + debuginfo] target(s) in 0.22s $ target/debug/query-rds-data --help query-rds-data 1.0.0 Query an Amazon RDS database
USAGE:
query-rds-data [FLAGS] [OPTIONS]
ARGS:
FLAGS: -h, --help Prints help information -v, --verbose Increase logging verbosity (-v, -vv, -vvv, etc) -V, --version Prints version information
OPTIONS:
-c, --db-cluster-identifier
-f, --format <format>
Output format. One of "csv", "cooked", "raw" [default: csv]
-p, --aws-profile <profile>
AWS source profile to use. This name references an entry in
~/.aws/config
-r, --aws-region <region>
AWS region to target [env: AWS_DEFAULT_REGION=] [default:
us-east-1]
-u, --db-user-identifier <user-id>
RDS user identifier (really the AWS secret identifier)
[env: AWS_RDS_USER=]
```
I hope that the error messages from query-rds-data
are helpful
for figuring out what went wrong and how to address the issue.
```bash
$ query-rds-data "select * from db1.names" Error: No DBs found $ query-rds-data "select * from db1.names" --db-cluster-identifier nope Error: No DB matched "nope", available ids are []
$ query-rds-data "select * from db1.names" --db-cluster-identifier nope Error: No DB matched "nope", available ids are ["demo"]
$ query-rds-data "select * from db1.names" Error: No DB user secrets found $ query-rds-data "select * from db1.names" --db-user-identifier fake Error: No DB user matched "fake", available users are []
$ query-rds-data "create database db1" "" $ query-rds-data "create table db1.names (id int, name varchar(64))" "" $ query-rds-data "insert into db1.names values (1,'Bruce')" "" $ query-rds-data "select * from db1.names" id,name 1,Bruce $ query-rds-data "select * from informationschema.tables where tableschema='db1'" TABLECATALOG,TABLESCHEMA,TABLENAME,TABLETYPE,ENGINE,VERSION,ROWFORMAT,TABLEROWS,AVGROWLENGTH,DATALENGTH,MAXDATALENGTH,INDEXLENGTH,DATAFREE,AUTOINCREMENT,CREATETIME,UPDATETIME,CHECKTIME,TABLECOLLATION,CHECKSUM,CREATEOPTIONS,TABLECOMMENT def,db1,names,BASE TABLE,InnoDB,10,Compact,0,0,16384,0,0,0,NULL,NULL,NULL,NULL,latin1swedishci,NULL,,
$ query-rds-data "select * from db1.names" --db-cluster-identifier demo id,name 1,Bruce $ query-rds-data "select * from db1.names" --db-user-identifier admin id,name 1,Bruce $ query-rds-data "select * from db1.names" --db-cluster-identifier demo --db-user-identifier admin id,name 1,Bruce
$ query-rds-data "select * from db1.names" --db-cluster-identifier nope Error: No DB matched "nope", available ids are ["demo"] $ query-rds-data "select * from db1.names" --db-user-identifier fake Error: No DB user matched "fake", available users are ["admin"]
$ query-rds-data "select * from db1.names" Error: Multiple DBs found, please specify one of ["demo", "empty"] $ query-rds-data "select * from db1.names" --db-cluster-identifier demo Error: Multiple DB users found, please specify one of ["admin", "readonly"] $ query-rds-data "select * from db1.names" --db-cluster-identifier demo --db-user-identifier readonly id,name 1,Bruce ```