Giter Site home page Giter Site logo

marcosmarxm / airflow-testing-ci-workflow Goto Github PK

View Code? Open in Web Editor NEW
83.0 4.0 10.0 508 KB

(project & tutorial) dag pipeline tests + ci/cd setup

Home Page: https://blog.magrathealabs.com/how-to-develop-data-pipeline-in-airflow-through-tdd-test-driven-development-c3333439f358

Shell 7.41% Makefile 7.98% Python 84.60%
project airflow-testing airflow testing airflow-cicd tdd data-pipeline data-engineering

airflow-testing-ci-workflow's Introduction

Airflow DAG development with tests + CI workflow

CI MondayBuilding

This code is complementar to the article How to develop data pipeline in Airflow through TDD (test-driven development). I suggest you to read to better understand the code and the way I think how to setup the project.

Step-by-step: How to develop a DAG using TDD (english version)
Passo-a-passo: Como desenvolver uma DAG usando TDD (portuguese version)

The project

Below is a summary of what will be accomplished in this project. We'll simulate the transfer of some fake transaction data from an ecommerce. A simple task transfering data from the otlp-db database to the olap-db database.

Diagram

To help in the development we use a local development environment to build the pipeline with tests and also a Continuous Integration pipeline with Github Action to ensure that tests are applied at each change.

Containers

  • airflow: container running local setup for development;
  • oltp-db and olap-db: container that simulate database in a production environment and receive fake data;

In this tutorial we won't developt the dashboard part only the pipeline.

Dependencies?

Docker, docker-compose and makefile.

How to run?

The command below will setup the environment using docker-compose. Wait a few minutes (240s, yeah omg right?) to Airflow initialize its internal configuration, then the command will create credentials and connections.

make setup

By running the above command it is possible to access Airflow at localhost: 8080. A user of test user: admin / password: admin is created. At this stage you can develop your DAGs and test them as you modify them. And finally, the command that calls the pytest to perform tests.

make testing

Containers

Some resources about Airflow testing and DataOps:

airflow-testing-ci-workflow's People

Contributors

he7d3r avatar marcosmarxm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

airflow-testing-ci-workflow's Issues

Test failing when it should pass?

Just a note in case this happens for someone else: when I followed the tutorial and made the change which should make the first test to pass for the first time, I was still getting FAILED as a result.

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.