A newer version of Hazelcast CLC is available.

View latest

clc sql

Executes a SQL statement.

Usage:

clc sql [query] [flags]

Parameters:

Parameter Required Description Default

--format, -f

Optional

Output format. Supported formats:

  • csv

  • delimited

  • json

  • table

delimited in non-interactive mode, table in interactive mode.

Global parameters
Parameter Description Default

--config, -c

Path to the configuration file in YAML format.

The following locations are tried in order for the existence of config.yaml

  1. Current working directory

  2. The parent directory of the clc executable

  3. $CLC_HOME/default directory

--format, -f

Set the output format

  • csv

  • delimited: By tab characters

  • json

  • table

  • Interactive mode: table

  • Non-interactive mode: delimited

--log.level

Set the log level, one of:

  • debug

  • info

  • warning

  • error

info

--log.path

Set the log path. Use stderr to log to the screen (stderr).

$CLC_HOME/logs/YYYY-MM-DD.log where YYYY-MM-DD is today’s date.

--quiet, -q

Prevent displaying unnecessary output.

false

--verbose

Enable output with more information.

false

Querying with SQL using the Hazelcast CLC

You can run SQL queries in both interactive and non-interactive mode of the Hazelcast CLC.

  • Non-Interactive mode

  • Interactive mode

$ clc sql -c prod "SELECT * from cities"
1	United Kingdom	London	9540576
4	United States	Los Angeles	3985520
5	Turkey	Ankara	5309690
7	Brazil	Sao Paulo	22429800
clc
CLC> SELECT * FROM cities
---------------------------------------------------------------------------------
      __key | country                   | city                      | population
---------------------------------------------------------------------------------
          1 | United Kingdom            | London                    |    9540576
          4 | United States             | Los Angeles               |    3985520
          5 | Turkey                    | Ankara                    |    5309690
          7 | Brazil                    | Sao Paulo                 |   22429800
---------------------------------------------------------------------------------