Skip to content

Script Development / ClickHouse

The ClickHouse Connector operation object mainly provides some data methods.

DFF.CONN(...) parameters are as follows:

Parameter Type Required / Default Description
connector_id str Required Connector ID
database str None Specified database

.query(...)

Execute SQL statements, parameters are as follows:

Parameter Type Required / Default Description
sql str Required SQL statement, which can contain parameter placeholders.
? represents parameters that need to be escaped;
?? represents parameters that do not need to be escaped
sql_params list None SQL parameters
Example
1
2
3
sql = 'SELECT * FROM ?? WHERE age > ?'
sql_params = ['demo_table', 50]
result = helper.query(sql, sql_params=sql_params)

Dynamic SQL Statements

query(...) and non_query(...) internally use DFF.SQL(...) to construct SQL statements and support the construction of complex dynamic SQL statements.

Such as WHERE IN (...) with an uncertain number of values, or INSERT INTO ... VALUES ... for batch data writing, etc.

For details, please refer to Script Development / SQL Construction DFF.SQL