Created
March 27, 2020 18:41
-
-
Save kaxil/4eadd89d2d00cc17a055bd04e1192799 to your computer and use it in GitHub Desktop.
Example DAG to test Airflow-Vault Integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.python_operator import PythonOperator | |
from datetime import datetime | |
from airflow.hooks.base_hook import BaseHook | |
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'}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment