升级到 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 范围),带有短划线大小写标志;请参阅 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 |
Removed (IS-Fashion add-on; non-breaking company_code_bukrs also added) |
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
|
用于一次性完全刷新的其他表
在适用的情况下,对以下增量表运行一次性定向全面刷新 (Run a targeted full refresh):
- 在首次运行 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 联接和可为 null 的 LEFT JOIN 唯一键缺陷中的旧版重复项:
- 客户、供应商和地址联接:
business_partner_addresses、business_partner_bank_details和下游supplier_spend_analysis(在vendors之后刷新)。 uniqueKey(ECC、S/4HANA):vendor_invoice_account_assignments和countries。- 受保护的可为 null 的
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。 - 受保护的可为 null 的
LEFT JOIN唯一键(仅限 ECC):special_stocks_with_vendor。 - 受保护的可为 null 的
LEFT JOIN唯一键(仅限 S/4HANA):financial_hierarchy_nodes和group_journal_entries(还会添加聚簇)。
行为变更和孤立对象
sales_document_flow具体化:ECC 和 S/4HANA 上的默认materializationType从incremental更改为table,以便未开单的出库交货保持可见(增加行数)。在编译之前,请移除所有过时的materializationType: incremental替换,因为在没有uniqueKeys的情况下,incremental模型会因故障关闭而导致编译失败。--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 版中移除的内容。
- 查看数据质量断言,自定义屏蔽规则和严重级别标记。