ClickHouse icon

ClickHouse

Query and ingest data into ClickHouse

Actions2

Overview

This node integrates with a ClickHouse database, allowing users to either execute SQL queries or insert rows into a specified table. It is particularly useful for workflows that require interaction with large-scale analytical databases where fast data ingestion and querying are essential.

For the Insert operation, the node takes input data items and inserts them as rows into a specified ClickHouse table. This is beneficial when you want to automate data ingestion from various sources into ClickHouse for further analysis or reporting.

Example use case: Automatically inserting processed data from previous workflow steps into a ClickHouse table named "product" for real-time analytics.

Properties

Name Meaning
Table name The name of the ClickHouse table where the input data rows will be inserted. You can use expressions to dynamically set this value.

Output

  • For the Insert operation, the node does not produce any JSON output data because it performs an insertion action without returning rows.
  • If the node were used in the Query operation (not requested here), it would output an array of JSON objects representing each row returned by the query.
  • The node does not output binary data.

Dependencies

  • Requires a ClickHouse database accessible via network.
  • Needs credentials including host URL, database name, username, and password to connect to ClickHouse.
  • Uses the official @clickhouse/client library to interact with the database.
  • No additional environment variables or n8n configurations beyond providing valid ClickHouse credentials are necessary.

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.
  • Insertion failures: Ensure the input data matches the schema of the target table. Mismatched column names or types can cause errors.
  • Empty input data: If no input items are provided, the node will attempt to insert an empty array, which may result in no action or an error depending on ClickHouse settings.
  • Permission issues: The user must have INSERT privileges on the specified table.
  • Common error messages will relate to connection failures, authentication errors, or SQL exceptions during insertion. Checking the exact error message and verifying credentials and data format usually resolves these issues.

Links and References

Discussion