Skip to main content

Render 3rd party workflows in Airflow

Project description

https://github.com/astronomer/astronomer-cosmos/raw/main/docs/_static/banner.png

Astronomer Cosmos fury ossrank downloads pre-commit.ci status

A framework for dynamically generating Apache Airflow DAGs from other tools and frameworks. Develop your workflow in your tool of choice and render it in Airflow as a DAG or Task Group!

Current support for:
  • dbt

Coming soon:
  • Jupyter

  • Hex

  • And more…open an issue if you have a request!

Quickstart

Check out the Quickstart guide on our docs.

Example Usage (dbt)

Cosmos lets you render dbt projects as Airflow DAGs and Task Groups. To render a DAG, import DbtDag and point it to your dbt project.

from pendulum import datetime
from airflow import DAG
from cosmos.providers.dbt.dag import DbtDag

# dag for the project jaffle_shop
jaffle_shop = DbtDag(
    dbt_project_name="jaffle_shop",
    conn_id="airflow_db",
    dbt_args={
        "schema": "public",
    },
    dag_id="jaffle_shop",
    start_date=datetime(2022, 11, 27),
)

Simiarly, you can render an Airflow TaskGroups using the DbtTaskGroup class. Here’s an example with the jaffle_shop project:

from pendulum import datetime

from airflow import DAG
from airflow.operators.empty import EmptyOperator
from cosmos.providers.dbt.task_group import DbtTaskGroup


with DAG(
    dag_id="extract_dag",
    start_date=datetime(2022, 11, 27),
    schedule="@daily",
):

    e1 = EmptyOperator(task_id="ingestion_workflow")

    dbt_tg = DbtTaskGroup(
        group_id="dbt_tg",
        dbt_project_name="jaffle_shop",
        conn_id="airflow_db",
        dbt_args={
            "schema": "public",
        },
    )

    e2 = EmptyOperator(task_id="some_extraction")

    e1 >> dbt_tg >> e2

Changelog

We follow Semantic Versioning for releases. Check CHANGELOG.rst for the latest changes.

Contributing Guide

All contributions, bug reports, bug fixes, documentation improvements, enhancements are welcome.

A detailed overview an how to contribute can be found in the Contributing Guide.

As contributors and maintainers to this project, you are expected to abide by the Contributor Code of Conduct.

License

Apache License 2.0

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

astronomer_cosmos-0.5.1.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

astronomer_cosmos-0.5.1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file astronomer_cosmos-0.5.1.tar.gz.

File metadata

  • Download URL: astronomer_cosmos-0.5.1.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for astronomer_cosmos-0.5.1.tar.gz
Algorithm Hash digest
SHA256 0c6bd100d9ae7aade69291557467d806ee7a17fb6d1a20b78d5ce4e5d1501366
MD5 fc9c1650f50630deca616ebd10779ea0
BLAKE2b-256 a98f81dba38c07f0454d6e83bc2276fb0942b3e06a3be7102c31d66750cfede2

See more details on using hashes here.

File details

Details for the file astronomer_cosmos-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for astronomer_cosmos-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f288cecc8b804f0df9b72f3a99b1c5ce0eb3a3e1ca966881ab7c6992592af7cd
MD5 190a28c066e4268b5cf571690846c16a
BLAKE2b-256 2fa7f81ddb2cdda30b64a72493fc414a548af79bdf8abba0bce7759f1a2a2ac7

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