728x90
반응형
dag 선언하는 구문에 hook을 선언해 발생
with DAG(
)as dag:
task = HttpHook(http_conn_id='httpHook', method="GET")
res = task3.run(
endpoint='/actions/2'
)
함수에 선언해서 pythonOperator로 호출하는 방식으로 변경해야 함
def my_python_function():
hook = HttpHook(http_conn_id='my_conn',method='GET')
res = hook.run(
endpoint='/endpoint'
)
with Dag(
) as dag:
# PythonOperator 정의
python_task = PythonOperator(task_id='python_task', python_callable=my_python_function)
728x90
반응형
'Bigdata > Airflow' 카테고리의 다른 글
http.client.BadStatusLine: Invalid status 71 (0) | 2025.02.23 |
---|---|
alembic.util.exc.CommandError: Can't locate revision identified by '22ed7efa9da2' (0) | 2024.08.23 |
Airflow Plugins (0) | 2024.05.28 |
Airflow PYTHONPATH (0) | 2024.05.28 |
Airflow XCcom(Cross-Communication) 정의 및 예시 (0) | 2024.05.23 |