Overview
This node enables interaction with a ClickHouse database, supporting two main operations: querying data and inserting rows. The "Query" operation allows users to execute custom SQL queries against the ClickHouse database and retrieve results. This is useful for extracting specific datasets, performing analytics, or integrating ClickHouse data into workflows. For example, you might query product information filtered by quantity and price thresholds.
Properties
Name | Meaning |
---|---|
Query | The SQL query string to execute on the ClickHouse database. Supports n8n expressions and ClickHouse query parameters. Example: SELECT id, name FROM product WHERE quantity > {quantity:Int32} AND price <= {price:Int32} |
Output
The output consists of an array of items where each item contains a json
field representing one row from the query result. Each json
object corresponds to a single record returned by the executed SQL query, with keys matching the selected columns.
Example output structure:
[
{
"json": {
"id": 123,
"name": "Product A"
}
},
{
"json": {
"id": 456,
"name": "Product B"
}
}
]
No binary data output is produced by this operation.
Dependencies
- Requires a ClickHouse database accessible via network.
- Needs credentials including host URL, database name, username, and password.
- Uses the official ClickHouse client library (
@clickhouse/client
) for communication. - The node requires proper configuration of these credentials within n8n to establish a connection.
Troubleshooting
- Connection errors: If the node fails to connect, verify that the ClickHouse server URL, database name, username, and password are correct and that the server is reachable.
- Query syntax errors: Invalid SQL queries will cause errors. Ensure the query syntax matches ClickHouse SQL dialect and that any parameters used are correctly formatted.
- Empty results: If no data is returned, check the query conditions and ensure the database contains matching records.
- Credential test failure: Use the credential test feature to confirm connectivity before running queries.