ClickHouse icon

ClickHouse

Read and write data from ClickHouse.

Overview

This node allows users to execute SQL queries directly against a ClickHouse database. It is designed for scenarios where you need to read data from or write data to ClickHouse within an n8n workflow. Typical use cases include data extraction, transformation, and loading (ETL) processes, analytics queries, or integrating ClickHouse data with other systems.

For example, you could use this node to run a SELECT query to fetch recent sales data, or an INSERT query to add new records into a ClickHouse table.

Properties

Name Meaning
Query The SQL query to execute on the ClickHouse database. This can be any valid SQL statement supported by ClickHouse, such as SELECT, INSERT, UPDATE, or DELETE.

Output

The node outputs a JSON array under the json field containing the results of the executed query. Specifically, the output structure is:

[
  {
    "result": <query_result>
  }
]
  • <query_result> represents the data returned by the ClickHouse query. For SELECT queries, this will be an array of objects representing rows. For other queries like INSERT or UPDATE, it may contain metadata about the operation.
  • The node does not output binary data.

Dependencies

  • Requires access to a ClickHouse database instance.
  • Requires credentials including host URL, port, username, and password for authentication.
  • Uses the official ClickHouse client library for Node.js to communicate with the database.
  • The node expects these credentials to be configured in n8n prior to execution.

Troubleshooting

  • No Credentials got returned!
    This error occurs if the node cannot retrieve the required API authentication credentials. Ensure that the ClickHouse credentials are properly set up and assigned to the node.

  • Query errors
    If the SQL query is invalid or causes an error on the ClickHouse server, the node will throw an error. Verify the syntax and correctness of your SQL statement.

  • Connection issues
    Network problems or incorrect host/port settings can prevent connection to ClickHouse. Confirm that the database is reachable from the n8n environment and that credentials are correct.

Links and References

Discussion