Обновить clickhouse_dag.py
This commit is contained in:
@@ -1,23 +1,18 @@
|
|||||||
from airflow import DAG
|
from airflow import DAG
|
||||||
from airflow.providers.http.operators.http import SimpleHttpOperator
|
from airflow.providers.http.operators.http import SimpleHttpOperator
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
with DAG(
|
with DAG(
|
||||||
dag_id="clickhouse_list_tables",
|
dag_id="clickhouse_list_tables",
|
||||||
start_date=datetime(2025, 1, 1),
|
start_date=datetime(2025, 1, 1),
|
||||||
schedule_interval=None,
|
schedule_interval=None,
|
||||||
catchup=False,
|
catchup=False,
|
||||||
) as dag:
|
) as dag:
|
||||||
|
|
||||||
list_tables = SimpleHttpOperator(
|
list_tables = SimpleHttpOperator(
|
||||||
task_id="list_tables",
|
task_id="list_tables",
|
||||||
http_conn_id="clickhouse_http",
|
http_conn_id="clickhouse_http", # Connection в Airflow
|
||||||
endpoint="/",
|
endpoint="/",
|
||||||
method="POST",
|
method="POST",
|
||||||
data={"query": "SHOW TABLES"},
|
data={"query": "SHOW TABLES"},
|
||||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||||
log_response=True,
|
log_response=True, # покажет результат в логах Airflow
|
||||||
retries=0,
|
|
||||||
retry_delay=0,
|
|
||||||
timeout=10
|
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user