Command-line client
The curral binary is also a client.
export CURRAL_URL=https://curral.example.comexport CURRAL_TOKEN=curral_... # or CURRAL_USER and CURRAL_PASSWORD
curral query "SELECT * FROM orders LIMIT 10" # CSV on stdoutcurral query -f arrow -o orders.arrow "SELECT * FROM orders"curral query -p 42 "SELECT * FROM orders WHERE id = \$1"echo "DELETE FROM orders" | curral query --dry-run -f jsonTo avoid putting a password in shell history:
read -rs CURRAL_PASSWORD && export CURRAL_PASSWORDOptions
Section titled “Options”| Option | Default | |
|---|---|---|
-url |
$CURRAL_URL or http://127.0.0.1:8080 |
server URL |
-user |
$CURRAL_USER |
Basic auth user |
-f |
csv |
csv, json, ndjson or arrow |
-d |
database for unqualified names | |
-o |
stdout | write the result to a file |
-p |
parameter $1, $2, … as a JSON scalar, repeatable |
|
-max-rows |
server limit | return at most this many rows |
-dry-run |
show the decision without executing | |
-timeout |
none | client-side timeout |
-ca |
PEM file with the server’s CA | |
-insecure |
skip TLS verification (testing only) |
The SQL can be an argument or come from stdin. curral query exits with an
error code on error responses and when a result arrives incomplete.