Обновить clickhouse_dag.py
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user