Skip to main content
dltHub provides the agentic tools and managed ingestion infrastructure for any warehouse, including ClickHouse Cloud. Teams and agents can build and operate data pipelines at scale, producing auditable data the whole organization can trust. ClickHouse Cloud is a destination supported by dlt, so you can replicate databases, load files, ingest from SaaS, or load from arbitrary REST APIs. This tutorial shows how to deploy and schedule a pipeline on dltHub to load data into ClickHouse Cloud.

Prerequisites

1

Gather your ClickHouse connection details

To connect to ClickHouse with HTTP(S) you need this information:The details for your ClickHouse Cloud service are available in the ClickHouse Cloud console. Select a service and click Connect:
ClickHouse Cloud service connect button
Choose HTTPS. Connection details are displayed in an example curl command.
ClickHouse Cloud HTTPS connection details
If you’re using self-managed ClickHouse, the connection details are set by your ClickHouse administrator.dlt connects over both the native protocol and HTTP(S), so you also need the native port, which is 9440 (TLS). The HTTPS port is 8443.
2

Create a database and a user for dltHub

Connect to ClickHouse with the SQL console and create a database and a dedicated user:
3

Create a dltHub workspace

In an empty directory, run:
The command creates a workspace, installs its dependencies with uv, signs you in to dltHub, and configures a coding agent. Pick an agent when prompted. You can decline when it offers to launch it, because this tutorial doesn’t need one.
To add dltHub to an existing dlt project instead, run uvx dlthub-init@latest. See Install dltHub.
Add the ClickHouse dependencies to the workspace:
4

Add a pipeline

The workspace comes with a sample pipeline. Replace the contents of pipeline.py with a pipeline that loads issues and commits from the GitHub REST API for the ClickHouse/ClickHouse repository every hour:
The pipeline loads only issues and commits updated since initial_value, then continues from the last cursor value on each run. Adjust initial_value to a recent date to keep the first load small. The GitHub API allows 60 unauthenticated requests per hour, and each page of 100 records is one request. See GitHub rate limits.The trigger schedules the job with a cron expression. See triggers and scheduling for cron, intervals and follow-up jobs.Then replace the contents of __deployment__.py to register the pipeline as a job that dltHub can deploy:
5

Set the ClickHouse credentials on dltHub

dlt reads destination credentials from environment variables. Store them as workspace variables on dltHub, which injects them into every run. Secret values are write-only and never shown again.
The last command reads the password from stdin, so it doesn’t end up in your shell history.
6

Deploy and run the pipeline

Deploy the workspace to dltHub. This syncs your code, registers the job and starts its hourly schedule:
Run the job right away and follow its logs until it finishes:
To open the run and the workspace in the dltHub web app at app.dlthub.com, run:
7

Verify the data in ClickHouse

You can use the web UI or the clickhousectl CLI to check the loaded data. Authenticate once with clickhousectl cloud auth login, then list the tables:
ClickHouse has no concept of a dataset, so dlt prefixes the table names with the dataset name (github_data) and the separator ___. dlt flattens nested objects into columns such as user__login and commit__author__name, and unpacks nested lists into child tables such as issues__labels and commits__parents. The _dlt_* tables hold dlt’s own metadata about loads, pipeline state and schema versions. See Datasets in the dlt documentation.Check the status of the loads and the row count:
A status of 0 means the load completed successfully.
Congratulations! You’ve successfully created a pipeline that loads to ClickHouse Cloud and deployed it to dltHub.

Next steps