Skip to main content
All CData CLI commands return results as JSON. By default, output is pretty-printed for readability. Use --compact anywhere to get single-line JSON, which is useful for piping to other tools.

Query results

By default, the query sql command returns a JSON object with a single top-level key, resultset:
  • resultset is an array containing the rows returned by the driver. Each row is an object whose keys are the column names.
Add the --metadata flag to include a second top-level key, metadata:
  • metadata contains information about the columns returned. It is an array with one entry per column, describing the column’s label and name, its type (jdbcType and typeName), nullability, precision, scale, display size, and the source tableName, schemaName, and catalogName.

Including column metadata

Add --metadata to include the metadata array alongside the resultset:

Compact (single-line)

Add --compact to collapse the JSON onto a single line:

Using with jq

The --compact flag makes it easy to pipe output to tools like jq. Use the resultset key to access the returned rows: