dbt-transformation-patterns
使用經過驗證的模式構建 dbt 模型
沒有清晰的結構,建立可靠的 dbt 轉換可能會很耗時。本技能提供分層模型模式、測試和增量策略,您可以快速應用。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「dbt-transformation-patterns」。 Create a dbt structure for Stripe and Shopify data with staging and marts.
預期結果:
- Set up staging models for Stripe customers and payments with stg_ prefix
- Add an intermediate model to aggregate payments by customer using int_ prefix
- Create marts with dim_customers for dimensions and fct_orders for facts
- Add YAML tests for unique and not_null on primary keys
- Configure incremental processing for large payment tables
正在使用「dbt-transformation-patterns」。 How do I test my dbt models?
預期結果:
- Add not_null and unique tests on all primary key columns
- Use relationships tests to validate foreign key references
- Add accepted_values tests for categorical columns like order_status
- Use dbt_utils.expression_is_true for business rule validation
- Configure freshness checks on source definitions
正在使用「dbt-transformation-patterns」。 What are incremental models and when should I use them?
預期結果:
- Incremental models process only new or changed data since last run
- Use when tables exceed 1 million rows to reduce runtime
- Configure with unique_key to identify records and incremental_strategy for update logic
- Use is_incremental() macro to filter incoming data
- Supports merge, delete+insert, and insert_overwrite strategies
安全審計
安全Pure documentation skill containing only SQL and YAML examples for dbt patterns. The static analyzer produced false positives: YAML frontmatter markers were flagged as shell backticks, Jinja2 template syntax was flagged as command execution, and normal dbt CLI commands were flagged as reconnaissance. All findings are dismissed. No executable code, network calls, file system access, or external command execution capabilities exist.
風險因素
⚙️ 外部命令 (34)
品質評分
你能建構什麼
標準化模型分層
採用暫存、中間和集市模式,確保命名和結構的一致性。
提升資料品質
為來源和模型添加測試,並提供清晰的文檔以實現治理。
啟動 dbt 項目
設定 dbt_project.yml 和清晰的資料夾佈局來存放模型。
試試這些提示
為我的 dbt 項目說明一個簡單的暫存、中間和集市佈局,並提供命名範例。
為客戶維度模型和訂單事實模型草擬 YAML 測試和文檔。
為付款功能建議一個增量模型配置,包含安全的增量過濾器。
展示一個巨集模式,以標準化 dbt 中的貨幣轉換和架構命名。
最佳實務
- 使用暫存層一次性清理來源資料,並在所有下游模型中重複使用
- 為模型中的每個主鍵列添加 not_null 和 unique 測試
- 在建構模型和欄位時就進行文檔記錄,並提供清晰的描述
避免
- 跳過暫存層並直接將原始資料聯結到集市會建立難以維護的代碼
- 硬編碼日期或值而非使用變數進行配置會破壞可移植性
- 在模型之間重複邏輯而非提取到可重複使用的巨集會增加維護成本