Skip to main content
Version: 5.7.1

clc sql

Executes a SQL statement.

Usage:

bash
clc sql [query] [flags]

Parameters:

ParameterRequiredDescriptionDefault
--use-mapping-suggestionOptionalExecutes the proposed CREATE MAPPING suggestion and retries the query.false
Global parameters
ParameterDescriptionDefault
--config, -cName of the configuration or 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.pathSet 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, -qPrevent displaying unnecessary output.false
--verboseEnable output with more information.false
--timeout

Timeout for operation to complete.

The duration is a string in the form of AMOUNTunit where AMOUNT is an integer, and unit is one of the following:

  • ms: milliseconds
  • s: seconds
  • m: minutes
  • h: hours

Underscore (_) character is ignored in the AMOUNT. unit is optional and defaults to s if not specified.

The following are a few of the valid DURATIONs:

  • 5: 5 seconds
  • 5s: 5 seconds
  • 10000ms: 10000 milliseconds
  • 10_000_000ms: 10000000 milliseconds
warning

This is a client-side timeout, the operation you started maybe in progress on the server-side even if the given timeout is exceeded.

Querying with SQL using the Hazelcast CLC​

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

bash
$ clc sql -c prod "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
---------------------------------------------------------------------------------