cockroachdb

Is there a way to modify the output format of cockroach DB's cli?


Is there a way to modify the output format of cockroach sql to only return the results? I've tried csv and raw closest thing to this is csv but it still adds the header + timing info at the end, can probably strip those out by piping into a different command but wanted to check if I'm missing some native option.


Solution

  • you do something like this

    ./cockroach sql --insecure --set='show_times=false' --execute='select * from table1 limit 10' --format='csv'
    

    Execution time would be hidden. Though the header will still be there, it should be easy enough to just strip the first line.