Community研究與資料分析github.com

建立資料攝取管線

建立批次與增量資料攝取(擷取-載入)管線 — 完整與增量擷取、變更資料擷取(CDC)、水位線與高水位標記、API 分頁與速率限制,以及選擇受管 EL 工具(Fivetran、Airbyte)或自訂程式碼。用於從資料庫、API、檔案或 SaaS 攝取資料至資料倉儲/資料湖,或設計增量擷取與 CDC。

建立資料攝取管線 是什麼?

此技能專注於設計與實作資料攝取管線,涵蓋從資料庫、API、檔案及 SaaS 平台將資料載入資料倉儲或資料湖的完整流程。它詳細說明三種主要的擷取模式:完整快照(適用於小型或維度表)、基於高水位標記的增量擷取(適用於大多數事實表),以及變更資料擷取(CDC,適用於需要捕捉刪除與每次變更的高交易量 OLTP 系統)。技能強調選擇可靠的高水位標記(例如 updated_at、LSN/binlog 或單調遞增序列)以避免遺漏資料,並透過重疊窗口處理延遲到達的更新。此外,它還深入探討 API 分頁與速率限制的處理策略(如指數退避和檢查點進度),並比較受管理 EL 工具(Fivetran、Airbyte)與自訂程式碼的適用場景,建議在標準連接器情境下使用管理工具以節省開發成本。常見陷阱包括依賴不可靠的 `updated_at` 標記、遺漏重疊窗口導致資料遺失、在擷取階段進行轉換破壞可重播性,以及非冪等載入造成的重複資料。支援的平台包括 Claude Code、Cursor、Codex 等 AI 代理工具。

相容平台~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 分頁 + 速率限制 — 跟隨 cursor/next-page 令牌;在收到 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.

相關技能