Skip to main content
First time creating a connector? Read this first.

Requirements

You will need:
  • A ClickHouse server that Unstructured can reach over ClickHouse’s HTTP or HTTPS interface. The connector does not use the native TCP protocol. The connector supports two kinds of deployment:
    • ClickHouse Cloud: Use your service’s hostname and port 8443. Connections to ClickHouse Cloud always use TLS.
    • Self-managed ClickHouse (on-premises or in your own cloud account): Use your server’s hostname, plus port 8123 for plain HTTP or port 8443 for HTTPS. If a private certificate authority (CA) signed your server’s TLS certificate, you also need that CA’s certificate as PEM text.
    Unstructured has tested the connector only with ClickHouse Cloud 26.6.1 and self-managed ClickHouse 26.8 and 26.10. The host and port must be reachable from where Unstructured runs the connector. If you restrict access to your server by IP address or by network, allow connections from Unstructured to reach it. If Unstructured cannot open a connection to the server before the connect timeout expires, the connection test reports Timed out connecting to ClickHouse. Check the host, port, TLS setting and firewall rules.
  • The ClickHouse user’s name and password. If the user has no password, the password can be empty.
  • The name of the database that contains the table. Database and table names cannot contain a backtick, single quote, or backslash.
  • The name of the table to read. The user needs the SELECT privilege on the table:
  • A table with key columns that identify each row. By default, the connector uses the table’s sorting key (the ORDER BY clause) as the key columns. The sorting key must consist of plain, non-nullable scalar columns, not expressions. If the table has no usable sorting key, you can name the key columns in the connector’s settings instead. The connector reads the table in key order and groups the keys into batches. Each batch is one record, and the connector stores each row of a batch as its own JSON file. The key columns must identify one row. If more than one row has the same key values, the run fails with More than one row has the same value for the key columns (<key columns>). Set the key columns to columns that identify one row. ClickHouse does not require a sorting key to be unique, so the default key columns can fail on a plain MergeTree table. Set Key columns (key_columns) to a unique column or a combination such as (tenant, id). The connection test does not check the table for equal key values. The run checks them as it reads. For tables that use the ReplacingMergeTree, CollapsingMergeTree, or VersionedCollapsingMergeTree engine families (including the Replicated and Shared variants), the connector reads with FINAL. FINAL applies the engine’s merge rules. For ReplacingMergeTree, it returns the latest version of each row. The Collapsing engines drop cancelled rows, so the connector does not read a key whose rows cancel out. If the key columns are exactly the sorting key of such a table, rows with equal key values are versions of one row, and the run does not fail. The connector does not use FINAL for other engines, such as SummingMergeTree and AggregatingMergeTree. The connector builds each query from bound parameters. It does not support a free-form WHERE filter, so it reads the whole table. Column names cannot contain a backtick, single quote, or backslash. Incremental sync is not available. Every run reads the whole table, so the Version column (version_column) and Incremental overlap (s) (overlap_seconds) settings do not change which rows the connector reads.

Create the connector

1

Open the sources list

On the sidebar, click Connectors, then Sources.
2

Start a new connector

Click New or Create Connector.
3

Name the connector

For Name, enter a unique name for the connector.
4

Choose the provider

In the Provider area, click ClickHouse, then click Continue.
5

Fill in the fields

Follow the on-screen instructions to fill in the fields as described later on this page.
6

Save the connector

Click Save and Test.
Fill in the following fields:
  • Name (required): A unique name for this connector.
  • Host (required): The ClickHouse server’s hostname or IP address, without a scheme or path. For ClickHouse Cloud, this is the service’s hostname.
  • Port: The HTTP(S) interface port. The default is 8443. Use 8443 for ClickHouse Cloud and for self-managed servers with TLS, or 8123 for a self-managed server without TLS.
  • Use TLS: Switch on to connect over HTTPS, or off to connect over plain HTTP. The default is on. Keep this on for ClickHouse Cloud. For a self-managed server on port 8123, switch it off.
  • Username: The ClickHouse user. The default is default.
  • Password (required): The user’s password. If the user has no password, enter an empty value and confirm that the connection test passes.
  • Database: The database that contains the table. The default is default.
  • Verify TLS certificate: Switch on to verify the server’s certificate, or off to skip verification. The default is on. Switch it off only for testing.
  • CA certificate: The PEM text of a private CA certificate that signed the server’s certificate. The text must contain -----BEGIN CERTIFICATE-----. Leave it empty if a public CA signed the certificate.
  • Connect timeout (s): The number of seconds to wait to open a connection. The default is 30. A paused ClickHouse Cloud service must wake up first, so raise this value if the first connection after a long idle period times out.
  • Read timeout (s): The number of seconds to wait for the server between reads. The default is 300.
  • Table (required): The table to read.
  • Key columns: The columns that identify a row, in the order the connector pages through the table. No two rows can have the same values, or the run fails. By default, the connector uses the table’s sorting key, which must consist of plain columns. ClickHouse does not require a sorting key to be unique. Set this field unless the table uses a Replacing, Collapsing, or VersionedCollapsing MergeTree engine keyed by its sorting key.
  • Version column: A Date or DateTime column that changes when a row changes. Incremental sync is not available. Every run reads the whole table, so this setting does not change which rows the connector reads. The connector still checks that the column exists and is a Date or DateTime column.
  • Rows per batch: The number of rows that the connector fetches in one download step and holds in memory at once. The default is 500, and the maximum is 1000. The limit applies to rows, not bytes, so lower it for wide rows or large columns.
  • Page size: The number of rows to read per query. The default is 10000.
  • Incremental overlap (s): The number of seconds to re-read when syncing incrementally. The default is 0. Incremental sync is not available, so this setting has no effect.
