Coder Social home page Coder Social logo

dbt-af's Introduction

PyPI - Version GitHub Build

License PyPI - Python Version PyPI - Downloads

Poetry Code style: black

dbt-af: distributed run of dbt models using Airflow

Overview

dbt-af is a tool that allows you to run dbt models in a distributed manner using Airflow. It acts as a wrapper around the Airflow DAG, allowing you to run the models independently while preserving their dependencies.

dbt-af

Why?

  1. dbt-af is domain-driven. It is designed to separate models from different domains into different DAGs. This allows you to run models from different domains in parallel.
  2. dbt-af brings scheduling to dbt. You can schedule your dbt models to run at a specific time.
  3. dbt-af is an ETL-driven tool. You can separate your models into tiers or ETL stages and build graphs showing the dependencies between models within each tier or stage.
  4. dbt-af brings additional features to use different dbt targets simultaneously, different tests scenarios, and maintenance tasks.

Installation

To install dbt-af run pip install dbt-af.

To contribute we recommend to use poetry to install package dependencies. Run poetry install --with=dev to install all dependencies.

dbt-af by Example

All tutorials and examples are located in the examples folder.

To get basic Airflow DAGs for your dbt project, you need to put the following code into your dags folder:

# LABELS: dag, airflow (it's required for airflow dag-processor)
from dbt_af.dags import compile_dbt_af_dags
from dbt_af.conf import Config, DbtDefaultTargetsConfig, DbtProjectConfig

# specify here all settings for your dbt project
config = Config(
    dbt_project=DbtProjectConfig(
        dbt_project_name='my_dbt_project',
        dbt_project_path='/path/to/my_dbt_project',
        dbt_models_path='/path/to/my_dbt_project/models',
        dbt_profiles_path='/path/to/my_dbt_project',
        dbt_target_path='/path/to/my_dbt_project/target',
        dbt_log_path='/path/to/my_dbt_project/logs',
        dbt_schema='my_dbt_schema',
    ),
    dbt_default_targets=DbtDefaultTargetsConfig(default_target='dev'),
    is_dev=False,  # set to True if you want to turn on dry-run mode
)

dags = compile_dbt_af_dags(manifest_path='/path/to/my_dbt_project/target/manifest.json', config=config)
for dag_name, dag in dags.items():
    globals()[dag_name] = dag

In dbt_project.yml you need to set up default targets for all nodes in your project (see example):

sql_cluster: "dev"
daily_sql_cluster: "dev"
py_cluster: "dev"
bf_cluster: "dev"

This will create Airflow DAGs for your dbt project.

Project Information

dbt-af's People

Contributors

nikitayurasov avatar ortemij avatar

Stargazers

 avatar  avatar  avatar Vasily Sevostyanov avatar Daniel Abramov avatar Daniil Kolginov avatar Khusan Turdiev avatar jkermakov avatar  avatar Teke avatar Vladislav Radishevskii avatar  avatar  avatar Vladislav Gotsulyak avatar  avatar  avatar  avatar Vladimir Verstov avatar Aleksandr Nepochatykh avatar  avatar Aleksandr Berezkin avatar  avatar Yuriy Gavrilov avatar Andrei Shumeev avatar Daniil Galiev avatar Евгения Хомякова avatar Dmitry Doni avatar Anna Stakhovskaya avatar Sasha Mikhailov avatar Fedor S. Lavrentyev avatar  avatar Evgenii Kartoshkin avatar Kirill avatar Viktoriia Posiagina avatar Alexandra Belousova avatar Aleksandr Briazgin avatar  avatar Maxim avatar Eugene avatar Dmitry avatar Sergey avatar Artemij Rodionov avatar  avatar  avatar Evgenii Melnikov avatar Alexander Volinskiy avatar Evgeny Bataev avatar  avatar  avatar Eduard Avetisyan avatar Andrey Voitovich avatar Eugenii Kartoshkin avatar  avatar oo00oo00oo00 avatar  avatar  avatar Alex avatar Igor Loban avatar Victoria Rybanova avatar Maxim avatar Vladislav Shulkevich avatar anastasia avatar Karen Galstyan avatar  avatar Anton Mosyagin avatar Peter avatar Andrey avatar Alexander Sigachov avatar  avatar Alexander Verkhoglyad avatar Aleksei Nikolaev avatar Dmitrii Kudriashov avatar Dmitrii Gornakov avatar  avatar Evgeniy Sorokin avatar Alex of Cyberia avatar Sukhorosov Aleksey avatar  avatar  avatar  avatar Stas avatar  avatar  avatar Nikita Pestrov avatar Kirill avatar Vitaliy Kovalev avatar  avatar  avatar Leonid Kozhinov avatar Nikita Bochkarev avatar Maria Sagaydak avatar Dima Goncharenko avatar

Watchers

Igor Loban avatar Leonid Kozhinov avatar jkermakov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.