Skip to main content
Version: 5.3

clicksource

Description

Allows retrieving data from a ClickHouse database.

Syntax

clicksource <db_name.table_name> [qsize=<int>]

Required Arguments

  • db_name.table_name
    • Syntax: <string>
    • Description: To access ClickHouse, it's important to specify both the database name and the table name within it. If only the table name is specified, the default database will be used

Optional Arguments

  • qsize — the maximum number of data records to be retrieved
    • syntax: qsize=<int>
    • unit of measurement: units
    • default value: 1000000

Connection Configuration

All connection settings are stored in settings.yml.

sme:
dbs:
clickhouse_connection_string: jdbc:clickhouse://127.0.0.1:9000

Examples

Example 1

This example demonstrates the basic usage of the clicksource command to retrieve data from the hr.employee_list table in the ClickHouse database. The query performs the following operations:

  1. Retrieves data from the hr.employee_list table
  2. Filters records, leaving only employees with the status Dismissed
  3. Limits the output to only the user_name field
clicksource 'hr.employee_list'
| search status="Dismissed"
| fields user_name

Example 2

This example demonstrates using a ClickHouse subquery as a dynamic filter for the main search. Execution process:

  1. The inner subquery clicksource 'hr.employee_list' retrieves a list of dismissed employees
  2. The fields user_name command limits the output to only usernames
  3. The format command converts the result to a format suitable for use in a filter
  4. The outer query searches for records in accessLogs that match the criteria from the subquery
clicksource accessLogs
| search [ clicksource 'hr.employee_list'
| search status="Dismissed"
| fields user_name
| format ]