升級至 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_bttypecondition_contract_coco_numberinventory_movement_category_invoice_mov_categservice_document_type_service_document_typeservice_document_service_document_idservice_document_item_service_document_item_idpartner_service_document_type_pservice_document_typepartner_service_document_pservice_document_idpartner_service_document_item_pservice_document_item_idcompany_code_for_budget_account_bdgt_account_company_code
|
business_transaction_category_bttypecondition_contract_coco_numinventory_movement_category_inv_mov_categservice_document_type_service_doc_typeservice_document_service_doc_idservice_document_item_service_doc_item_idpartner_service_document_type_pservice_doc_typepartner_service_document_pservice_doc_idpartner_service_document_item_pservice_doc_item_idcompany_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_kfrepretype_of_business_j_1_kftbustype_of_industry_j_1_kftind
|
name_of_representative_j_1kfrepretype_of_business_j_1kftbustype_of_industry_j_1kftind
|
delivery_documents |
delivery_document_headers |
ECC |
number_category_1_rpfaessnumber_category_2_rpkistnumber_category_3_rpcontnumber_category_4_rpsonstloading_sequence_number_rpflgnr
|
number_category_1_bev1_rpfaessnumber_category_2_bev1_rpkistnumber_category_3_bev1_rpcontnumber_category_4_bev1_rpsonstloading_sequence_number_bev1_rpflgnr
|
delivery_documents |
delivery_document_headers |
S/4HANA |
header_customer_reserve_status1_suvk01到5_suvk05item_customer_reserve_status1_suvs01到5_suvs05
|
header_customer_reserve_status1_uvk01到5_uvk05item_customer_reserve_status1_uvs01到5_uvs05
|
delivery_documents |
delivery_document_items |
ECC、S/4HANA |
cfop_code_and_extension_j_1_bcfoptax_law_icms_j_1_btaxlw1tax_law_ipi_j_1_btaxlw2iss_tax_law_j_1_btaxlw3cofins_tax_law_j_1_btaxlw4pis_tax_law_j_1_btaxlw5sd_tax_code_j_1_btxsdc
|
cfop_code_and_extension_j_1bcfoptax_law_icms_j_1btaxlw1tax_law_ipi_j_1btaxlw2iss_tax_law_j_1btaxlw3cofins_tax_law_j_1btaxlw4pis_tax_law_j_1btaxlw5sd_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_typeservice_document_service_document_idservice_document_item_service_document_item_id
|
service_document_type_service_doc_typeservice_document_service_doc_idservice_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_tcash_discount_percentage1_zbd1_p、cash_discount_percentage2_zbd2_plogical_system_logsy
|
discount_days1_zbd1t、discount_days2_zbd2t、discount_days3_zbd3tcash_discount_percentage1_zbd1p、cash_discount_percentage2_zbd2plogical_system_logsys
|
purchasing_documents |
purchasing_document_items |
ECC、S/4HANA |
inflation_index_j_1_aindxpinflation_index_date_j_1_aidatep
|
inflation_index_j_1aindxpinflation_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_bttypecustom_business_transaction_type_not_used_yet_cbttypeaccount_assignment_type_accastypartner_account_assignment_type_paccasty
|
business_transaction_category_bttypebusiness_transaction_type_cbttypeobject_type_accastypartner_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_kfrepretype_of_business_j_1_kftbustype_of_industry_j_1_kftind
|
name_of_representative_j_1kfrepretype_of_business_j_1kftbustype_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_performanceSAP 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檔案。
後續步驟
- 請按照「升級 Cortex Framework」中的端對端檢查清單操作。
- 查看 Cortex Framework 淘汰項目,瞭解 8.0 版預定移除的項目。
- 查看資料品質斷言,自訂封鎖規則和嚴重性標記。