Is there a way to create/modify connections through Airflow API

前端 未结 3 1882
醉酒成梦
醉酒成梦 2020-12-05 04:58

Going through Admin -> Connections, we have the ability to create/modify a connection\'s params, but I\'m wondering if I can do the same through API so I can

3条回答
  •  时光取名叫无心
    2020-12-05 05:31

    You can also add, delete, and list connections from the Airflow CLI if you need to do it outside of Python/Airflow code, via bash, in a Dockerfile, etc.

    airflow connections --add ...
    

    Usage:

    airflow connections [-h] [-l] [-a] [-d] [--conn_id CONN_ID]
                        [--conn_uri CONN_URI] [--conn_extra CONN_EXTRA]
                        [--conn_type CONN_TYPE] [--conn_host CONN_HOST]
                        [--conn_login CONN_LOGIN] [--conn_password CONN_PASSWORD]
                        [--conn_schema CONN_SCHEMA] [--conn_port CONN_PORT]
    

    https://airflow.apache.org/cli.html#connections

    It doesn't look like the CLI currently supports modifying an existing connection, but there is a Jira issue for it with an active open PR on GitHub.

    • AIRFLOW-2840 - cli option to update existing connection
    • https://github.com/apache/incubator-airflow/pull/3684

提交回复
热议问题