Skip to main content

Apache Airflow DAG Builder for Data Pipelines

Generate production-ready Airflow DAGs with task dependencies, error handling, SLA monitoring, and dynamic task generation for data pipelines.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt makes the AI build a production-ready Apache Airflow DAG for a specific data pipeline. You define [pipeline_purpose], the [schedule_interval], the [data_sources], and the [destination], and the model generates a DAG with proper default_args — owner, retries=[retry_count], retry delay, failure email to [alert_email], and an SLA of [sla_duration] — plus task dependencies that model the real extract/transform/load flow.

The structure works because it bakes in the parts that keep a DAG maintainable a year later. It uses dynamic task generation driven by a config dictionary for [dynamic_tasks], so adding a new source is a config change rather than a code edit. It wires an on_failure_callback that sends task context to [alert_channel], inserts data quality checks via [quality_framework] between extract and load, manages XCom for metadata with cleanup to avoid table bloat, and makes tasks idempotent with date-partitioned staging and MERGE/upsert. Each variable maps to a concrete operational decision, so the output is a DAG you can run, not a skeleton.

When to use it

  • You're building a scheduled ETL pipeline and want the alerting, retries, and SLA configured correctly from the start.
  • You expect to add new data sources over time and want config-driven dynamic tasks instead of copy-pasted DAG code.
  • You need data quality gates between extract and load so bad data doesn't reach the warehouse.
  • You want idempotent tasks that are safe to re-run after a partial failure or backfill.
  • You're routing failure alerts to a chat channel and want full task context (dag_id, task_id, execution_date, log URL) in the message.
  • You're standardizing how your team writes DAGs and want a solid reference implementation.

Example output

Expect a complete Python DAG file: the default_args block, a config dictionary driving the dynamic source tasks, parallel extract tasks, transform tasks targeting your [executor_type], quality-check tasks, and load tasks with the correct upstream dependencies. It includes the failure callback, XCom usage with cleanup, and date-partitioned staging plus MERGE logic for the final load, with comments explaining the dependency graph.

Pro tips

  • Make [dynamic_tasks] genuinely config-driven: each entry should carry its own credentials and rate limits so adding a feed never touches DAG logic.
  • Set [retry_count] and [sla_duration] from real behavior — too many retries can mask a broken source, and an SLA shorter than the actual runtime fires constant false alarms.
  • Choose [executor_type] to match your cluster; a KubernetesExecutor reference won't help if you're on a Celery or local setup.
  • Keep XCom payloads small (row counts, file paths) and rely on the cleanup step — pushing large objects through XCom bloats the metadata DB.
  • Put the [quality_framework] checks before the load, not after, so failures quarantine bad data instead of poisoning the destination.
  • Verify idempotency by running the same execution date twice; the MERGE/upsert and partitioned staging should leave the destination unchanged.

Frequently Asked Questions

Does the generated DAG let me add new sources without editing code?
Yes, the prompt builds dynamic task generation from a config dictionary, so each source is defined as config with its own credentials and rate limits. Adding a new feed becomes a one-line config change rather than a DAG code edit that needs review.
Are the tasks safe to re-run or backfill?
The prompt makes tasks idempotent using date-partitioned staging tables and MERGE or upsert patterns for the final load. That means re-running the same execution date, including during a backfill, won't produce duplicate rows in the destination.
How are failures alerted?
It configures email alerts in default_args plus an on_failure_callback that posts to your alert channel with full task context: execution_date, dag_id, task_id, and the log URL. Having that context in the alert means you can jump straight to the failing task's logs.
Does it include data quality checks?
Yes, the DAG adds quality checks between the extract and load phases using your chosen framework to validate row counts, null percentages, and schema conformance. Running these before the load means bad data is caught at the gate instead of landing in the warehouse.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Data Engineering & ETL Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support