Skip to main content

Claude/ChatGPT Prompt to Architect a Production ETL/ELT Data Pipeline

Generate complete ETL/ELT pipeline code: extraction, transforms, load strategy, retries, quality checks, monitoring, and backfill.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt generates a complete, runnable data pipeline specification and code by translating seven distinct engineering concerns — extraction frequency, transformation rules, load strategy, retry logic, quality gates, monitoring hooks, and backfill support — into a single coherent implementation. The template's numbered structure mirrors how a senior data engineer actually scopes a pipeline, which is why the output tends to be architecturally sound rather than a loose collection of snippets.

The [pipeline_type] variable (ETL vs ELT, streaming vs batch, CDC vs full-load) drives the entire shape of the output. Changing it from "batch ETL" to "streaming ELT" shifts the generated code from a scheduled extraction pattern to an event-driven ingestion pattern with in-warehouse transformation. The template encodes that decision upfront so the AI does not have to guess.

What makes this work in practice is that the prompt forces specificity on the hardest parts: [retry_strategy] (exponential backoff? dead-letter queue?), [quality_rules] (null checks, referential integrity, schema drift detection?), and [load_strategy] (upsert, append-only, SCD Type 2?). Vague prompts produce vague pipelines. This template eliminates that.

When to use it

  • Building a nightly ETL from a SaaS CRM (Salesforce, HubSpot) into a data warehouse like BigQuery or Redshift.
  • Migrating from a legacy batch pipeline to a CDC-based streaming pipeline with Kafka or Debezium.
  • Setting up an ELT pipeline where raw data lands in Snowflake and dbt handles transformations.
  • Designing a multi-source ingestion pipeline that merges API responses, flat files, and database exports.
  • Adding backfill capability to an existing pipeline that was built without historical replay support.
  • Prototyping a pipeline architecture before handing specs to a data engineering team.

Example output

For pipeline_type=batch ELT, data_source=PostgreSQL orders table, source_format=CDC via pglogical, destination=Snowflake, volume=500K rows/day, frequency=hourly, tools=Airbyte + dbt + Airflow:

# Airflow DAG: orders_elt_pipeline

extract_task → raw_load_task → dbt_transform_task → quality_gate_task → alert_task

# dbt model: stg_orders.sql
SELECT order_id, customer_id, total_amount,
       COALESCE(status, 'unknown') AS status,
       _airbyte_emitted_at AS ingested_at
FROM {{ source('raw', 'orders') }}
WHERE _airbyte_emitted_at > '{{ var("start_ts") }}'

# Quality gate: Great Expectations checkpoint
- orders.order_id: not_null, unique
- orders.total_amount: between(0, 100000)
- Row count delta < 20% vs prior hour

# Monitoring: Airflow on_failure_callback → Slack webhook
def alert_on_failure(context):
    send_slack_message(
        channel="#data-alerts",
        text=f"Pipeline failed: {context['task_instance'].task_id}"
    )

# Retry: 3 attempts, exponential backoff (60s, 180s, 540s)
# Backfill: airflow dags backfill -s 2026-01-01 -e 2026-06-01 orders_elt_pipeline

Pro tips

  • Set [load_strategy] to upsert (MERGE) rather than truncate-reload for tables over 1M rows — the prompt will generate the appropriate MERGE SQL or on_schema_change dbt config instead of a naive overwrite.
  • For [quality_rules], list at least one schema-drift check (unexpected new columns) alongside value checks. Schema drift is the silent killer in API-sourced pipelines and the prompt handles it if you name it.
  • Pair [retry_strategy] with a dead-letter queue destination — write it as exponential backoff with DLQ to S3/GCS. The generated code will separate poison-pill records from retriable transient failures.
  • When using [tools] with dbt, specify dbt-core vs dbt Cloud — the generated scheduler integration and profiles.yml structure differ materially between the two.
  • For backfill scenarios, add [frequency]=event-driven + daily historical backfill to get both the streaming trigger logic and a separate Airflow DAG for historical replay in one output.

Frequently Asked Questions

Can this prompt generate pipelines for streaming sources like Kafka, not just batch database extracts?
Yes — set [pipeline_type] to 'streaming ELT' and [data_source] to your Kafka topic with [source_format] as 'Avro' or 'JSON'. The output shifts from a scheduled DAG to a consumer group pattern with offset management and a continuous load strategy. The transformation and quality check sections still generate, but they target a stream processor like Flink or Spark Structured Streaming instead of a batch runner.
What should I put in [quality_rules] if I am not sure what checks I need?
Start with three categories: completeness (not-null on primary keys and foreign keys), validity (value ranges, enum membership), and consistency (row count delta vs prior run, usually flagged at 15-20% deviation). Write them as plain English in the bracket — 'null check on order_id, amount between 0 and 50000, row count delta under 20%' — and the prompt will translate them into the appropriate framework syntax for whichever tool you named in [tools].
Does the generated pipeline code actually run, or is it pseudocode I need to finish?
It produces working structural code with real syntax for the tools you specify, but it will contain placeholder values for credentials, schema names, and environment-specific configs. Treat it as a 70-80% complete scaffold: connection strings, IAM role ARNs, and environment variable names need to be filled in. The logic — DAG dependencies, transformation SQL, retry decorators, quality checkpoint definitions — is production-grade and directly usable.
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 & SQL 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