升級至 7.1 版

本指南列出將現有 Google Cloud Cortex Framework 7.0.x 版部署作業升級至 7.1.0 版時,需要執行的版本專屬變更和遷移動作。請按照這些操作說明,以及「升級 Cortex Framework」中的標準工作流程操作。您也可以執行 /upgrade-cortex 代理技能,自動檢查及更新設定檔。

Python 仍為 3.13 (>=3.13,<3.14)。如要瞭解預計在 8.0 版中移除的已淘汰項目,請參閱「Cortex Framework 淘汰項目」。

請參閱下表,跳至適用於您部署作業的章節:

如果部署作業使用... 查看
任何 7.0.x 版設定 設定和 CLI 變更
SAP ERP 資料產品 破壞性 SAP 資料欄變更和完整重新整理和行為變更和孤立物件
自訂tableSettings覆寫 自訂table_settings.yaml更新
自訂模組或 Python 建構工具 遷移自訂客戶資料產品和 Python 建構工具

設定和 CLI 變更

請在建構前,於步驟 2:更新設定、自訂設定和擴充功能套用這些更新。

命名空間探索

  • 內建命名空間:省略內建 data.namespaces 項目 (cortex、cortex_samples、cortex_v6_compatibility) 上的 path,例如 - name: cortex。
  • 許可清單行為:data.namespaces 現在設定後會成為嚴格的許可清單 (namespaces: [] 啟用零命名空間,而 namespaces: null 驗證失敗)。列出已啟用模組參照的所有內建和本機自訂命名空間,或省略 data.namespaces,僅自動探索已安裝的套件。

資料品質斷言

  • 預設啟用 (data.assertionsEnabled: true):共用 Google Cloud專案時,請為每個部署作業設定不重複的 data.defaultAssertionDataset (否則預設的 dataform_assertions 資料集可能會在部署作業之間發生衝突),並在 CI/CD 中將 --create-datasets 傳遞至 uv run cortex-deploy。如要停用,請設定 data.assertionsEnabled: false。
  • 嚴重性標記:請同時設定 data.assertionSeverities 和 data.defaultAssertionSeverity,或兩者皆省略。

目標和目錄設定

  • 已移除 type: generic 目標:移除 type: generic 項目,或將其替換為 type: git (請注意,type: git 需要使用 targetSettings.authorEmail、全域 git config user.email 或同時使用 GIT_AUTHOR_EMAIL 和 GIT_COMMITTER_EMAIL 的修訂電子郵件)。
  • 全區隔 ignoredPaths 比對:在 type: dataform 目標上,targetSettings.ignoredPaths (預設為 ["definitions/custom"]) 現在會比對整個路徑區隔,而非前置字串。請將未受管理的檔案移至 definitions/custom/ 下方,或將 definitions/custom_* 等路徑新增至 ignoredPaths,以免 uv run cortex-deploy 刪除這些檔案。
  • 目錄 tableSettings 許可清單:更新任何目錄 tableSettings 檔案 (tables:/variants:),列出所有必要的來源資料表。

CLI 異動

7.0.x 版 7.1 版
uv run cortex-build --create-datasets 將 --create-datasets (以及選用的 -y/--yes) 傳遞至 uv run cortex-deploy 或 uv run cortex-build-and-deploy。
uv run cortex-deploy --assertions 將 --assertions 傳遞至 uv run cortex-build 或 uv run cortex-build-and-deploy。
uv run cortex-kc-sync 和 --data-modules-root-directory 使用 uv run cortex-create-kc-data-products,並在 data.namespaces 中宣告命名空間。
uv run cortex-demo (僅限 SAP 預設;snake_case 旗標) 預設為 --sources all (傳遞 --sources sap 即可保留 7.0.x 範圍),並使用 dash-case 旗標;請參閱 uv run cortex-demo。

自訂 table_settings.yaml 更新

請按照「升級時的自訂 table_settings.yaml 行為」一節的說明,套用下列 7.1 版更新:

  • 資料產品:將複製的檔案縮減為明確覆寫,尤其是 sales_document_flow 上任何過時的 materializationType: incremental 覆寫 (請參閱「行為變更和孤立物件」),以及未變更的 dataformTags (例如 billing_document_headers 和 billing_document_items 從 monthly 變更為 hourly)。
  • 資料基礎:比較自訂 SAP 基礎檔案與 7.1 版table_settings.default.yaml,保留新增的 ECC 資料表 (faglflext、glt0) 和預設斷言 (makt、vbak)。
  • 時間分區:將已淘汰的 partitionType: DATE | DATETIME | TIMESTAMP 替換為 partitionType: time 和 dataType: DATE | DATETIME | TIMESTAMP。

破壞性 SAP 資料欄變更和全面重新整理

