Обновить test_clickhouse_dag.py
This commit is contained in:
@@ -3,20 +3,15 @@ from airflow.operators.python import PythonOperator
|
||||
from airflow_clickhouse_plugin.hooks.clickhouse import ClickHouseHook
|
||||
from datetime import datetime
|
||||
|
||||
def test_clickhouse():
|
||||
def test_conn():
|
||||
hook = ClickHouseHook(clickhouse_conn_id="my_clickhouse_provider")
|
||||
# Простейший запрос
|
||||
result = hook.get_records("SELECT 1")
|
||||
print("ClickHouse result:", result)
|
||||
result = hook.get_conn().execute("SELECT 1")
|
||||
print(result)
|
||||
|
||||
with DAG(
|
||||
dag_id="test_clickhouse_dag",
|
||||
start_date=datetime(2024, 1, 1),
|
||||
schedule=None,
|
||||
catchup=False,
|
||||
tags=["example"],
|
||||
) as dag:
|
||||
test_task = PythonOperator(
|
||||
task_id="check_clickhouse",
|
||||
python_callable=test_clickhouse
|
||||
)
|
||||
PythonOperator(task_id="check_clickhouse", python_callable=test_conn)
|
||||
|
||||
Reference in New Issue
Block a user