tests.system.clickhouse.example_clickhouse

Example DAG demonstrating the use of ClickHouse with Airflow.

Requires a connection with conn_id="clickhouse_default" pointing to a live ClickHouse instance. The DAG creates a temporary table, inserts rows, reads them back, and drops the table.

Attributes

CLICKHOUSE_CONN_ID

CLICKHOUSE_DATABASE

CLICKHOUSE_TABLE

DAG_ID

CREATE_TABLE_SQL

INSERT_ROWS_SQL

DROP_TABLE_SQL

create_table

test_run

Module Contents

tests.system.clickhouse.example_clickhouse.CLICKHOUSE_CONN_ID[source]
tests.system.clickhouse.example_clickhouse.CLICKHOUSE_DATABASE[source]
tests.system.clickhouse.example_clickhouse.CLICKHOUSE_TABLE = 'airflow_example'[source]
tests.system.clickhouse.example_clickhouse.DAG_ID = 'example_clickhouse'[source]
tests.system.clickhouse.example_clickhouse.CREATE_TABLE_SQL = Multiline-String[source]
Show Value
"""
CREATE TABLE IF NOT EXISTS airflow_example (
    id   UInt32,
    name String,
    ts   DateTime DEFAULT now()
) ENGINE = MergeTree()
ORDER BY id
"""
tests.system.clickhouse.example_clickhouse.INSERT_ROWS_SQL = Multiline-String[source]
Show Value
"""
INSERT INTO airflow_example (id, name) VALUES
    (1, 'Alice'),
    (2, 'Bob'),
    (3, 'Charlie')
"""
tests.system.clickhouse.example_clickhouse.DROP_TABLE_SQL = 'DROP TABLE IF EXISTS airflow_example'[source]
tests.system.clickhouse.example_clickhouse.create_table[source]
tests.system.clickhouse.example_clickhouse.test_run[source]

Was this entry helpful?