Community研究与数据分析github.com

构建数据摄取管道

构建批量和增量数据摄取(提取-加载)管道——涵盖全量提取与增量提取、变更数据捕获(CDC)、水印与高水位标记、API 分页与速率限制,以及选择托管式 EL 工具(Fivetran、Airbyte)还是自定义代码。用于从数据库、API、文件或 SaaS 将数据摄取到数据仓库/数据湖,或设计增量提取与 CDC。

构建数据摄取管道 是什么?

该技能旨在帮助开发者设计和实现高效、可靠的数据摄取管道,适用于从数据库、API、文件或 SaaS 工具向数据仓库或数据湖提取数据。它详细介绍了三种主要提取模式:全量快照(适用于小型/维度表)、基于可靠水印的增量提取(适用于大多数事实表)以及基于数据库日志的变更数据捕获(CDC,适用于需要捕获删除操作的高吞吐 OLTP 系统)。技能强调了原始数据的不可变落地、负载操作的幂等性(通过主键去重或分区覆盖实现),以及处理 API 分页、速率限制和重试机制的健壮模式。此外,它还提供了关于选择托管式 EL 工具(如 Fivetran 或 Airbyte)与自行编写自定义代码的实用决策指导,并指出了常见陷阱,例如依赖不稳定的 updated_at 水印、缺少重叠窗口导致丢失迟到数据、以及非幂等加载造成的重复问题。该技能适用于 Claude Code、Cursor 等平台,能帮助用户快速搭建端到端的数据摄取逻辑,避免常见错误。

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

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

在你喜欢的 AI 中提问

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

文档

构建数据摄取管道 是做什么的?

何时使用

  • 从数据库、API、文件或 SaaS 中提取数据到数据仓库/数据湖。
  • 设计增量提取、水印或 CDC。
  • 处理 API 分页、速率限制和重试。
  • 决定使用托管式 EL(Fivetran/Airbyte)还是自定义代码。
  • 不要用于转换已落地数据(应使用 dbt/Spark 技能)。

工作流

- [ ] 决定提取模式:全量快照 vs 增量 vs CDC
- [ ] 选择可靠的高水位标记(updated_at、LSN/binlog、序列)
- [ ] 原始数据不可变落地(追加),下游进行转换
- [ ] 使负载幂等(按键 upsert / 按分区覆盖)
- [ ] 处理分页、速率限制、重试和迟到数据
  1. 选择模式。 全量重载(小型/维度表)、基于某个高水位标记的增量(大多数事实表)或 CDC(高吞吐 OLTP,需要捕获删除及每次变更)。
  2. 选择可信的水印。 updated_at 仅在源始终更新它时才可用;否则使用数据库日志位置(LSN/binlog/SCN)或单调递增序列。存储上一次水印并从中恢复。
  3. 原始数据不可变落地。 将原始提取数据追加存储(青铜层)并带上加载元数据;下游进行转换,以便无需重新拉取源即可重放。
  4. 幂等负载。 按自然键 upsert 或覆盖分区,使重试和重叠不会导致重复(参见 writing-idempotent-transformations)。
  5. 健壮性处理 分页、速率限制和迟到数据。

模式

带重叠窗口的增量提取(处理迟到数据):

-- 在上一次水印后拉取一个小的重叠窗口,以捕获迟到更新,
-- 然后按键 upsert,使重叠不会产生重复。
SELECT * FROM source.orders
WHERE updated_at >= :last_watermark - INTERVAL '3 days';

CDC — 读取数据库日志(Debezium/原生方式)捕获插入、更新和删除(基于水印的提取无法捕获删除)。使用 MERGE 应用变更,利用变更的提交位置进行排序。

API 分页 + 速率限制 — 跟踪游标/下一页令牌;遇到 429/5xx 时使用指数退避和抖动进行回退和重试;记录进度,使失败时能从中断处继续。

托管式 vs 自定义 — 对标准连接器使用 Fivetran/Airbyte(它们处理模式漂移、增量状态、重试等);仅在非标准源或因严格管控/成本需求时编写自定义代码。

常见陷阱

  • updated_at 水印但源未可靠设置它 — 静默丢失行;验证或切换到基于日志的 CDC。
  • 没有重叠窗口 — 迟到到达的更新在多次运行之间丢失。
  • 基于水印的提取期望捕获删除 — 它无法看到删除;使用 CDC 或定期全量对账。
  • 提取过程中进行转换 — 使重放不可行;先落地原始数据。
  • 忽略速率限制/分页边界情况 — 部分拉取看起来完整;检查点并验证计数。
  • 非幂等负载 — 重试和重叠窗口导致重复行。

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-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/debugging-data-pipelines

Systematically root-cause data pipeline failures and data incidents — job errors, wrong or missing data, duplicates, and freshness misses — by tracing lineage upstream, isolating the failing stage, reconciling against source, and planning a safe fix and backfill. Use when a pipeline fails, numbers look wrong, data is missing or duplicated, a dashboard is stale, or a stakeholder reports a data discrepancy.

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.

相关技能