Community研究与数据分析github.com

调试数据管道

系统性地根本原因分析数据管道故障与数据事件——包括作业错误、数据错误或缺失、重复数据以及数据新鲜度不达标——通过向上追溯血缘关系、隔离故障阶段、与源数据进行比对,并规划安全的修复和回填方案。

调试数据管道 是什么?

该技能为AI代理提供了一个结构化的调试框架,用于解决数据管道故障(作业失败、数据质量异常、数据延迟或重复)。其核心方法论包括精确定义症状、沿数据血缘关系向上进行二分查找以定位首个故障阶段、对可疑阶段与其输入进行行计数或汇总值的比对分析、进行根本原因分类(代码变更、源数据问题或运行故障),并指导执行幂等回填与预防性检查。该技能适用于各类数据管道工具(dbt、Airflow等),但建议在遇到数据正确性问题时在工具专有技能(如`debugging-dbt-runs` / `debugging-airflow-pipelines`)之后使用。它支持SQL比对查询、时间线关联分析以及常见陷阱的识别,从而提供高效且可重复的调试流程。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Unknown-333/awesome-data-engineering-skills/tree/main/skills/debugging-data-pipelines

Installed? Explore more 研究与数据分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

调试数据管道 是做什么的?

何时使用

  • 管道任务失败,或输出数据错误/缺失/重复。
  • 仪表板过期或指标与源数据不一致。
  • 利益相关者报告数据差异,您必须找出原因。
  • 不要用于已被 debugging-dbt-runs / debugging-airflow-pipelines 涵盖的工具特定运行错误(请先从那里开始,然后再将此技能用于数据正确性事件)。

工作流程

- [ ] 精确定义症状(哪张表、哪个列、哪些行、哪个时间窗口)
- [ ] 向上追溯血缘关系,找到数据首次出现错误的阶段
- [ ] 隔离问题:是代码错误、输入数据错误、数据延迟还是运行故障?
- [ ] 将可疑阶段与其源数据进行比对(行计数/汇总值)
- [ ] 修复根本原因,然后规划受影响窗口的幂等回填
- [ ] 添加检查,防止问题无声地再次出现
  1. 明确症状。“fct_orders 表中 2026-01-15 的收入大约低了 30%”是可调试的;“数字看起来不对”不是。获取表名、列名、行数及时间窗口。
  2. 向上追溯血缘关系。从错误输出向后,通过模型/任务反向遍历,找到数据首次出现错误的阶段。对DAG进行二分查找,而不是逐阶段检查。
  3. **分类原因:**代码变更、源数据错误/延迟、运行失败/部分运行,或非幂等重复。
  4. 比对可疑阶段与其输入(行计数、键计数、汇总值),确认差异出现在何处。
  5. 修复 + 回填受影响的窗口,使用幂等方式(参见 designing-backfills-and-replays)。
  6. 防止再次出现,添加针对性的数据质量检查。

模式

血缘二分查找 — 检查DAG中间阶段的数阶段:如果该阶段的数据正确,则错误在下游;如果错误,则继续向上游查找。重复此过程。

在受影响窗口内比对源数据与目标数据:

-- 对于错误窗口,阶段与其输入的行计数/汇总值是否匹配?
SELECT 'source' AS layer, COUNT(*) n, SUM(amount) total
FROM staging.orders WHERE order_date = DATE '2026-01-15'
UNION ALL
SELECT 'target', COUNT(*), SUM(amount)
FROM marts.fct_orders WHERE order_date = DATE '2026-01-15';

计数差异 → 行被丢弃/过滤,或部分加载失败。计数相同但汇总值差异 → 转换/逻辑错误。目标计数更高 → 重复(非幂等加载)。

时间线检查 — 将事件窗口与部署、源模式变更和运行历史关联起来;大多数事件始于一次变更。

常见陷阱

  • 在下游修复症状 — 当错误在 staging 层时修补 mart 表,会导致问题复发;应修复第一个错误阶段。
  • 手动对生产数据进行一次性修复 — 无法审计且不可重复;应修复代码并以幂等方式重新运行。
  • 线性地阅读整个 DAG — 应改用血缘二分查找。
  • 跳过比对 — 猜测数据在哪里出现分歧会浪费时间;应测量每个阶段的行计数/汇总值。
  • 修复后未添加预防性检查 — 同类错误会无声地再次出现。

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

Unknown-333/authoring-airflow-dags

Write production-grade Apache Airflow DAGs using the TaskFlow API — idempotent tasks, correct scheduling and catchup, retries/SLAs, connections/variables, and avoiding top-level code. Use when creating or reviewing Airflow DAGs, scheduling pipelines, wiring task dependencies, configuring retries/backfills, or fixing non-idempotent tasks.

Unknown-333/building-dagster-assets

Build Dagster pipelines using software-defined assets — asset dependencies, partitions, resources and IO managers, asset checks, and schedules/sensors. Use when creating Dagster assets or jobs, modeling data as assets, adding partitions or backfills, wiring resources/IO managers, or migrating from task-based orchestration to assets.

Unknown-333/building-dbt-models

Build well-structured dbt models — staging/intermediate/marts layers, ref() and source(), materializations, and incremental models with the right strategy. Use when creating or refactoring dbt models, choosing table vs view vs incremental, structuring a dbt project, or writing incremental logic.

Unknown-333/building-feature-pipelines

Build ML feature pipelines and feature stores — point-in-time-correct joins to avoid label leakage, offline/online parity, feature freshness and backfills, and materialization with tools like Feast. Use when engineering features for ML, preventing train/serve skew or data leakage, building a feature store, or backfilling historical features for training.

Unknown-333/building-iceberg-tables

Design and operate Apache Iceberg tables — partitioning and hidden partitioning, partition/schema evolution, snapshots and time travel, compaction and small-file cleanup, and MERGE/upsert for lakehouse tables on Spark, Flink, Trino, or Snowflake. Use when creating or maintaining Iceberg tables, choosing partitioning, evolving schema/partitions, or fixing small-file and metadata bloat.

Unknown-333/building-ingestion-pipelines

Build batch and incremental data ingestion (extract-load) pipelines — full vs incremental extraction, change data capture (CDC), watermarks and high-water marks, API pagination and rate limits, and choosing managed EL tools (Fivetran, Airbyte) vs custom code. Use when ingesting data from databases, APIs, files, or SaaS into a warehouse/lake, or designing incremental extraction and CDC.

Unknown-333/building-kafka-consumers

Build reliable Apache Kafka consumers and producers — consumer groups and partition assignment, offset commit strategy, at-least-once vs exactly-once, idempotent/transactional producers, rebalancing, and dead-letter handling. Use when writing Kafka consumers/producers, configuring offset commits or consumer groups, tuning throughput, or handling rebalances and poison messages.

Unknown-333/designing-backfills-and-replays

Plan and run safe data backfills and replays — idempotent reprocessing of historical windows, partition-by-partition execution, isolating backfill compute from production, verifying results, and avoiding double-counting or changed history. Use when backfilling a new or fixed model, reprocessing after a bug, replaying events, or loading history for a new pipeline without corrupting existing data.

Unknown-333/designing-data-contracts

Define and enforce data contracts between producers and consumers — explicit schema, semantics, ownership, SLAs, and versioning — to prevent silent upstream changes from breaking downstream pipelines. Use when a producer schema change could break consumers, defining an interface between teams/services and the warehouse, or adding schema enforcement at ingestion.

相关技能