Airflow Setup
EDU is largely unopinionated about how Airflow is hosted: it could in principle be in any cloud host, using any flavor of scheduler. However it does have some expectations about how configurations and connections are arranged, and may expect to have a mounted drive that is shared across workers for temporary storage.
Code and config#
Code#
EDU expects the following packages to be installed:
- edu_edfi_airflow
- ea_airflow_util
- dbt-core and either dbt-snowflake or dbt-databricks
The dbt project then also expects that your deployment has run dbt deps in the project, so that dbt packages are also installed, and that it has access to a connection profile, by default at ~/.dbt/profiles.yml.
Config#
The project template has example configuration files for multiple environments. These are certainly geared towards how we deploy and manage resources, but can be customized for other styles.
By default, it expects that for any given deployment, the core Airflow configuration file (such as configs/airflow_config_prod.yml) is symlinked to /home/airflow/airflow/configs/airflow_config.yml, but the exact location can be overridden provided the structure is correct.
This config file controls the schedule of dags, which dags exist (e.g. listing out tenants and years, see below), and the airflow connections that will be used by those dags.
Tenants and years#
EDU largely assumes the recommended Ed-Fi deployment pattern, which is: one ODS/API per school year, per district.
A tenant in EDU parlance then, is the entity that owns a sequence of ODSes across years. Strictly speaking that entity can be a whole state if you're operating on an ODS that combines all districts in a single environment, but this is a practice we recommend against. If this is your setup, our recommendation is that you still create individual Ed-Fi credentials scoped to each district, and utilize those in EDU.
Many of the operations EDU performs are then scoped to a single ODS/API, which is coded as belonging to a particular tenant and year.
Years: you must use a 4 digit year, using the Spring of the school year. The 2026-2027 school year is then represented as 2027. This aligns with how Ed-Fi thinks about years.
Tenants: Strictly speaking any string will work as a tenant_code, but our recommended practice is to use a human-readable, snake-case representation of the district's name (as opposed to e.g. the district's numeric ID), for easier use and interpretation. A district called Madison Metropolitan School District could then be called madison or madison_metropolitan.
Within the config file, each tenant-year combination gets its own config block, with its own Airflow connection (containing the API URL, key, and secret). Each tenant-year then becomes its own individual Airflow dag, such that they can be run independently, and turned off or removed as the older years become inactive.
Airflow Connections#
The stock required Airflow connections that must be created are as follows. Note that we assume each Airflow deployment has its own separate data lake and raw database locale.
- A
data_lakeobject storage bucket, with read/write permissions, for setting down objects to be loaded to the warehouse. - A database connection, utilizing the
loaderrole archetype described in [Terraform], with full read-write on the environment-appropriaterawdatabase. - Ed-Fi API credentials, typically one per tenant and year. Our naming convention is
edfi_{tenant}_{school_year}, but this is configurable.
Optional connections:
slack: This uses slack webhooks to notify a slack channel on failures. Other notification mechanisms could be added.dbtdocs bucket. This is just an object storage bucket for the rendered dbt docs of the project, which can then be hosted statically. This workflow currently only supports AWS, but static web-hosting against a storage bucket is generally pretty easy to set up in any cloud.