If the output of a query cannot be properly displayed within the dimensions of the terminal used to issue the query, the ASCII-art used to draw the table layout usually breaks and becomes a more of a hinderance than a help when trying to read the displayed results.
This also happens a lot when using Cassandra's cqlsh
. Although there is the option EXPAND ON
to display the results in a line based layout, I would rather like to configure cqlsh
in a way, so that table output that is too big for the terminal, is automatically piped into a pager.
In PostgreSQL's psql utitliy, the pager configured in the environment variable PAGER
is automatically used as soon as the output doesn't fit into the terminal. Usually the less
command is used as pager. In MySQL you can use a command like PAGER less
to display all results through a the pager less
.
Is there a comparable feature available in cqlsh
?
If you want you can capture the output to a file and then run the file through a pager.
e.g run this command on cqlsh shell
CAPTURE '~/out.txt'
Now when you run any select command, the output is written to that file instead showing you in the terminal. you can page the file(out.txt) using less or more.
Here is the documentation : http://docs.datastax.com/en/cql/3.1/cql/cql_reference/capture_r.html
Also there is paging option in cqlsh. run the following command to see if its enabled or not
paging
run following to enable it
paging on
however it still displays 100 rows before it start paging. I am not sure if there is a way to configure paging to start paging as soon as the output goes more then one screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With