Is there a way to pretty print SELECT query result in ClickHouse?

Viewed 3377

Alternative in ClickHouse Select query to pretty print like in MySQL vertically.

For example -

SELECT * from table \g;

I found this resource but its just text https://clickhouse-docs.readthedocs.io/en/latest/formats/vertical.html

With --multiline as a parameter for clickhouse-client I am getting following error . Though i can use \G format as per one of the answer without this param :

 :) select * from hits_v1 limit 2; \G
:-] ;

Syntax error (Multi-statements are not allowed): failed at position 30 (end of query):

select * from hits_v1 limit 2; \G ;
2 Answers

ClickHouse supports this feature:

You can specify \G instead of or after the semicolon. This indicates Vertical format.

select * from numbers(2)\G
/* result
Row 1:
──────
number: 0

Row 2:
──────
number: 1
*/
select * from numbers(2);\G
/* result
Row 1:
──────
number: 0

Row 2:
──────
number: 1
*/
Related