Capture Output to a File in YCQL

The YCQL shell (ycqlsh) is a CLI for interacting with YugabyteDB using YCQL.

From within ycqlsh you can send output to a file instead of to the screen using the CAPTURE command.

Example:

				
					cassandra@ycqlsh> SELECT * FROM my_application.t;

 c1 | c2 | c3
----+----+----
  1 |  A |  X
  2 |  B |  Y
  3 |  C |  Z

(3 rows)

cassandra@ycqlsh> CAPTURE '/root/t_data.txt';
Now capturing query output to '/root/t_data.txt'.

cassandra@ycqlsh> SELECT * FROM my_application.t;

cassandra@ycqlsh> CAPTURE OFF;

cassandra@ycqlsh> exit;

[root@localhost ~]# cat /root/t_data.txt

 c1 | c2 | c3
----+----+----
  1 |  A |  X
  2 |  B |  Y
  3 |  C |  Z

(3 rows)
				
			

Have Fun!

Manatee Beach - Anna Maria Island, FL