{"id":13651876,"url":"https://github.com/xnuinside/airflow-helper","last_synced_at":"2025-10-06T02:14:51.430Z","repository":{"id":208997594,"uuid":"722591531","full_name":"xnuinside/airflow-helper","owner":"xnuinside","description":"Airflow Helper is a tool that currently allows setting up Airflow Variables, Connections, and Pools from a YAML configuration file. Support yaml inheritance \u0026 can obtain all settings from existed Airflow Server!","archived":false,"fork":false,"pushed_at":"2024-04-01T01:48:47.000Z","size":806,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-02T00:07:55.141Z","etag":null,"topics":["airflow","airflow-toolkit","airflow-tools","apache-airflow","cli","command-line","command-line-tool","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xnuinside.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-23T13:29:55.000Z","updated_at":"2025-05-10T14:17:26.000Z","dependencies_parsed_at":"2023-11-24T13:27:58.459Z","dependency_job_id":"2c485033-8f09-4361-9ecb-12a50c40d232","html_url":"https://github.com/xnuinside/airflow-helper","commit_stats":null,"previous_names":["xnuinside/airflow-helper"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/xnuinside/airflow-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fairflow-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fairflow-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fairflow-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fairflow-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xnuinside","download_url":"https://codeload.github.com/xnuinside/airflow-helper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fairflow-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278547821,"owners_count":26004775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airflow","airflow-toolkit","airflow-tools","apache-airflow","cli","command-line","command-line-tool","python"],"created_at":"2024-08-02T02:00:53.127Z","updated_at":"2025-10-06T02:14:51.397Z","avatar_url":"https://github.com/xnuinside.png","language":"Python","funding_links":[],"categories":["Libraries, Hooks, Utilities"],"sub_categories":[],"readme":"### About the Airflow Helper\n\n\n![badge1](https://img.shields.io/pypi/v/airflow-helper) ![badge2](https://img.shields.io/pypi/l/airflow-helper) ![badge3](https://img.shields.io/pypi/pyversions/airflow-helper) ![workflow](https://github.com/xnuinside/airflow-helper/actions/workflows/ci-tests-runner.yml/badge.svg)\n\n\nIt's pretty fresh. Docs maybe not clear yet, keep calm ! I will update them soon :) \n\n\u003cimg align=\"left\" width=\"150\" height=\"150\" src=\"docs/img/airflow_helper_middle_logo.png\"\u003e\n\n**Airflow Helper** is a tool that currently allows setting up Airflow Variables, Connections, and Pools from a YAML configuration file. Support yaml inheritance \u0026 can obtain all settings from existed Airflow Server!\n\nIn the future, it can be extended with other helpful features. I'm open to any suggestions and feature requests. Just open an issue and describe what you want.\n\n\n### Motivation\n\nThis project allows to set up Connections \u0026 Variables \u0026 Pools for Airflow from yaml config. And export them to one config file.\n\nYeah, I know, I know... secrets backend ...\n\nBut I want to have all variables on my local machine toooo without need to connect to any secrets backend. And on tests also!\n\nSo I want to have some tool with that I can define ones all needed connections \u0026 variables in config file \u0026 forget about them during init new environment on local machine or running tests in CI.\n\nSome of functionality looks like 'duplicated' airflow normal cli, but no.. \nI tried to use for, example, `airflow connections export` command, but it is export dozend of default connections, that I'm not interested in - and I don't want them, I want only those connections, that created by me.\n\n\n\n### Airflow Versions Supports\n\nYou can see the github pipeline, that test library opposite each Airflow Version.\nI can only guarantee that 100% library works with Apache Airflow versions that are added on the CI/CD pipeline, but with big chance it works with all 2.x Apache Airflow versions.\n\n\n## How to use\n\n#### Installation\n\n1. With Python in virtualenv from PyPi: https://pypi.org/project/airflow-helper/\n\n```console\n\n    pip install airflow-helper\n\n```\n\n``` console\n\n  airflow-helper --version\n\n```\n\n2. With docker image from Docker Hub: https://hub.docker.com/repository/docker/xnuinside/airflow-helper/\n\n``` console\n\n  # pull image\n  docker pull xnuinside/airflow-helper:latest\n\n  # sample how to run command\n\n  docker run -it xnuinside/airflow-helper:latest --help\n```\n\n1. Example, how to use in docker-compose: example/docker-compose-example.yaml\n\n#### Default settings\n\nAll arguments that required in cli or Python code have 'default' setting, you can check all of them in file 'airflow_helper/settings.py'\n\n\n#### Airflow Helper settings \u0026 flags\n\nYou can configure how you want to use config - overwrite existed variables/connections/pools with values from config or just skip them, or raise error if already exist. \n\nIn cli (or as arguments in Python main class, if you use helper directly from python) exist several useful flags, that you can use:\n\n```console\n\n      airflow-helper load [OPTIONS] [FILE_PATH]       \n  \n  # options:\n    --url    TEXT  Apache Airflow full url to connect. You can provide it or host \u0026 port separately. [default: None]--host   TEXT  Apache Airflow server host form that obtain existed settings [default: http://localhost] \n    --port   TEXT  Apache Airflow server port form that obtain existed settings [default: 8080]              \n    --user       -u    TEXT  Apache Airflow user with read rights [default: airflow]\n    --password   -p    TEXT  Apache Airflow user password [default: airflow]       \n    --overwrite  -o          Overwrite Connections \u0026 Pools if they already exists \n    --skip-existed  -se      Skip `already exists` errors\n    --help          -h       Show this message and exit. \n```\n\n```console\n\n      airflow-helper create [OPTIONS] COMMAND [ARGS] \n  \n  # commands:\n    from-server                Create config with values from existed Airflow Server         \n    new                        Create new empty config \n  # options\n    --help          -h       Show this message and exit. \n```\n\n### What if I already have Airflow server with dozens of variables??\n\n**Obtain current Variables, Connections, Pools from existed server**\n\nNote: you should provide host url with protocol like: 'https://path-to-your-airflow-server.com' if protocol not in url, it will add 'http://' as default protocol\n\nGenerate config from existed Airflow Server - it is simple. Just provide creds with read access to existed Airflow Server like. We use Airflow REST API under the hood, so we need: \n\n    - server host \u0026 port or just url in format 'http://path-to-airflow:8080'\n    - user login\n    - user password\n\nAnd use Airflow Helper:\n\n1. From cli\n\n```command\n  \n  # to get help\n  airflow-helper create -h\n\n  # to use command\n  airflow-helper create path/where/to/save/airflow_settings.yaml --host https://your-airflow-host --port 8080 -u airflow-user -p airflow-password\n\n```\n\n\n2. From python code\n\n```python\n\nfrom airflow_helper import RemoteConfigObtainter\n\n        \n# by default it will save config in file airflow_settings.yaml\nRemoteConfigObtainter(\n  user='airflow_user', password='airflow_user_pass', url='https://path-to-airflow:8080').dump_config()\n# but you can provide your own path like:\n\nRemoteConfigObtainter(\n  user='airflow_user', password='airflow_user_pass', url='https://path-to-airflow:8080').dump_config(\n    file_path='any/path/to/future/airflow_config.yaml'\n  )\n\n```\n\nIt will create airflow_settings.yaml with all Variables, Pools \u0026 Connections inside!\n\n**Define config from Scratch**\n0. You can init empty config with cli\n\n```console\n\n  airflow-helper create new path/airflow_settings.yaml\n\n```\n\nIt will create empty sample-file with pre-defined config values.\n\n1. Define airflow_settings.yaml file. You can check examples as a files in example/ folder in this git repo\n(check 'Config keys' to see that keys are allowed - or check example/ folder)\n\nAbout connections:\nNote that 'type' it is not Name of Connection type. It is type id check them here - https://github.com/search?q=repo%3Aapache%2Fairflow%20conn_type\u0026type=code \n\n```yaml\n\n    airflow:\n      connections:\n      - conn_type: fs\n        connection_id: fs_default\n        host: localhost\n        login: fs_default\n        port: null\n      pools:\n      - description: Default pool\n        include_deferred: false\n        name: default_pool\n        slots: 120\n      - description: ''\n        include_deferred: true\n        name: deferred\n        slots: 0\n      variables:\n      - description: null\n        key: variable-name\n        value: \"variable-value\"\n```\n\n2. Run Airflow Helper to load config\n   \n   Required settings: \n\n    - path to config file (by default it search `airflow_settings.yaml` file)\n    - Airflow Server address (by default it tries to connect to localhost:8080)\n    - Airflow user login (with admin rights that allowed to set up Pools, Variables, Connections)\n    - Airflow user password (for login upper)\n\n\n   2.1 Run Airflow Helper from cli\n\n```console\n\n  # to get help\n\n  airflow-helper load -h\n\n  # to load config \n  airflow-helper load path/to/airflow_settings.yaml --host https://your-airflow-host --port 8080 -u airflow-user -p airflow-password\n\n```\n\n   2.2. Run Airflow Helper from Python Code\n\n```python\n\n\n  from airflow_helper import ConfigUploader\n\n\n  # you can provide only url or host \u0026 port\n  ConfigUploader(\n    file_path=file_path, url=url, host=host, port=port, user=user, password=password\n    ).upload_config_to_server()\n\n``` \n \n\n### Inheritance (include one config in another)\n\nI love inheritance. So you can use it too. If you have some base vars/pools/connections for all environments and you don't want copy-paste same settings in multiple files - just use `include:` property at the start of your config. \n\nNote, that `include` allows you to include a list of files, they will be inherit one-by-one in order that you define under `include` arg from the top to the bottom.\n\nExample:\n1. Define your 'base' config, for example: airflow_settings_base.yaml\n   \n```yaml\n\n  connections:\n  - conn_type: fs\n    connection_id: fs_default\n    host: localhost\n    login: fs_default\n    port: null\n  pools:\n  - description: Default pool\n    include_deferred: false\n    name: default_pool\n    slots: 120\n    \n\n```\n\n2. Now create your dev-env config : airflow_settings_dev.yaml (names can be any that you want) and use 'include:' property inside it\n\n```yaml\n\ninclude: \n  - \"airflow_settings_base.yaml\"\n\n# here put only dev-special variables/connections/pools\nairflow:\n    variables:\n        pass\n```\n\nThis mean that final config that will be uploaded to server will contain base settings + settings that you defined directly in airflow_settings_dev.yaml config\n\n### Library Configuration\n\nAirflow Helper uses a bunch of 'default' settings under the hood. Because library uses pydantic-settings, you can also overwrite those configurations settings with environment variables or with monkey patch python code. \n\nTo get full list of possible default settings - check file airflow_helper/settings.py.\n\nIf you never heard about pydantic-settings - check https://docs.pydantic.dev/latest/concepts/pydantic_settings/.\n\nExample, to overwrite default airflow host you should provide environment variable with prefix `AIRFLOW_HELPER_` and name `HOST`, so variable name should looks like `AIRFLOW_HELPER_HOST`\n\n\n### TODO \n\n1. Documentation website\n2. Getting Variables, Pools, Connections directly from Airflow DB (currently available only with Airflow REST API)\n3. Load configs from S3 and other cloud object storages\n4. Load configs from git\n5. Create overwrite mode for settings upload\n\n## Changelog\n*0.2.0*\n\n1. Added check for variables - now if variable already exists on server Airflow Helper will raise error if you tries to overwrite it from the config.\nTo overwrite existed Variables, Connections, Pools - use flag '--overwrite' or argument with same name, if you use Airflow Helper from Python.\n\n2. Added flag --skip-existed to avoid raise error if variables/connections/pools exists already on Airflow Server - it will just add new one from config file.\n\n\n*0.1.2*\n1. Do not fail if some sections from config are not exists\n\n*0.1.1*\n1. Overwrite option added to `airflow-helper load` command","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Fairflow-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxnuinside%2Fairflow-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Fairflow-helper/lists"}