Skip to main content

apache-airflow-providers-clickhouse-fork

Provider allow connection from Apache Airflow to Yandex Clickhouse Database and perform query using ClickhouseOperator.

Installation

pip install airflow-providers-clickhouse-fork

Using

After installation, you can see provider in the Airflow providers list.

Now, you can add connection on the Airflow connection page.

Example

from datetime import datetime, timedelta

from airflow import DAG
from airflow.operators.dummy import DummyOperator

from apache.airflow.providers.clickhouse.operators.ClickhouseOperator import ClickhouseOperator

with DAG(
    dag_id='example_clickhouse_operator',
    start_date=datetime(2021, 1, 1),
    dagrun_timeout=timedelta(minutes=60),
    tags=['example','clickhouse'],
    catchup=False,
    template_searchpath='$AIRFLOW_HOME/include'
) as dag:

    run_this_last = DummyOperator(task_id='run_this_last')
    # load sql from file
    select_data = ClickhouseOperator(
        task_id='select_quit',
        sql='query.sql',
        click_conn_id='my_clickhouse_connection',
        do_xcom_push=False
    )
    # set sql direct in the code section
    select_push = ClickhouseOperator(
        task_id='select_xcom',
        sql='select * from TestTable;;',
        click_conn_id='my_clickhouse_connection'
    )

    select_data >> select_push >> run_this_last

Get result of query

If property do_xcom_push equals False, no result pushed to XCom. Otherwise, result will be pushed to XCom.

Additional

This code based on clichouse driver.

Metadata

Release files for airflow-providers-clickhouse-fork 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airflow-providers-clickhouse-fork 0.0.3
File Size Uploaded
airflow-providers-clickhouse-fork-0.0.3.tar.gz 8.8 kB Details

Release files / airflow-providers-clickhouse-fork-0.0.3.tar.gz

Download URL airflow-providers-clickhouse-fork-0.0.3.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1f2e42af3a80ea29ea261796ff33af8b5d403c2dc010ab1f55fd792e59f142da
BLAKE2b-256 checksum
How to use checksums
6ffc3601a0a4bb125b8e79822205b9dc49d6404a622dce3d7b0976c7b12972f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page