7.1 版會將 SAP 資料產品資料欄後置字串,與確切的 SAP 資料字典 (DDIC) 欄位名稱對齊,並移除 23 個增量 SAP 產品資料表中的非核心 SAP IS-Fashion (*_fsh_*) 外掛程式資料欄。

SAP 資料欄重新命名和移除參考資料

展開即可查看 23 個資料表的 SAP 資料欄重新命名和移除對應

資料產品 資料表 SAP 版本 7.0.x 版欄 7.1 版資料欄或狀態
accounts_payable accounts_payable S/4HANA bus_transac_type_bttype
condition_contract_coco_number
inventory_movement_category_invoice_mov_categ
service_document_type_service_document_type
service_document_service_document_id
service_document_item_service_document_item_id
partner_service_document_type_pservice_document_type
partner_service_document_pservice_document_id
partner_service_document_item_pservice_document_item_id
company_code_for_budget_account_bdgt_account_company_code
business_transaction_category_bttype
condition_contract_coco_num
inventory_movement_category_inv_mov_categ
service_document_type_service_doc_type
service_document_service_doc_id
service_document_item_service_doc_item_id
partner_service_document_type_pservice_doc_type
partner_service_document_pservice_doc_id
partner_service_document_item_pservice_doc_item_id
company_code_for_budget_account_bdgt_account_cocode
accounts_receivable accounts_receivable S/4HANA 與前一列的 accounts_payable 相同,共有 10 欄 與上一列的 accounts_payable 相同,有 10 個重新命名的資料欄
addresses addresses ECC、S/4HANA flag_x400flagcomm8 flag_x400_flagcomm8
bill_of_materials bill_of_materials_items ECC、S/4HANA deviation_values_fsh_vmkz、quantity_distribution_profile_fsh_pgqr、quantity_distribution_profile_reference_fsh_pgqrrf、critical_component_fsh_critical_comp、critical_level_fsh_critical_level 已移除 (IS-Fashion 外掛程式)
billing_documents billing_document_items ECC、S/4HANA season_year_fsh_season_year、season_fsh_season、collection_fsh_collection、theme_fsh_theme 已移除 (IS-Fashion 外掛程式)
customers customers ECC、S/4HANA name_of_representative_j_1_kfrepre
type_of_business_j_1_kftbus
type_of_industry_j_1_kftind
name_of_representative_j_1kfrepre
type_of_business_j_1kftbus
type_of_industry_j_1kftind
delivery_documents delivery_document_headers ECC number_category_1_rpfaess
number_category_2_rpkist
number_category_3_rpcont
number_category_4_rpsonst
loading_sequence_number_rpflgnr
number_category_1_bev1_rpfaess
number_category_2_bev1_rpkist
number_category_3_bev1_rpcont
number_category_4_bev1_rpsonst
loading_sequence_number_bev1_rpflgnr
delivery_documents delivery_document_headers S/4HANA header_customer_reserve_status1_suvk01到5_suvk05
item_customer_reserve_status1_suvs01到5_suvs05
header_customer_reserve_status1_uvk01到5_uvk05
item_customer_reserve_status1_uvs01到5_uvs05
delivery_documents delivery_document_items ECC、S/4HANA cfop_code_and_extension_j_1_bcfop
tax_law_icms_j_1_btaxlw1
tax_law_ipi_j_1_btaxlw2
iss_tax_law_j_1_btaxlw3
cofins_tax_law_j_1_btaxlw4
pis_tax_law_j_1_btaxlw5
sd_tax_code_j_1_btxsdc
cfop_code_and_extension_j_1bcfop
tax_law_icms_j_1btaxlw1
tax_law_ipi_j_1btaxlw2
iss_tax_law_j_1btaxlw3
cofins_tax_law_j_1btaxlw4
pis_tax_law_j_1btaxlw5
sd_tax_code_j_1btxsdc
inventory_and_special_stocks sales_order_stock ECC season_year_fsh_season_year、season_fsh_season、collection_fsh_collection、theme_fsh_theme、allocated_stock_quantity_fsh_salloc_qty 已移除 (IS-Fashion 外掛程式)
inventory_and_special_stocks special_stocks_from_vendor ECC 與 sales_order_stock 相同的 5 個*_fsh_*欄 已移除 (IS-Fashion 外掛程式)
inventory_and_special_stocks special_stocks_with_customer ECC 與 sales_order_stock 相同的 5 個*_fsh_*欄 已移除 (IS-Fashion 外掛程式)
production_orders production_order_header ECC、S/4HANA master_production_order_fsh_mprod_ord 已移除 (IS-Fashion 外掛程式)
production_orders production_order_item ECC、S/4HANA season_year_fsh_season_year、season_fsh_season、collection_fsh_collection、theme_fsh_theme、allocated_stock_quantity_fsh_salloc_qty 已移除 (IS-Fashion 外掛程式)
purchasing_documents purchasing_document_account_assignments S/4HANA service_document_type_service_document_type
service_document_service_document_id
service_document_item_service_document_item_id
service_document_type_service_doc_type
service_document_service_doc_id
service_document_item_service_doc_item_id
purchasing_documents purchasing_document_headers ECC、S/4HANA discount_days1_zbd1_t、discount_days2_zbd2_t、discount_days3_zbd3_t
cash_discount_percentage1_zbd1_p、cash_discount_percentage2_zbd2_p
logical_system_logsy
discount_days1_zbd1t、discount_days2_zbd2t、discount_days3_zbd3t
cash_discount_percentage1_zbd1p、cash_discount_percentage2_zbd2p
logical_system_logsys
purchasing_documents purchasing_document_items ECC、S/4HANA inflation_index_j_1_aindxp
inflation_index_date_j_1_aidatep
inflation_index_j_1aindxp
inflation_index_date_j_1aidatep
purchasing_documents purchasing_document_types ECC 9 個*_fsh_*欄:vas_active_flag_fsh_vas_act、determination_procedure_fsh_vas_kalsm、vas_deletion_criteria_fsh_vas_del、vas_determination_date_fsh_vas_detdt、excl_return_items_fsh_excl_return、determination_procedure_fsh_var_kalsm、determination_procedure_fsh_dpr_detpro、generic_material_creation_fsh_po_idoc、auto_distribution_fsh_auto_dc 已移除 (IS-Fashion 外掛程式)
purchasing_documents purchasing_document_types S/4HANA 與 9 個 ECC *_fsh_* 欄相同,加上 vas_quantity_correlation_fsh_vas_corr 和 variants_optional_fsh_vm_act (共 11 個) 已移除 (IS-Fashion 外掛程式)
purchasing_documents purchasing_document_vendor_confirmations ECC、S/4HANA allocated_stock_quantity_fsh_salloc_qty 已移除 (IS-Fashion 外掛程式)
purchasing_documents purchasing_documents_history ECC、S/4HANA logical_system_logsy (ECC、S/4HANA)
quantity_quantity_diff (S/4HANA)
season_year_fsh_season_year、season_fsh_season、collection_fsh_collection、theme_fsh_theme (ECC、S/4HANA)
logical_system_logsys (ECC、S/4HANA)
quantity_qty_diff (S/4HANA)
已移除 (IS-Fashion 外掛程式)
universal_journal universal_journal_entry_line_items S/4HANA business_transaction_type_bttype
custom_business_transaction_type_not_used_yet_cbttype
account_assignment_type_accasty
partner_account_assignment_type_paccasty
business_transaction_category_bttype
business_transaction_type_cbttype
object_type_accasty
partner_object_type_paccasty
vendor_invoices vendor_invoice_headers ECC、S/4HANA logical_system_logsy logical_system_logsys (也新增了不換行 company_code_bukrs)
vendor_invoices vendor_invoice_items ECC、S/4HANA season_year_fsh_season_year、season_fsh_season、fashion_collection_fsh_collection、fashion_theme_fsh_theme 已移除 (IS-Fashion 外掛程式;也新增了不分行 company_code_bukrs)
vendors vendors ECC、S/4HANA name_of_representative_j_1_kfrepre
type_of_business_j_1_kftbus
type_of_industry_j_1_kftind
name_of_representative_j_1kfrepre
type_of_business_j_1kftbus
type_of_industry_j_1kftind

