Can we get cbq output in csv format
I presume that’s a question rather than a request, so no, the output from cbq is the same as you get from the server’s REST endpoint as it isn’t an export tool, rather it is a general-purpose query execution tool and as such CSV wouldn’t be appropriate.
(If it is a request then I think it would be more appropriate to ask for cbexport to support CSV format and queries - https://issues.couchbase.com/browse/MB-43733).
You can however process the JSON output to produce CSV with tooling such as “jq” as covered here, for example: bash - Using jq to extract values and format in CSV - Unix & Linux Stack Exchange
The web-based query workbench can export query results in tab-separated format.
There are two ways to do this. The first is the “copy as tab-separated” button which copies the results as tab-separated so you can paste them in another application (such as excel):
The other approach is the export button in the upper right, which launches a dialog where you can select “tab-separated” and download those results as a file.
Because there is no way to represent arrays or sub-documents in the tab-separated format, when converting JSON data to tab-separated, all nested sub-documents are flattened to top-level fields, and arrays are converted to strings.
Thanks for your honest response
Thanks for your quick response
We understand that running big queries on web console cause more resource utilisation. So is there any way we can get this in tab seperated output format from cli?
To convert JSON results from cbq to comma or tab-separated, look at the ‘jq’ tool mentioned above by @dh.
That said, running queries via the web console does not utilize more resources than cbq. The web console may not be able to visually display results larger than a few megabytes, but those results are still in memory and may be exported.