Skip to main content

Dynamically build Apache Airflow DAGs from YAML files

Project description

dag-factory

Github Actions Coverage PyPi Code Style Downloads

analytics

Welcome to dag-factory! dag-factory is a library for Apache Airflow® to construct DAGs declaratively via configuration files.

The minimum requirements for dag-factory are:

For a gentle introduction, please take a look at our Quickstart Guide. For more examples, please see the examples folder.

Benefits

  • Construct DAGs without knowing Python
  • Construct DAGs without learning Airflow primitives
  • Avoid duplicative code
  • Everyone loves YAML! ;)

Features

Multiple Configuration Files

If you want to split your DAG configuration into multiple files, you can do so by leveraging a suffix in the configuration file name.

    from dagfactory import load_yaml_dags  # load relevant YAML files as airflow DAGs

    load_yaml_dags(globals_dict=globals(), suffix=['dag.yaml'])

Custom Operators

dag-factory supports using custom operators. To leverage, set the path to the custom operator within the operator key in the configuration file. You can add any additional parameters that the custom operator requires.

...
  tasks:
    begin:
      operator: airflow.operators.dummy_operator.DummyOperator
    make_bread_1:
      operator: customized.operators.breakfast_operators.MakeBreadOperator
      bread_type: 'Sourdough'

custom_operators.png

Notes

HttpSensor (since 1.0.0)

The package airflow.providers.http.sensors.http is available for Airflow 2.0+

The following example shows response_check logic in a python file:

task_2:
  operator: airflow.providers.http.sensors.http.HttpSensor
  http_conn_id: 'test-http'
  method: 'GET'
  response_check_name: check_sensor
  response_check_file: /path/to/example1/http_conn.py
  dependencies: [task_1]

The response_check logic can also be provided as a lambda:

task_2:
  operator: airflow.providers.http.sensors.http.HttpSensor
  http_conn_id: 'test-http'
  method: 'GET'
  response_check_lambda: 'lambda response: "ok" in response.text'
  dependencies: [task_1]

License

To learn more about the terms and conditions for use, reproduction and distribution, read the Apache License 2.0.

Privacy Notice

This project follows Astronomer's Privacy Policy.

For further information, read this

Security Policy

Check the project's Security Policy to learn how to report security vulnerabilities in DAG Factory and how security issues reported to the DAG Factory security team are handled.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dag_factory-0.23.0a1.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dag_factory-0.23.0a1-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file dag_factory-0.23.0a1.tar.gz.

File metadata

  • Download URL: dag_factory-0.23.0a1.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for dag_factory-0.23.0a1.tar.gz
Algorithm Hash digest
SHA256 a29f91c0a71a5d796ee6a1b49f4c81f46693c07eed6a9db5b593da89213636be
MD5 0248a31c9ab74a439a33ffafbbc77c55
BLAKE2b-256 2b8f791a7c97675e837b88c55f04c0e303bb801d008c5cf2cad215412ae5813e

See more details on using hashes here.

File details

Details for the file dag_factory-0.23.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for dag_factory-0.23.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fe263d7bb7621098915e6e9712cbd02ff17fe75373c05d3fdd850e80bec43a2
MD5 5e581dd3041bb975a21dbe85f05194c4
BLAKE2b-256 b936a97876868170fc670a75f591fd7b48196a03b2ebf407cd5c2247a4928fe6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page