一次性全面重新整理的其他資料表

在適用情況下,對下列累加型資料表執行一次性指定全面重新整理 (執行指定全面重新整理):

  • 在首次執行 7.1 版增量作業 (S/4HANA) 之前或當下,必須完成下列事項: material_documents (cortex.sap.products.materials_movement) 新增 13 個MATDOC 庫存資料欄,並使用 material_document_record_type 展開 uniqueKey。
  • 過帳非兩位小數貨幣 (TCURX 縮放) 時為必要:asset_annual_cumulative_balances (S/4HANA) 和 vendor_open_items、vendor_cleared_items、customer_open_items 和 customer_cleared_items (ECC)。(accounts_payable、accounts_receivable 和 purchasing_document_headers 已列在上述 23 個資料表的清單中)。
  • 如要啟用 sales_performance SAP ERP 範例,則必須執行以下操作: sales_performance (cortex_samples.sap.products.sales_performance;在 customers 後重新整理) 會新增 v7.1 資料欄,例如由新 signed_net_value_bounds 斷言驗證的 signed_net_value_in_document_currency (請參閱銷售業績深入分析)。

對這些累加型資料表執行一次完整重新整理,清除 7.0.x 版彙整和可為空值的 LEFT JOIN 專屬鍵缺陷造成的舊版重複項目:

  • 客戶、供應商和地址彙整:business_partner_addresses、business_partner_bank_details 和下游 supplier_spend_analysis (在 vendors 之後重新整理)。
  • Tightened uniqueKey (ECC、S/4HANA):vendor_invoice_account_assignments 和 countries。
  • 受保護的可為空值 LEFT JOIN 專屬鍵 (ECC、S/4HANA):asset_transaction_types、cost_elements、cost_centers、profit_centers、currency_codes、set_headers、depreciation_terms、fixed_assets_master、general_ledger_accounts、country_tax_regions、languages、ledger_master、material_cross_plant_batches、material_plant_batches、material_batch_stocks、material_plants、material_movement_types、flattened_product_hierarchies、project_structure、distribution_channels、divisions、sales_organizations 和 units_of_measurement。
  • 受保護的可為空值 LEFT JOIN 專屬金鑰 (僅限 ECC):special_stocks_with_vendor。
  • 受保護的可為空值 LEFT JOIN 專屬鍵 (僅限 S/4HANA):financial_hierarchy_nodes 和 group_journal_entries (也會新增叢集)。

