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

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",
) as dag:

    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",
        },
        dag=dag,
    )

    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.2.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

astronomer_cosmos-0.2.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for astronomer_cosmos-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3bf99da5ecdd20ee40d9947930bac8f52e7d7d1b39c78c756880f1cb323467b3
MD5 491247f8e643d4db8c28b1eb318f474c
BLAKE2b-256 86d57c4b82bbaca5e0806dad514c122ceafbf9b864c26198c4aa986eefc79062

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astronomer_cosmos-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3df35cfeaa054c9a5646b46cf81b235935d54be9b35e3b1b66eaa1c6ab092d
MD5 ef8de61c20785e2b5af26b8f669c820d
BLAKE2b-256 e1de0fe4c1cdbb13f8a891239c30feeb18a7aa74c72e2f11eb935d15e244d839

See more details on using hashes here.

Supported by

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