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