Year
2019, updated 2024
Context
Personal project
Role
Sole author
Status
Completed

Overview

An Apache Airflow DAG that loads a daily data file from Amazon S3 into Snowflake and posts the result to Slack. Configuration lives outside the code, every task has a failure callback, and the DAG uses the Airflow 2.x provider packages rather than the older contrib operators.

Origin

I first built this pipeline in 2019 and wrote it up on my blog at the time. The point then was that a data scientist should be able to stand up a small production workflow without a data engineer: an S3 sensor, a Snowflake COPY INTO, and a Slack message, with every credential pulled from Airflow connections through BaseHook.get_connection instead of sitting in the script. The 2024 version keeps that shape and swaps the contrib operators for the provider packages, which is what Airflow 2 expects.

Architecture

The pipeline has three stages.

1. Sense. An S3KeySensor checks the bucket every 30 minutes, for up to 12 hours, until the expected file lands.

2. Load. Snowflake’s COPY INTO command bulk-loads the CSV straight from S3 into the target table.

3. Notify. A webhook posts a success message to Slack. If any task fails, an alert goes out right away with the DAG and task context.

Tech Stack