Skip to main content

Connect ClickHouse Private beta Fusion compatible

The dbt v2 in dbt platform supports connecting to ClickHouse Cloud and to self-managed single-node ClickHouse. Use a dbt v2 release track for the environment that uses this connection.

ClickHouse private beta

ClickHouse connections on v2 are in private beta and not production-ready. To request access, contact your account representative. Expect some minor bugs, and avoid using them in production environments for now. Refer to Limitations before you connect.

Warehouse permissions for dbt v2

The ClickHouse user that the dbt v2 connects as must be able to run dbt workloads in the target database and read the system tables used for introspection.

Required ClickHouse objects

Before connecting, these objects must exist or be accessible:

ObjectPurpose
Service (ClickHouse Cloud) or server (self-managed, single node)Compute resource
DatabaseTarget database. ClickHouse has no separate schema level, so the dbt schema maps to a database
UserDatabase user for authentication

Core permissions

The following permissions are required for fundamental dbt features:

PermissionObjectPurpose
SELECTTables and viewsRead data
INSERTTablesLoad models, seeds, and snapshots
ALTERTablesSchema changes (on_schema_change), indexes and projections, comments (persist_docs), REPLACE PARTITION (insert_overwrite), and lightweight deletes (delete+insert)
TRUNCATETablesFull-refresh seeds
CREATE TABLE, CREATE VIEW, CREATE DICTIONARYDatabaseCreate materializations, including the intermediate and backup relations used for atomic rebuilds (EXCHANGE TABLES, RENAME TABLE)
DROP TABLE, DROP VIEW, DROP DICTIONARYDatabaseDrop or replace objects

Metadata operations

dbt v2 reads these ClickHouse system tables:

System tablePurpose
system.tablesList relations, build the catalog, detect materialized views pointing at a table
system.columnsColumn metadata for the catalog and for schema-change detection
system.databasesCheck whether the target database exists
system.settingsCapability probes (lightweight deletes, insert_distributed_sync)
system.view_refreshesValidate refreshable materialized view dependencies

ClickHouse filters system tables to the objects the user can access, so no separate grant is needed for them.

Database management

Conditional permissions for database management:

PermissionObjectWhen required
CREATE DATABASEServerAuto-create the target database when it doesn't exist yet

For the full privilege model, refer to access control in the ClickHouse documentation.

Connection fields

Configure the following fields when you create a ClickHouse connection.

FieldDescriptionTypeRequired?Example
Server HostnameThe ClickHouse Cloud endpoint URL. Do not include https:// or the port. Copy this from Connect in the ClickHouse Cloud console.StringRequiredabc123.us-east-1.aws.clickhouse.cloud
PortThe port to connect to. The dbt ClickHouse adapter connects over HTTPS. Use port 8443. Port 9440 (native protocol) is not supported by the adapter.StringOptional8443
DatabaseThe name of the database to connect to.StringOptionaldefault
Example of the ClickHouse connection fields.Example of the ClickHouse connection fields.

After you save the connection, set up your development environment:

  1. Create a new project or open an existing one.
  2. In your project settings, select Environments from the left menu and open your development environment.
  3. Under Connection, select the ClickHouse connection you just created.
  4. Save the environment.
Select the ClickHouse connection for the development environment.Select the ClickHouse connection for the development environment.

Development and deployment credentials

Each developer enters personal development credentials in Your profileCredentials. For ClickHouse Cloud, copy the username and password from the Connect dialog in the ClickHouse Cloud console. The username is typically default.

FieldDescriptionTypeRequired?Example
UsernameThe database username.StringRequireddefault
PasswordThe database password.StringOptionalDatabasePassword123
SchemaIn development, dbt builds your models into a schema with this name. Use a schema unique to your personal development environment.StringRequireddbtlabsdocstest
Target nameThe target name for this credential.StringOptionaldefault
ThreadsThe number of threads to use for dbt operations.IntegerOptional4
Example of the ClickHouse user credential fields.Example of the ClickHouse user credential fields.

Configuration

To learn how to optimize performance with data platform-specific configurations in dbt, refer to ClickHouse configurations.

For a description of the ClickHouse profile fields that the connection maps to, refer to ClickHouse setup.

Limitations

The ClickHouse connection is in private beta. On the dbt platform specifically:

  • The dbt Semantic Layer isn't supported for ClickHouse connections yet.
  • Only username and password authentication is available. OAuth, key pair authentication, SSH tunneling, and private connectivity aren't supported for ClickHouse yet.

The dbt v2 ClickHouse adapter limitations apply here too, including the gaps in clusters, grants, dbt clone, dbt source freshness, and SQL comprehension. For the complete picture, refer to ClickHouse limitations.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading