https://github.com/bakdata/connection_plugin
Templating for Airflow connections
https://github.com/bakdata/connection_plugin
airflow airflow-plugin python
Last synced: 12 months ago
JSON representation
Templating for Airflow connections
- Host: GitHub
- URL: https://github.com/bakdata/connection_plugin
- Owner: bakdata
- License: mit
- Created: 2019-05-24T09:20:18.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T05:17:17.000Z (over 3 years ago)
- Last Synced: 2025-03-09T02:15:57.651Z (about 1 year ago)
- Topics: airflow, airflow-plugin, python
- Language: Python
- Homepage: https://pypi.org/project/airflow-connection-plugin/
- Size: 88.9 KB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Templating for Airflow connections
[](https://badge.fury.io/py/airflow-connection-plugin)
The connection plugin contains an [Airflow](https://airflow.apache.org/) macro for [templating](https://airflow.apache.org/concepts.html#id1) connections in tasks.
You can use it like this:
```
# prints 'mysql'
{{ macros.connection_plugin.get_conn('airflow_db').host }}
```
`connection_plugin.get_conn` returns the [Connection object](https://airflow.apache.org/_api/airflow/models/connection/index.html#airflow.models.connection.Connection)
that you can interact with as described in the documentation.
## Installation
```
pip install airflow-connection-plugin
```
## Demo
To start the docker container simply run the following command in the root directory:
```
cd example && docker-compose up
```
After that you can reach the airflow frontend via [http://localhost:8080](http://localhost:8080).
You will find an example DAG that demonstrates how to retrieve different connection information.
**Attention**: Be especially careful when using passwords in templates.