Simplify cqlsh command results in Linux terminal

Is there a way to prefix the results of cql commands in a Linux terminal when using the cqlsh utility (cql version of Mongo.pretty ())? It is difficult to read the results when the output is displayed normally, especially when there are attached documents and arrays

+7
cassandra cql3 cqlsh
source share
2 answers

Perhaps you are interested in the EXPAND team?

Use: EXPAND ON;

From the documentation in Datastax:

This command displays the contents of each row of the table vertically, providing a more convenient way to read long rows of data than the standard horizontal format. You scroll down to see more lines instead of scrolling right. Each column name is displayed on a separate line in the first column, and the values ​​are displayed in column 2.

Source: https://docs.datastax.com/en/cql/3.3/cql/cql_reference/expand.html

+16
source share

cqlsh is a python script that uses datastax python-driver to make requests to cassandra. You can modify the script to suit your needs (see Why cqlsh alignment strings? For an example), or you can write a program using python-driver or another library to do what you need.

Since mongo is document-oriented, it makes sense that a pretty-printed version is an available option. However, cassandra is more columnar / row-oriented, so you usually don’t look at result sets such as documents, instead you look at them more like strings, although I see the usefulness of the “pretty printable” function.

+2
source share

All Articles