Introduction

Why use airflow?

Advantages of Workflows as code & Airflow UI:

# AIRFLOW COMMON COMMANDS

# Check the version
which airflow 

# initialize the database
airflow db init

# start the web server, default port is 8080
airflow webserver -p 8080

# TO actually make airflow run the dags, we need to run it's scheduler aswell
# start the scheduler
airflow scheduler

Define a Simple DAG in Airflow

First, we have the imports


from datetime import timedelta
# The DAG object; we'll need this to instantiate a DAG
from airflow.models import DAG
# Operators; you need this to write tasks!
from airflow.operators.bash_operator import BashOperator
# This makes scheduling easy
from airflow.utils.dates import days_ago

Then, we have the default arguments for the DAG.