For just a one-shot command, cqlsh
4.1.1 also has a -e
option:
$cqlsh -e 'desc keyspaces' -u myusername -p mypassword localhost
branch stackoverflow products system_auth
customers system branches system_traces
If you have something complicated, like a multi-line sequence of commands, then the -f
option on cqlsh
should be what you want to do. To demo, I'll create a simple cql script file called descTables.cql
which looks like this:
$ cat descTables.cql
use stackoverflow;
desc tables;
Now, I'll invoke that cql script with cqlsh -f
:
$cqlsh -f descTables.cql -u myusername -p mypassword localhost
datasimple items
FYI- It looks like the most-recent version of 2.0 has cqlsh
4.1.1, which has the -e
flag. On one of my instances, I have 4.1.0 and the -e
option is not available.