From 0f08dbdeb3590ee5f86904229f12e7593cc547c0 Mon Sep 17 00:00:00 2001 From: airflow Date: Thu, 18 Sep 2025 16:42:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20clickhouse=5Fdag.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- clickhouse_dag.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clickhouse_dag.py b/clickhouse_dag.py index 871cc94..3c813c9 100644 --- a/clickhouse_dag.py +++ b/clickhouse_dag.py @@ -1,18 +1,21 @@ from airflow import DAG from airflow.providers.http.operators.http import SimpleHttpOperator from datetime import datetime +from urllib.parse import urlencode + with DAG( dag_id="clickhouse_list_tables", start_date=datetime(2025, 1, 1), schedule_interval=None, catchup=False, ) as dag: + list_tables = SimpleHttpOperator( task_id="list_tables", http_conn_id="clickhouse_http", # Connection в Airflow - endpoint="/", + endpoint="/", # ClickHouse HTTP method="POST", - data={"query": "SHOW TABLES"}, + data=urlencode({"query": "SHOW TABLES"}), # Нужно как x-www-form-urlencoded headers={"Content-Type": "application/x-www-form-urlencoded"}, log_response=True, # покажет результат в логах Airflow - ) \ No newline at end of file + )