ClickHouse
Supermetal replicates to ClickHouse over its HTTP interface. Data staged in an object store buffer loads through ClickHouse's own S3 and Azure functions, letting the server parallelize the read. Tables with primary keys deduplicate through ReplacingMergeTree.
Prerequisites
- ClickHouse Cloud, ClickHouse Cluster or ClickHouse Server 21.8 or higher with the HTTP interface enabled (default port 8123).
- Admin privileges to create users and grant permissions.
- Network connectivity from the Supermetal agent to the database.
Setup
Visit SQL console
Log in to ClickHouse Cloud to access the SQL console and select your service.
Create a user
CREATE USER IF NOT EXISTS 'supermetal_user' IDENTIFIED WITH sha256_password BY 'strong-password';Password security
Replace 'strong-password' with a unique password and store it securely. You will enter it when configuring the target in Supermetal.
Create database
CREATE DATABASE IF NOT EXISTS target_database;Script variables
Replace target_database with the database to write to.
Grant permissions
GRANT CREATE DATABASE ON target_database.*, CREATE TABLE ON target_database.*, CREATE TEMPORARY TABLE ON *.*, S3 ON *.*, AZURE ON *.*, INSERT ON target_database.*, ALTER TABLE ON target_database.*, SELECT ON target_database.*, TRUNCATE ON target_database.* TO 'supermetal_user';Script variables
Replace target_database with the database created in the previous step.
Connection details
You need the following to configure the target in Supermetal:
- HTTPS URL (e.g.
https://<host>.<region>.clickhouse.cloud:8443) - Username and password you created
IP whitelist
You may need to add the Supermetal agent's IP address under Service Settings, Security, IP Access List.
Create a user
Log in to the ClickHouse server as an admin user.
CREATE USER IF NOT EXISTS 'supermetal_user' IDENTIFIED WITH sha256_password BY 'strong-password';Password security
Replace 'strong-password' with a unique password and store it securely. You will enter it when configuring the target in Supermetal.
Create database
CREATE DATABASE IF NOT EXISTS target_database;Script variables
Replace target_database with the database to write to.
Grant permissions
GRANT CREATE DATABASE ON target_database.*, CREATE TABLE ON target_database.*, CREATE TEMPORARY TABLE ON *.*, S3 ON *.*, AZURE ON *.*, INSERT ON target_database.*, ALTER TABLE ON target_database.*, SELECT ON target_database.*, TRUNCATE ON target_database.* TO 'supermetal_user';Script variables
Replace target_database with the database created in the previous step.
Connection details
You need the following to configure the target in Supermetal:
- HTTP interface URL (e.g.
https://hostname:port) - Username and password you created
Cluster
Cluster mode distributes data across a ClickHouse cluster.
Set Cluster name to the target cluster. Each target uses an unsuffixed Distributed table for cluster-wide reads and writes, plus a replicated table on each shard for storage. Local table suffix names the replicated tables and defaults to _local.
For example, the source table public.users creates the Distributed table public_users and replicated tables named public_users_local.
Supermetal shards keyed tables by a hash of the primary key and keyless tables randomly. Set a table's Sharding key to override this behavior. Under Fivetran naming, expressions use target column names.
Configure the cluster before syncing
Configure cluster mode before the first sync. Changing the cluster name, shard topology or weights, local table suffix, or sharding keys after syncing starts is unsupported.
Table Engine
The engine setting selects the table engine.
| Engine | Description |
|---|---|
Auto (default) | Tables with primary keys use ReplacingMergeTree with version tracking (_sm_version). Tables without primary keys use MergeTree. |
MergeTree | Append only, without deduplication. Use when deduplication is unneeded or write performance matters more. |
Null | Discards all data. Useful as source tables for Materialized Views. |
Data Retention (TTL)
The ttl_days setting expires rows automatically. When enabled, Supermetal adds a _sm_synced_at column, populated on insert, and ClickHouse drops rows that many days after their sync time.
Compression
ClickHouse compresses every column. By default, Supermetal uses the ClickHouse server default. Select the TypeBasedV1 compression policy to apply codecs by column type.
| Column type | Codec |
|---|---|
Date, Date32, DateTime, DateTime64 | Delta, ZSTD(1) |
Int8, UInt8 (ByteInteger) | T64, ZSTD(1) |
Int16 through Int64, UInt16 through UInt64 (Integer) | T64, ZSTD(1) |
Decimal | GCD, ZSTD(1) on ClickHouse 23.9 or newer, otherwise ZSTD(1) |
| All other types | ZSTD(1) |
TypeBasedV1 applies to new tables, added columns, and datatype changes. Enabling it alone does not alter existing columns.
Type family overrides
Set an override for any ClickHouse type family. Enter the contents of the CODEC clause, such as GCD, LZ4, or use Default to select the server default.
See the ClickHouse compression documentation for codec details.
Table Naming
Target table names carry the source schema as a prefix by default, so public.users becomes public_users. Turning the schema prefix off writes to users instead, which is safe only when table names are unique across all source schemas. Independently, you can add a custom prefix or suffix to every table name (raw_users, users_log).
Nullability
Supermetal creates every column except primary keys as Nullable, regardless of the source schema. This handles CDC edge cases where a change event does not carry every column's value, such as large object types. Two options change the default.
- Preserve source nullability. Columns keep the NOT NULL constraints they have at the source.
- Non nullable columns. Every column is created non
Nullable, and source NULLs land as ClickHouse type defaults (0 for numbers, '' for strings, epoch for dates). Customize the defaults per column withALTER TABLE ... MODIFY COLUMN ... DEFAULT ....
Data Types Mapping
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
Int8 | Int8 | |
Int16 | Int16 | |
Int32 | Int32 | |
Int64 | Int64 | |
UInt8 | UInt8 | |
UInt16 | UInt16 | |
UInt32 | UInt32 | |
UInt64 | UInt64 | |
Float16 | Float32 | |
Float32 | Float32 | |
Float64 | Float64 | |
Decimal128(p,s) | Decimal(p,s) | |
Decimal256(p,s) | Decimal(p,s) |
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
Date32 | Date32 | |
Date64 | DateTime64(3) | |
Timestamp(s, [tz]) | DateTime(0, [tz]) | |
Timestamp(ms, [tz]) | DateTime64(3, [tz]) | |
Timestamp(us, [tz]) | DateTime64(6, [tz]) | |
Timestamp(ns, [tz]) | DateTime64(9, [tz]) | |
Time32(ms) | DateTime64(3) | |
Time64(us) | DateTime64(6) | |
Time64(ns) | DateTime64(9) | |
Duration, Interval | String | Not supported by ClickHouse |
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
Utf8, LargeUtf8 | String |
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
Boolean | Boolean |
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
Struct | Tuple | |
Map | Map | |
Utf8 JSON Extension (arrow.json) | String | ClickHouse's JSON data type is not used, as it cannot ingest arbitrary JSON arrays |
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
Binary, LargeBinary, FixedSizeBinary | String | ClickHouse has no binary type |
| Apache Arrow DataType | ClickHouse Type | Notes |
|---|---|---|
List<T>, LargeList<T>, FixedSizeList<T> | Array(T) |
Nullability
Nullable columns are marked as nullable in ClickHouse using the Nullable(Type) wrapper. See nullability options.
Type compatibility
Supermetal preserves ClickHouse's Arrow data type mappings.
Changelog
0.1.11
2026-07-20
Per-table PARTITION BY and ORDER BY overrides.
V3 native parquet reader is now gated to ClickHouse 26 and above.
0.1.8
2026-06-23
Retries transient memory, part, replica, and overload exceptions.
0.1.5
2026-06-08
Defaults to the faster Parquet v3 reader (input_format_parquet_use_native_reader_v3) on ClickHouse >= 25.8.
0.1.3
2026-05-26
Adds a disable_schema_prefix option. When enabled, a source table public.users lands as users rather than public_users. Only safe when table names are unique across all source schemas.
Retries when ClickHouse encounters a transient S3 read error.
Last updated on