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
- Syntax:
Optional Arguments
qsize— the maximum number of data records to be retrieved- syntax:
qsize=<int> - unit of measurement: units
- default value: 1000000
- syntax:
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:
- Retrieves data from the
hr.employee_listtable - Filters records, leaving only employees with the status
Dismissed - Limits the output to only the
user_namefield
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:
- The inner subquery
clicksource 'hr.employee_list'retrieves a list of dismissed employees - The
fields user_namecommand limits the output to only usernames - The
formatcommand converts the result to a format suitable for use in a filter - The outer query searches for records in
accessLogsthat match the criteria from the subquery
clicksource accessLogs
| search [ clicksource 'hr.employee_list'
| search status="Dismissed"
| fields user_name
| format ]