Markdown Editor

Data Pipeline Specification Template

Batch or streaming pipeline: sources, lineage, schedule, mapping, quality checks, backfills, volumes, runbook

AI & DataFulldatapipelinespecmath

How to use: Use when designing or documenting a production data pipeline. Fill purpose, sources and sinks, and the output grain first, and review them with consumers. The main pitfall is a pipeline that cannot be re-run idempotently, which makes every backfill risky.

Preview

Data Pipeline Specification: [Pipeline name]

Complete specification for a batch or streaming data pipeline: purpose, sources and sinks, lineage, schedule, extraction, transformations with a source-to-target mapping, data quality checks, idempotency and backfills, orchestration, error handling, volume and performance estimates, security and privacy, testing, operations and ownership. Replace every [bracketed] value and every row marked Example. Worked examples use a daily pipeline that builds an orders fact table.

Document control

FieldValue
Document ID[DPS-PIPELINE-001]
Pipeline name[Name]
Repository[Repository URL and path]
Version[0.1]
Status[Draft / In review / Approved / In production / Retired]
Owner[@pipeline-owner], [team]
Classification[Internal / Confidential]
Last updatedYYYY-MM-DD
Related documents[Data contracts for inputs and outputs], [Metric definitions], [Architecture description]

Approvals

RoleNameDecisionDate
Data engineering lead[@name][Approved / Changes requested]YYYY-MM-DD
Main consumer representative[@name][Decision]YYYY-MM-DD
Data platform / SRE[@name][Decision]YYYY-MM-DD
Privacy or security (if personal data)[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First draft
0.2YYYY-MM-DD[@name]Example: Switched order extraction to change data capture after volume review
1.0YYYY-MM-DD[@name]Example: Approved for production

Contents

1. Purpose and scope

1.1 Purpose

[Example: "Builds analytics.fct_orders, one row per order with customer, channel and net revenue in EUR, refreshed daily by 06:00 UTC for finance reporting and the demand forecast."]

1.2 Scope

In scopeOut of scope
Example: Orders from the order service and marketplace feedExample: Payments and refunds (separate pipeline)
Example: Currency conversion to EUR at daily reference rateExample: Real-time dashboards
[Item][Item]

1.3 Consumers and requirements

ConsumerNeedDeadlineContract
Example: Finance revenue dashboardComplete previous day06:00 UTCdc-fct-orders-001
Example: Demand forecast training3 years history, daily07:00 UTCdc-fct-orders-001
[Consumer][Need][Time][Contract]

2. Sources and sinks

2.1 Sources

IDSourceSystemFormat / accessVolume per dayOwnerContract
S-01Example: OrdersOrder service databaseChange data capture to object storage, Parquet300 000 rowsCommercedc-orders-001
S-02Example: Marketplace ordersPartner SFTPCSV, daily file by 02:00 UTC40 000 rowsPartnershipsPartner agreement 7.3
S-03Example: Exchange ratesReference data APIJSON, daily30 rowsTreasurydc-fx-002
S-04Example: CustomersWarehouse table core.customersSQL2 M rows (full)CRM teamdc-customers-003
[S-nn][Source][System][Format][Volume][Owner][Contract]

2.2 Sinks

IDSinkFormatWrite modePartitioningRetention
T-01Example: analytics.fct_ordersWarehouse tableOverwrite partition by order_dateDaily on order_date7 years
T-02Example: analytics.fct_orders_rejectsWarehouse tableAppendDaily on run_date90 days
[T-nn][Sink][Format][Mode][Partitioning][Retention]

3. Lineage

Data flows from four sources through staging and an intermediate join to the fact table and a rejects table.

4. Schedule and triggers

ItemValue
ScheduleExample: Daily at 03:00 UTC
Upstream dependenciesExample: Marketplace file present; CDC watermark past 00:00 UTC; FX rates for the date
Wait policyExample: Sensor waits up to 90 minutes, then runs without marketplace data and flags the partition provisional
Completion deadlineExample: 05:30 UTC (30 min buffer before consumer deadline)
Ad-hoc triggersExample: Manual run for a date range (backfill), see 8
Time zoneAll dates and windows in UTC

5. Extraction

SourceMethodWatermark / windowLate data handlingLimits
S-01Example: Incremental from CDC filescommit_ts greater than last watermarkReprocess previous 2 days each runNone
S-02Example: Full daily fileFile dateLate file triggers re-run for that date1 file per day
S-03Example: API call for dateRate dateRetry 3 times; use previous day rate and flag100 requests per minute
S-04Example: Snapshot joinAs of run timeNot applicableNone
[S-nn][Method][Watermark][Handling][Limits]

6. Transformations

6.1 Steps

StepInputOutputLogic
1S-01stg_ordersExample: Keep latest version of each order_id by commit_ts; cast types; rename columns
2S-02stg_marketplace_ordersExample: Parse CSV; map partner status codes to internal statuses
3stg_orders, stg_marketplace_ordersint_orders_unionedExample: Union; deduplicate on order_id; route invalid rows to rejects
4int_orders_unioned, stg_fx_rates, S-04fct_ordersExample: Convert to EUR; join customer segment; derive order_date

6.2 Source-to-target mapping

Target columnSource(s)Transformation ruleNull handling
order_idS-01 id; S-02 partner_order_refMarketplace IDs prefixed MKT-Reject row if null
order_dateorder_tsDate part of order_ts in UTCReject row if null
channelS-01 channel; constant for S-02S-02 rows get marketplaceunknown before 2022
net_amount_eurnet_amount, currency, FX ratenet_amount / rate rounded half-even to 2 decimalsReject if rate missing after fallback
customer_segmentS-04 segmentSegment as of run dateunassigned
[column][source][rule][handling]

7. Data quality checks

IDStageCheckThresholdSeverity
Q-01Input S-02File row count matches trailer recordExactBlocking
Q-02Stagingorder_id unique in int_orders_unioned100%Blocking
Q-03Outputnet_amount_eur not null100%Blocking
Q-04OutputDaily total within 3 standard deviations of 28-day mean for that weekdayWithin rangeWarning
Q-05OutputRejects below 0.5% of input rowsat most 0.5%Blocking above 2%, warning above 0.5%
Q-06ReconciliationTotal EUR matches finance ledger within toleranceat most 0.1%Warning
[Q-nn][Stage][Check][Threshold][Blocking / Warning]

8. Idempotency and backfills

TopicDesign
IdempotencyExample: Each run computes complete partitions for its dates and overwrites them atomically; no appends to the fact table
DeterminismExample: FX rate chosen by date, not by run time; customer segment taken from dated snapshot
Backfill commandExample: pipeline run fct_orders --start 2024-01-01 --end 2024-12-31 --parallel 4
Backfill limitsExample: At most 31 dates per batch; outside 03:00 to 06:00 UTC window
Consumer noticeExample: Announce backfills over 7 days in [channel] one day ahead
Reprocessing windowExample: Each daily run also recomputes the previous 2 days for late data

9. Orchestration

The task graph runs staging in parallel, then the join, then checks before the atomic publish.

SettingValue
Orchestrator[Tool name and version]
RetriesExample: 3 retries with exponential back-off from 5 minutes for transient errors
TimeoutsExample: 45 minutes per task; 150 minutes per run
ConcurrencyExample: One run per date; at most 4 dates in parallel
ComputeExample: Warehouse size M for build; S for checks

10. Error handling and alerting

FailurePipeline behaviourAlertRecipient
Source file missing after waitRun without it; partition marked provisionalWarningPipeline owner channel
Transient error (network, lock)Retry per section 9Only if retries exhaustedOn-call
Blocking quality check failsDo not publish; previous data staysPageOn-call; consumers notified
Deadline at risk (not finished by 05:00 UTC)ContinueWarningOn-call; finance contact
Schema change in sourceFail at staging with clear errorPageOn-call; source owner
[Failure][Behaviour][Alert][Recipient]

11. Performance and volume estimates

InputSymbolValue
Rows per day (all sources)RRExample: 340 000
Average row size after compressionbbExample: 120 bytes
Growth per yearggExample: 25%
RetentionYYExample: 7 years
Throughput of build stepθ\thetaExample: 2 000 000 rows per minute

Storage for the retention period, with yearly growth:

S≈365⋅R⋅b∑y=0Y−1(1+g)y=365×340 000×120 B×15.07≈225 GBS \approx 365 \cdot R \cdot b \sum_{y=0}^{Y-1} (1+g)^{y} = 365 \times 340\,000 \times 120 \ \text{B} \times 15.07 \approx 225 \ \text{GB}

Daily build time including a 3-day reprocessing window:

Tbuild≈3Rθ=1 020 0002 000 000≈0.5 minT_{build} \approx \frac{3R}{\theta} = \frac{1\,020\,000}{2\,000\,000} \approx 0.5 \ \text{min}
MeasureEstimateLimitHeadroom
Daily run time end to endExample: 25 minutes150 minutes6x
Backfill of one yearExample: 4 hours at parallel 4Outside business hoursOK
Storage at 7 yearsExample: about 225 GB[Budget][value]
Compute cost per month[value][Budget][value]

12. Security and privacy

TopicDesign
CredentialsExample: Service identity per pipeline; secrets in [secret manager]; rotated every 90 days
Least privilegeExample: Read on sources, write only on T-01 and T-02
Personal dataExample: Only pseudonymous customer_id; no names, emails or addresses copied
Data in transit and at restExample: TLS for SFTP and API; warehouse encryption at rest
Deletion requestsExample: Customer deletion propagates via core.customers tombstones; fact rows keep order but null customer_id
LoggingExample: No row-level data in logs

13. Testing

LevelWhat is testedDataWhen
UnitExample: Status mapping, currency conversion, roundingSmall fixturesEvery commit
IntegrationExample: Full DAG on a sampled day in a test schema1% sample, maskedEvery pull request
Data testsExample: Checks in section 7 against test outputTest schemaEvery pull request
RegressionExample: Compare output for 7 fixed dates with productionProduction snapshot copyBefore release
[Level][What][Data][When]

14. Deployment and change management

[Example: "Changes merged to the main branch deploy through CI to the orchestrator. Changes to output schema follow the data contract's breaking-change policy: 30 days notice and a parallel table version. Rollback redeploys the previous tag; data is restored by re-running the affected dates."]

15. Operations runbook

SituationSteps
Run failed on a transient error1. Check task log in [link]. 2. Clear and re-run the failed task. 3. Confirm checks pass.
Blocking quality check failed1. Read failing check output. 2. If source issue, contact source owner from 2.1. 3. Post status in [consumer channel]. 4. Re-run date when fixed.
Marketplace file late1. Confirm with partner contact. 2. When file arrives, run pipeline run fct_orders --date YYYY-MM-DD. 3. Remove provisional flag.
Need to reprocess historyFollow section 8; announce first.
[Situation][Steps]

16. Ownership and support

RoleName / teamContact
Pipeline owner[@name], [team][channel]
On-call[Rota name][Paging tool]
Source ownersSee 2.1[Links]
Main consumer contactsSee 1.3[Links]
Escalation[@data-engineering-lead][contact]

Standard and licence note

Based on common industry practice for data engineering pipeline specifications. Original text written for this collection; example numbers are illustrative. Template licence: MIT.

Related templates