Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

Destinations

Connect ClickHouse as a destination

Create a ClickHouse service account, copy your address from ClickHouse Cloud, and connect ClickHouse to an Artie pipeline as a destination.

You need a ClickHouse service before you start. For ClickHouse Cloud, follow the ClickHouse Cloud Quick Start.

Required settings

Artie asks for these four values. Each field name matches its label in the Artie dashboard.

FieldWhat to enter
AddressThe host and port of your ClickHouse service, as host:port. See Find the address.
UsernameThe service account user, artie in the service account script.
PasswordThe service account password.
Database nameThe database Artie writes to.

Create a service account

In ClickHouse, run this script to create the user Artie writes with:

SQL
CREATE USER artie IDENTIFIED BY '<password>';

-- Replace <database> with your desired destination database.
GRANT CREATE TABLE,
      ALTER ADD COLUMN,
      ALTER MODIFY COLUMN,
      ALTER DROP COLUMN,
      INSERT,
      DROP TABLE
ON <database>.* TO artie;

Replace <password> with the password for the user, and <database> with your destination database.

To let Artie create the destination database, grant that permission separately:

SQL
GRANT CREATE DATABASE ON *.* TO artie;

If your ClickHouse server has table_engines_require_grant=1, grant the table engines Artie uses:

SQL
GRANT TABLE ENGINE ON MergeTree TO artie;
GRANT TABLE ENGINE ON ReplacingMergeTree TO artie;

If your ClickHouse server has access_control_improvements.select_from_system_db_requires_grant=1, also grant the metadata reads Artie uses:

SQL
GRANT SELECT ON system.databases TO artie;
GRANT SELECT ON system.tables TO artie;
GRANT SELECT ON system.columns TO artie;

Find the address

In ClickHouse Cloud, set Connect with to Go, then copy the address highlighted in this image:

ClickHouse Cloud connection details with Connect with set to Go and the address highlighted

The address must end with a numeric port, for example abc123.us-east-1.aws.clickhouse.cloud:9440. Artie connects with TLS. In ClickHouse Cloud, the Go connection details show the secure native port, 9440.

Add ClickHouse to a pipeline

When you create a pipeline, the Destination section of the setup has these steps.

  1. Choose the destination

    In Choose destination, select ClickHouse.

  2. Run the service account script

    Prepare destination shows the script from Create a service account. Run it in ClickHouse, then select Continue.

    When the pipeline reuses an existing ClickHouse connector, this step is already marked done and Next passes it.

  3. Enter the connection details

    In Connect and verify, enter Address, Username and Password.

  4. Choose the database

    In Database name, select the database Artie writes to.

    To create a database, type its name and select Create “NAME”, where NAME is the name you typed. In the Add a new database dialog, select Create database. This needs the CREATE DATABASE grant.

  5. Verify the destination

    Select Verify destination. Artie shows “Destination verified”.

    If you haven’t chosen tables yet, the button reads Test connection. A passing test shows “Connection works. Choose tables to finish verifying the destination.”

The setup has no Network access step for ClickHouse, because ClickHouse destinations don’t support SSH tunnels.

To change these settings on an existing pipeline, select Edit pipeline, then open the Destination: ClickHouse tab.

What Artie creates

Artie creates its destination tables in the database you chose and writes every change as an inserted row.

Table typeEngine
Replicated tableReplacingMergeTree(__artie_updated_at, __artie_delete)
History mode tableMergeTree() ORDER BY __artie_updated_at

Both engines use __artie_updated_at, so a ClickHouse pipeline needs Add ‘Artie updated at’ column turned on. It’s on by default. With it off, the pipeline fails to start. You can’t rename the column for ClickHouse.

Artie adds __artie_delete to every replicated table as a UInt8 column. Both columns are described in System columns.

Data types

Artie maps its own types to these ClickHouse types. Artie’s typing library covers how source types become Artie types.

Artie typeClickHouse type
Float, doubleFloat64
Small integerInt16
IntegerInt32
Big integer, or an integer of unknown sizeInt64
Decimal with a precision up to 76DECIMAL(precision, scale)
Decimal with a higher or unknown precisionString
BooleanBool
DateDate
Timestamp, with or without a time zoneDateTime64(6)
Time, interval, UUID, stringString
ArrayArray(String)
Struct or JSONJSON

Artie converts timestamps that have a time zone to UTC. A null array is stored as an empty array, and a null JSON value as {}.

Was this page helpful?