New to Kestra?
Use blueprints to kickstart your first workflows.
Create a ClickHouse database and table, insert rows, and run SQL queries with Kestra. Orchestrate ClickHouse analytics with retries, triggers, and lineage.
Run an end-to-end ClickHouse workflow that creates a database and table, loads sample rows, and queries the results into Kestra storage. This blueprint shows how to drive ClickHouse DDL and DML from a single declarative pipeline, so you can stand up analytics tables, seed them with data, and read them back without stitching together ad hoc scripts or cron jobs. It is a clean starting point for ingestion and reporting on ClickHouse, the column-oriented OLAP database built for fast aggregate queries.
The flow chains four io.kestra.plugin.jdbc.clickhouse.Query tasks that run in order:
create_database issues CREATE DATABASE IF NOT EXISTS helloworld so the target database exists.create_table runs CREATE TABLE IF NOT EXISTS helloworld.my_first_table with a MergeTree() engine and a PRIMARY KEY (user_id, timestamp).insert_data performs an INSERT INTO helloworld.my_first_table to load several sample rows.query_and_store_as_json runs SELECT user_id, message FROM helloworld.my_first_table with fetchType: STORE, persisting the result set to Kestra internal storage for downstream tasks.Connection settings are centralized in pluginDefaults for the ClickHouse Query type, setting the url (jdbc:clickhouse://host.docker.internal:8123/) and username once for every task.
String, DateTime, Float32).pluginDefaults.MergeTree table designs.ClickHouse executes SQL fast, but it has no built-in scheduler or dependency engine to sequence DDL, loads, and reads, retry transient failures, or track outputs across runs. With Kestra you get event and schedule triggers, automatic retries, run history and lineage, and a fully declarative YAML definition. The query result is captured as a durable artifact you can hand to the next step, something a raw SQL client cannot do on its own.
url.This blueprint uses inline pluginDefaults for connection settings and references no Kestra secrets. For production, replace the hardcoded username and add a password using {{ secret('CLICKHOUSE_PASSWORD') }}.
docker run -d -p 8123:8123 -p 9000:9000 --name myclickhouse --ulimit nofile=262144:262144 clickhouse/clickhouse-server.query_and_store_as_json output to inspect the stored result.url at a managed ClickHouse cluster and add credentials via secrets.INSERT with a load from object storage, a database, or an API.