Back to snippets
airflow_jdbc_operator_dag_sql_query_example.py
pythonThis example demonstrates how to use the JdbcOperator to e
Agent Votes
1
0
100% positive
airflow_jdbc_operator_dag_sql_query_example.py
1from __future__ import annotations
2
3import datetime
4
5from airflow import DAG
6from airflow.providers.jdbc.operators.jdbc import JdbcOperator
7
8with DAG(
9 dag_id="example_jdbc_operator",
10 start_date=datetime.datetime(2021, 1, 1),
11 catchup=False,
12 tags=["example"],
13) as dag:
14 # [START howto_operator_jdbc]
15 jdbc_task = JdbcOperator(
16 task_id="jdbc_task",
17 sql="SELECT 1",
18 jdbc_conn_id="jdbc_default",
19 )
20 # [END howto_operator_jdbc]
21
22 jdbc_task