You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
625 B
23 lines
625 B
from datetime import datetime |
|
|
|
from airflow import DAG |
|
from airflow.hooks.base_hook import BaseHook |
|
from airflow.operators.python_operator import PythonOperator |
|
|
|
|
|
def get_secrets(**kwargs): |
|
conn = BaseHook.get_connection(kwargs["my_conn_id"]) |
|
print( |
|
f"Password: {conn.password}, Login: {conn.login}, URI: {conn.get_uri()}, Host: {conn.host}" |
|
) |
|
|
|
|
|
with DAG( |
|
"example_secrets_dags", start_date=datetime(2020, 1, 1), schedule_interval=None |
|
) as dag: |
|
|
|
test_task = PythonOperator( |
|
task_id="test-task", |
|
python_callable=get_secrets, |
|
op_kwargs={"my_conn_id": "smtp_default"}, |
|
)
|
|
|