The connection fields take the following values for each deployment:
  • Host: Your service’s hostname.
  • Port: 8443.
  • Use TLS: On.
  • Verify TLS certificate: On.
  • CA certificate: Leave empty.

Troubleshooting

Issue: The connection test fails with ClickHouse rejected the username or password.Cause: The username or password does not match a ClickHouse user.Solution: Check the Username (username) and Password (password) values. If the user has no password, test with an empty Password and confirm the connection test passes.
Issue: The connection test fails with Timed out connecting to ClickHouse. Check the host, port, TLS setting and firewall rules.Cause: Unstructured could not open a connection to the host and port before the connect timeout expired. Possible causes:
  • A firewall or IP access list blocks the connection.
  • The port or TLS setting does not match the server.
  • A paused ClickHouse Cloud service did not wake up in time.
Solution: Check that Port (port) and Use TLS (secure) match your deployment (8443 with TLS, or 8123 without). Allow connections from Unstructured through any firewall or IP access list. For ClickHouse Cloud, raise Connect timeout (s) (connect_timeout) if the first connection after a long idle period fails.
Issue: The connection test fails with Could not reach the provider. Check network egress, DNS, and firewall rules.Cause: The hostname does not resolve, or the host is unreachable from Unstructured.Solution: Check that Host (host) is correct, is a bare hostname, and is reachable from Unstructured.
Issue: The connector fails with The ClickHouse settings are not valid. followed by the field path and reason, for example connector_config.host: Value error, host must be a bare hostname or IP address or connector_config.ca_cert: Value error, ca_cert must be PEM text.Cause: A connection field value does not meet the connector’s validation rules.Solution: Enter only the hostname in Host (host), with no scheme (https://), path, or credentials. Paste the full PEM text, including the -----BEGIN CERTIFICATE----- line, in CA certificate (ca_cert).
Issue: The connector fails with The ClickHouse settings are not valid. followed by indexer_config.batch_size: Value error, batch_size must be at most 1000. and a longer explanation.Cause: Rows per batch (batch_size) is above the limit of 1000 rows.Solution: Set Rows per batch (batch_size) to 1000 or less.
Issue: The connector fails with ClickHouse denied the operation. Check the user's grants on the database and table.Cause: The user lacks the SELECT privilege that reading the table needs.Solution: Grant SELECT on the table.
Issue: The connector fails with ClickHouse could not find the database, table or column. Check the names in the settings. or The ClickHouse table was not found, or the user cannot read it.Cause: A database, table, or column name is wrong, or the user cannot read the table.Solution: Check the Database (database), Table (table), Key columns (key_columns), and Version column (version_column) values. Confirm that the user has SELECT on the table.
Issue: A download fails with None of the requested rows were found in ClickHouse.Cause: None of the rows that the run requested exist in the table when the download reads it.Solution: Check that the rows still exist in the table, and then run the workflow again.
Issue: The connector fails with one of the following messages:
  • The table has no sorting key. Set the key columns in the settings.
  • The table's sorting key contains an expression. Set the key columns in the settings.
  • Key column '<name>' is nullable; key columns must not be nullable.
  • Key column '<name>' must be a plain scalar type.
  • The key columns contain a duplicate.
  • Key column '<name>' does not exist or cannot be read.
Cause: By default, the connector uses the table’s sorting key as the key columns. The sorting key must consist of plain, non-nullable scalar columns.Solution: Set Key columns (key_columns) to plain, non-nullable columns that identify each row.
Issue: The connector fails with More than one row has the same value for the key columns (<key columns>). Set the key columns to columns that identify one row.Cause: The key columns do not identify one row. By default, the key columns are the table’s sorting key, and ClickHouse does not require a sorting key to be unique. The connector accepts equal key values only when the table uses a ReplacingMergeTree, CollapsingMergeTree, or VersionedCollapsingMergeTree engine and the key columns are exactly its sorting key.Solution: Set Key columns (key_columns) to a column or combination of columns that has a different value in every row, such as (tenant, id).
Issue: The connector fails with Version column '<name>' does not exist or cannot be read. or The version column must be a Date or DateTime column.Cause: The column does not exist, the user cannot read it, or it is not a Date or DateTime column.Solution: Set Version column (version_column) to a Date or DateTime column that the user can read, or leave it empty.