行為異動和孤立物件

  • sales_document_flow 具體化:ECC 和 S/4HANA 的預設 materializationType 已從 incremental 變更為 table,因此未結帳的出貨單仍會顯示 (增加資料列數)。編譯前,請移除所有過時的 materializationType: incremental 覆寫,因為如果 incremental 模型沒有 uniqueKeys,編譯就會失敗。不需提供 --full-refresh。
  • 孤立的 S/4HANA 資料表:materials_by_storage_location 已從 cortex.sap.products.materials 移至僅限 ECC 的 cortex.sap.products.inventory_and_special_stocks。在 S/4HANA 上,確認沒有下游消費者查詢舊版 PRODUCT_DATASET.materials_by_storage_location 資料表 (以及未使用的 mard、mbew、mbewh 或 t001l 基礎資料表,且沒有其他已啟用的 S/4HANA 產品參照這些資料表) 後,請捨棄這些資料表。
  • 現有資料的斷言:在完成一次性完整重新整理之前,預設斷言可能會在升級前的重複資料列上失敗。嚴重性標記會發出 severity_LEVEL,而封鎖行為則依規則設定 (blocking: true)。

遷移自訂資料產品和 Python 建構工具

如果您維護自訂模組或 Python 建構工具,請在建構前套用下列更新 (完整參考資料請參閱擴充性指南)。

自訂 YAML 和 JavaScript 資料產品

  • 使用 publisher.publish()/publisher.operate():將裸 publish(...) 和 operate(...) 呼叫替換為 const publisher = require("includes/publisher.js");,以便執行封鎖斷言和資料列/資料欄層級安全性掛鉤。
  • 更新 incremental.getFilter() 呼叫:傳遞選項物件 ({ targetColumn: "..." } 或 { timestampColumn: "..." }) 或已知來源類型簡寫 ("sap"、"sfdc" 或 "salesforce") 做為第三個引數;其他字串現在會擲回錯誤。
  • 明確宣告斷言:將 7.0.x 版隱含鍵斷言替換為 table_settings.default.yaml 中的 assertions.standardRules (請參閱「資料品質斷言」)。
  • 清除已淘汰的金鑰和建構工具別名:從 manifest.yaml 移除 type:,並從 config/config.yaml 移除 moduleType:。取代已淘汰的別名 (generic_product、composite_product、generic_composite_product、sap_bdc_product → flat_product;sfdc → sfdc_foundation)。請注意,flat_product 預設為 incremental (而舊版 generic_product/composite_product 預設為 table),因此請明確設定 materializationType 或提供 uniqueKeys。

自訂 Python 建構工具

  • 從 common.sdk 匯入:將 common.builders.*、common.schemas.* 和已移除的 common.registry 匯入項目替換為 common.sdk。
  • 使用具體子類別:直接子類別 FlatProductBuilder 或 FoundationBuilder (而非 ProductBuilder[DataProductModuleConfig]),並在 build() 中接受 (self, node, ctx)。
  • 為程式輔助建構工具設定 table_settings_schema = None:根據預設,子類別為 FlatProductBuilder 的建構工具會預期有 table_settings 檔案;如果建構工具在沒有該檔案的情況下產生 SQL,請設定 table_settings_schema = None。
  • 重新定位建構工具:將已淘汰的藍圖本機 ./builder.py 模組移至 NAMESPACE/builders/,並在 manifest.yaml 中參照 plugin_id,然後移除命名空間樹狀結構中的 __init__.py 檔案。

後續步驟