Skip to main content
Connect ClickHouse Cloud or self-hosted ClickHouse to sync data into Conversion.

Before You Begin

  • Admin access to your ClickHouse service: You’ll create a role and a user and grant privileges. In ClickHouse Cloud, the default user in the SQL console has what you need. On a self-hosted server, use a user with ACCESS MANAGEMENT.
  • Your service hostname and HTTPS port: In ClickHouse Cloud, open your service and click Connect; the hostname looks like abc123.us-central1.gcp.clickhouse.cloud and the HTTPS port is 8443. For a self-hosted server, use the host and the HTTPS port configured for the HTTP interface.
  • A database and tables to sync: Identify the data Conversion should be able to read.

Step 1: Set Up ClickHouse Access

Conversion connects over HTTPS using a username and password to run read-only queries. Run the following statements in the ClickHouse Cloud SQL console (or clickhouse-client on a self-hosted server) as an admin user.

Create a Role and Grant Access

Create a role with read access to your database. Database-level grants also cover new tables you add later.
SHOW lets Conversion list your tables and columns in the schema browser. Conversion reads table metadata from system.tables and system.columns, which need no additional grant.

Granting Access table-by-table

If your database contains data Conversion shouldn’t see, grant access to specific tables instead of the whole database:
Grant access to each new table you want to sync.

Create a User

Create a dedicated user with a strong password and assign the role.
readonly = 2 allows SELECT queries and per-query settings, but prevents writes.

Verify the grants worked

Confirm the user can see your database and cannot write:

Allow Conversion’s IP Addresses

Conversion connects from a fixed set of IP addresses: ClickHouse Cloud: the service’s IP Access List controls who can connect. Open your service, go to Settings → IP Access List, and add each address above (choose Add IP rather than Anywhere). Changes take effect within a minute. Self-hosted ClickHouse: allow these addresses through your firewall on the HTTPS port. You can also restrict the user’s allowed hosts:
ALTER USER ... HOST replaces the user’s allowed hosts; it doesn’t append. If the user must also log in from elsewhere, include those addresses in the same statement.
If your self-hosted server exposes only HTTP (port 8123), enable TLS with https_port or a reverse proxy. The endpoint must be reachable from Conversion’s IP addresses. Contact us if your server has no public endpoint.

Step 2: Connect ClickHouse to Conversion

  1. In Conversion, go to Settings → CRM & Syncing → Connections.
  2. Click Add ClickHouse connection.
  3. Enter your connection details:
  4. Click Connect to verify the connection.
ClickHouse Cloud services pause when idle and take a few seconds to wake up. The first connection or sync after a quiet period may be slower than usual.

Step 3: Create a Sync

Open your ClickHouse connection and go to the Syncs tab. Follow Setting Up a Sync to choose a destination, enter your query, and set a schedule.

ClickHouse SQL Reference

Table names

Refer to tables as database.table. ClickHouse has no schema layer between the two, so a three-part name like database.schema.table is an error. The schema browser inserts the correct form when you click a table.

Converting Timestamps

Conversion expects Unix timestamps for date/time fields. Use toUnixTimestamp() to convert DateTime and DateTime64 columns:

Using last_sync_time

For incremental syncing, compare your DateTime or DateTime64 column with toDateTime({{last_sync_time}}). The variable is an integer in Unix seconds, so don’t wrap it in quotes:
Or convert your column to Unix seconds and compare integers directly:
To add a buffer that catches rows whose updated_at might be slightly stale, subtract seconds before converting:

Building Nested Objects

Nested values such as relationshipFields are sent to Conversion as JSON objects. Build them with a named tuple:
Map and JSON columns are also delivered as JSON objects, and Array columns as JSON arrays.

Converting Booleans

Bool columns arrive as true / false. If a flag is stored as UInt8, convert it explicitly:

Handling NULLs

Use coalesce() or ifNull() to provide default values for Nullable columns:

Casting Types

Use CAST or the to* functions to convert between types:
Large integers (UInt64, Int64) and Decimal values are delivered as strings so no precision is lost. Timestamps are delivered in UTC.

Troubleshooting

”Authentication failed” errors

  • The username or password is wrong. Re-run ALTER USER conversion_sync_user IDENTIFIED WITH sha256_password BY '<new-password>' and update the connection in Conversion.
  • On ClickHouse Cloud, confirm you are using the user you created, not the default user’s credentials shown in the Connect dialog.

”Access denied” or “Query failed” errors

  • ClickHouse error code 497 means the user is authenticated but lacks a grant or tried to write. Check SHOW GRANTS FOR conversion_sync_user and confirm the query is a SELECT.
  • Error code 47 (Unknown identifier) or 60 (Unknown table) means a column or table name in the query is wrong or not covered by a grant. Remember to use database.table, not database.schema.table.
  • Error code 164 means the query tried to change a setting the read-only user may not change.

”Could not connect” errors

Verify that:
  • The host is the hostname only, without https:// or a port, and the port is your HTTPS port (8443 on ClickHouse Cloud)
  • Conversion’s IP addresses are in the service’s IP Access List (Cloud) or allowed by your firewall (self-hosted)
  • The service is not stopped; paused Cloud services wake automatically, stopped ones do not

”Result set too large” errors

Conversion caps how many rows a preview or a single run may return.
  • Filter by {{last_sync_time}} so each run only pulls changed rows
  • Select only the columns you need
  • For a first sync of a very large table, add a WHERE clause that syncs it in a few batches

Frequently Asked Questions

Any recent ClickHouse version works for ordinary syncs. Syncs whose first run returns more than a million rows are processed in pages, which requires ClickHouse 23.12 or later (or an explicit ORDER BY in your query on older versions).
Grant the role on each database and use fully-qualified table names in your query: