運用這些最佳做法,明確定義完整的成果、保護 Lakehouse 資料、讓重新執行的結果可預測,並要求 Fabric 資料工程代理程式 (Project Osmos) 任務提供可衡量的成功證據。
Important
資料工程代理程式(Project Osmos)目前處於預覽階段。 預覽功能以有限的功能提供,並受另行的補充預覽條款約束。 它們並非用於生產環境,不受服務等級協議約束,且可能僅在特定地區提供。 如需詳細資訊,請參閱 Microsoft Fabric 預覽資訊。
定義完整的專案成果
該技能將 專案成果 定義如下:
請描述完整的端對端資料工程任務。 資料工程代理會將它作為一個專案接收。
定義完整的結果,而非僅是第一個實施步驟。 包含以下五個要素:
| Element | 待解答的問題 | 例 |
|---|---|---|
| 目標 | 任務完成後,應該有什麼結果? | 建立每月供應商支出表。 |
| Sources | 任務應該使用哪些資料? | 閱讀發票 CSV 檔案和供應商 Delta 表格。 |
| Transformations | 任務應該適用哪些規則? | 標準化供應商識別碼、拒絕無效日期、加入供應商並彙整每月支出。 |
| Outputs | 任務應該創建或更新什麼? | 輸入 monthly_supplier_spend 並儲存轉換筆記本。 |
| Validation | 資料工程代理應該如何證明成功? | 對帳帳單總額、檢查重複鍵數,並回報被拒絕的列數。 |
使用此範本:
<goal>. Read <sources>. Apply <transformations>.
Create or update <outputs>. Validate <success criteria>. Preserve
<important constraints>.
明確劃定界限
說明資料工程代理可讀取哪些來源、可寫入哪些目的地,以及必須保留哪些現有產物。 識別任何影響任務的結構、保留、區域處理或商業規則限制。
Fabric 和 OneLake 權限仍然是授權邊界。 不要在 Project 結果中包含憑證、存取權杖、授權標頭或敏感資料。
寫出具體的 Project 成果
以下 Project 成果範例結合了目標、來源、轉換、輸出、約束與驗證標準。
資料探索
Profile the customer_events table without modifying it.
Summarize schema, row count, date range, null rates, duplicate event IDs,
category distributions, and outliers. Save the analysis in a notebook.
檔案匯入
Ingest JSON files from Files/device-events. Flatten the
event payload, standardize timestamps to UTC, quarantine malformed records,
write valid rows to device_events_bronze, and report processed, accepted,
and rejected counts.
資料轉換
Join Orders, OrderLines, Customers, and Products. Create
a Delta table named sales_order_detail with calculated line revenue and margin.
Validate referential integrity, duplicate order-line keys, and source-to-output
revenue totals.
資料品質修復
Assess customer_master for missing identifiers, invalid
email addresses, duplicate customers, and inconsistent country codes. Propose
a safe remediation plan, apply the approved changes to a staged table, and
produce before-and-after quality metrics.
結構現代化
Migrate the legacy_sales table to a documented schema
with typed dates, decimal monetary values, and standardized region codes.
Preserve the source table, create a tested notebook, and reconcile record
counts and revenue totals.
增量式載入
Build an incremental load from Files/orders-daily into
the Orders Delta table. Deduplicate by order_id and modified_at, update changed
orders, preserve unchanged rows, save the notebook, and validate inserted,
updated, unchanged, and rejected counts.
獎牌架構
Build bronze, silver, and gold layers for product,
inventory, and supplier files. Preserve raw inputs in bronze, standardize and
deduplicate entities in silver, create a gold inventory-risk table, save all
notebooks, and validate each layer.
選擇一個安全的書寫模式
建立任務時,選擇符合任務影響與可逆性的寫入模式:
- 複製後再提升:先對副本測試變更,再將已驗證的輸出移至正式位置。
- 分階段表: 請另行撰寫結果以供審查或受控晉升步驟。
- 原地迭代: 直接修改目標。 只有在了解風險與復原計畫後才使用。
- 重新執行時去除重複: 使用穩定的業務鍵以避免重複紀錄。
- 鎖定結構: 拒絕意外結構變更。
- 型別擴寬結構描述:允許相容的擴寬,同時防止任意變更。
Fabric 權限仍然是嚴格的授權界線。 不要只依賴 Project 的成果來保護關鍵資料。
讓重播變得可預測
告訴資料工程代理如何處理之前處理過的資料。 使用穩定的商業金鑰,並指定重執行是否失敗、新增資料、取消重複記錄、合併變更或替換目標。
對於增量任務,請詢問插入、更新、未更改及拒絕記錄的數量。 除非替換是明確要求的結果之一,否則保留原始資料與已驗證的輸出。