Skip to content

Query Command

The query command executes and retrieves the results of a query on a specified connection and returns the results on the terminal in either table format or as a JSON object.

Flags:

FlagAliasDescription
--connection-cThe name of the connection to use (required).
--query-qThe SQL query to execute (required).
--output [format]-oSpecifies the output type, possible values: plain, json.

Example

bash
query --connection my_connection --query "SELECT * FROM table"

Example output:

plaintext
+-------------+-------------+----------------+
|   Column1   |   Column2   |    Column3     |
+-------------+-------------+----------------+
| Value1      | Value2      | Value3         |
| Value4      | Value5      | Value6         |
| Value7      | Value8      | Value9         |
+-------------+-------------+----------------+