Обновить clickhouse_dag.py

This commit is contained in:
2025-09-18 16:53:59 +04:00
parent 0f08dbdeb3
commit 935ca31091

View File

@@ -1,7 +1,6 @@
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",
@@ -12,10 +11,10 @@ with DAG(
list_tables = SimpleHttpOperator(
task_id="list_tables",
http_conn_id="clickhouse_http", # Connection в Airflow
endpoint="/", # ClickHouse HTTP
http_conn_id="clickhouse_http",
endpoint="/",
method="POST",
data=urlencode({"query": "SHOW TABLES"}), # Нужно как x-www-form-urlencoded
headers={"Content-Type": "application/x-www-form-urlencoded"},
log_response=True, # покажет результат в логах Airflow
data="SHOW TABLES",
headers={"Content-Type": "text/plain"},
log_response=True,
)