Files
airflow-dags/test_clickhouse_dag.py

24 lines
747 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime
# Импортируем hook из установленного пакета airflow-providers-clickhouse
from airflow_clickhouse_plugin.hooks.clickhouse import ClickHouseHook
def test_conn():
hook = ClickHouseHook(
clickhouse_conn_id="my_clickhouse_provider" # ваш Connection ID в Airflow
)
hook.execute("SELECT 1") # у этого пакета метод называется execute
with DAG(
dag_id="test_clickhouse_dag",
start_date=datetime(2024, 1, 1),
schedule=None,
catchup=False,
) as dag:
PythonOperator(
task_id="check_clickhouse",
python_callable=test_conn,
)