# Upgrade to version 7.1

This guide lists the version-specific changes and migration actions required
when upgrading an existing Google Cloud Cortex Framework version 7.0.x deployment
to version 7.1.0. Follow these instructions alongside the standard workflow in
[Upgrade Cortex Framework](https://docs.cloud.google.com/cortex/docs/upgrade/overview.md.txt). You
can also run the `/upgrade-cortex`
[agent skill](https://docs.cloud.google.com/cortex/docs/agentic-skills-for-data-product-building.md.txt) to inspect
and update configuration files automatically.

Python remains at `3.13` (`>=3.13,<3.14`). For deprecated items scheduled for
removal in version 8.0, see
[Cortex Framework deprecations](https://docs.cloud.google.com/cortex/docs/deprecations.md.txt#v7-1-deprecations).

Use the following table to jump to the sections that apply to your deployment:

| If your deployment uses... | Review |
|---|---|
| Any version 7.0.x setup | [Configuration and CLI changes](https://docs.cloud.google.com/cortex/docs/upgrade/v7-1.md.txt#config-and-cli-changes) |
| SAP ERP data products | [Breaking SAP column changes and full refresh](https://docs.cloud.google.com/cortex/docs/upgrade/v7-1.md.txt#sap-column-changes) and [Behavior changes and orphaned objects](https://docs.cloud.google.com/cortex/docs/upgrade/v7-1.md.txt#behavior-changes-and-orphans) |
| Custom `tableSettings` overrides | [Custom `table_settings.yaml` updates](https://docs.cloud.google.com/cortex/docs/upgrade/v7-1.md.txt#custom-table-settings) |
| Custom modules or Python builders | [Migrate custom data products and Python builders](https://docs.cloud.google.com/cortex/docs/upgrade/v7-1.md.txt#custom-extensions) |

## Configuration and CLI changes

Apply these updates during
[Step 2: Update configuration, custom settings, and extensions](https://docs.cloud.google.com/cortex/docs/upgrade/overview.md.txt#update-config-and-settings)
before building.

### Namespace discovery

- **Built-in namespaces** : Omit `path` on built-in `data.namespaces` entries (`cortex`, `cortex_samples`, `cortex_v6_compatibility`)---for example, `- name: cortex`.
- **Allowlist behavior** : `data.namespaces` is now a strict allowlist when set (`namespaces: []` enables zero namespaces, and `namespaces: null` fails validation). List every built-in and local custom namespace your enabled modules reference, or omit `data.namespaces` to auto-discover installed packages only.

### Data quality assertions

- **Enabled by default (`data.assertionsEnabled: true`)** : Set a unique `data.defaultAssertionDataset` per deployment when sharing a Google Cloud project (otherwise the default `dataform_assertions` dataset can collide across deployments), and pass `--create-datasets` to `uv run cortex-deploy` in CI/CD. To opt out, set `data.assertionsEnabled: false`.
- **Severity tags** : Configure `data.assertionSeverities` and `data.defaultAssertionSeverity` together, or omit both.

### Target and catalog settings

- **Removed `type: generic` target** : Remove `type: generic` entries or replace them with `type: git` (note that `type: git` requires a commit email using `targetSettings.authorEmail`, global `git config user.email`, or both `GIT_AUTHOR_EMAIL` and `GIT_COMMITTER_EMAIL`).
- **Whole-segment `ignoredPaths` matching** : On `type: dataform` targets, `targetSettings.ignoredPaths` (default `["definitions/custom"]`) now matches whole path segments instead of prefixes. Move unmanaged files under `definitions/custom/` or add paths such as `definitions/custom_*` to `ignoredPaths` so `uv run cortex-deploy` doesn't delete them.
- **Catalog `tableSettings` allowlist** : Update any catalog `tableSettings` file (`tables:` / `variants:`) so every required source table is listed.

### CLI changes

| Version 7.0.x | Version 7.1 |
|---|---|
| `uv run cortex-build --create-datasets` | Pass `--create-datasets` (and optional `-y` / `--yes`) to [`uv run cortex-deploy`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-deploy.md.txt) or [`uv run cortex-build-and-deploy`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-build-and-deploy.md.txt). |
| `uv run cortex-deploy --assertions` | Pass `--assertions` to [`uv run cortex-build`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-build.md.txt) or [`uv run cortex-build-and-deploy`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-build-and-deploy.md.txt). |
| `uv run cortex-kc-sync` and `--data-modules-root-directory` | Use [`uv run cortex-create-kc-data-products`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-create-kc-data-products.md.txt) and declare namespaces in `data.namespaces`. |
| `uv run cortex-demo` (SAP-only default; `snake_case` flags) | Defaults to `--sources all` (pass `--sources sap` to keep 7.0.x scope) with dash-case flags; see [`uv run cortex-demo`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-demo.md.txt). |

### Custom `table_settings.yaml` updates

Follow [Custom `table_settings.yaml` behavior across upgrades](https://docs.cloud.google.com/cortex/docs/upgrade/overview.md.txt#custom-table-settings)
and apply these version 7.1 updates:

- **Data products** : Trim copied files down to explicit overrides---especially any stale `materializationType: incremental` override on `sales_document_flow` (see [Behavior changes and orphaned objects](https://docs.cloud.google.com/cortex/docs/upgrade/v7-1.md.txt#behavior-changes-and-orphans)) and unchanged `dataformTags` (for example, `billing_document_headers` and `billing_document_items` changed from `monthly` to `hourly`).
- **Data foundations** : Diff custom SAP foundation files against version 7.1 `table_settings.default.yaml` to retain added ECC tables (`faglflext`, `glt0`) and default assertions (`makt`, `vbak`).
- **Time partitioning** : Replace deprecated `partitionType: DATE | DATETIME |
  TIMESTAMP` with `partitionType: time` and `dataType: DATE | DATETIME |
  TIMESTAMP`.

## Breaking SAP column changes and full refresh

Version 7.1 aligns SAP data product column suffixes to exact SAP Data Dictionary
(DDIC) field names and removes non-core SAP IS-Fashion (`*_fsh_*`) add-on
columns across **23 incremental SAP product tables**.

> [!CAUTION]
> **Caution:** Existing incremental tables fail with `Removing column on EXTEND is not
> allowed` until refreshed. Complete [Step 4: Run targeted full refreshes](https://docs.cloud.google.com/cortex/docs/upgrade/overview.md.txt#full-refresh) on the affected tables and update downstream SQL, LookML, BI dashboards, and agent queries before scheduled incremental runs.

### SAP column rename and removal reference

> [!WARNING]
> **Warning:** In `universal_journal_entry_line_items` (S/4HANA), `business_transaction_type_bttype` was renamed to `business_transaction_category_bttype`, and `custom_business_transaction_type_not_used_yet_cbttype` was renamed to `business_transaction_type_cbttype`. Verify filters matching the `business_transaction_type` prefix so you reference the intended field.

#### Expand to view the 23-table SAP column rename and removal map

| Data product | Table | SAP version | Version 7.0.x column | Version 7.1 column or status |
|---|---|---|---|---|
| `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 | Same 10 columns as `accounts_payable` in the preceding row | Same 10 renamed columns as `accounts_payable` in the preceding row |
| `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` | Removed (IS-Fashion add-on) |
| `billing_documents` | `billing_document_items` | ECC, S/4HANA | `season_year_fsh_season_year`, `season_fsh_season`, `collection_fsh_collection`, `theme_fsh_theme` | Removed (IS-Fashion add-on) |
| `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` through `5_suvk05` `item_customer_reserve_status1_suvs01` through `5_suvs05` | `header_customer_reserve_status1_uvk01` through `5_uvk05` `item_customer_reserve_status1_uvs01` through `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` | Removed (IS-Fashion add-on) |
| `inventory_and_special_stocks` | `special_stocks_from_vendor` | ECC | Same 5 `*_fsh_*` columns as `sales_order_stock` | Removed (IS-Fashion add-on) |
| `inventory_and_special_stocks` | `special_stocks_with_customer` | ECC | Same 5 `*_fsh_*` columns as `sales_order_stock` | Removed (IS-Fashion add-on) |
| `production_orders` | `production_order_header` | ECC, S/4HANA | `master_production_order_fsh_mprod_ord` | Removed (IS-Fashion add-on) |
| `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` | Removed (IS-Fashion add-on) |
| `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_*` columns: `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` | Removed (IS-Fashion add-on) |
| `purchasing_documents` | `purchasing_document_types` | S/4HANA | Same 9 ECC `*_fsh_*` columns plus `vas_quantity_correlation_fsh_vas_corr` and `variants_optional_fsh_vm_act` (11 total) | Removed (IS-Fashion add-on) |
| `purchasing_documents` | `purchasing_document_vendor_confirmations` | ECC, S/4HANA | `allocated_stock_quantity_fsh_salloc_qty` | Removed (IS-Fashion add-on) |
| `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) Removed (IS-Fashion add-on) |
| `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` (non-breaking `company_code_bukrs` also added) |
| `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_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` |

### Additional tables for a one-time full refresh

Run a one-time targeted full refresh
([Run a targeted full refresh](https://docs.cloud.google.com/cortex/docs/upgrade/overview.md.txt#execute-full-refresh))
on the following incremental tables when applicable:

- **Required before or on the first version 7.1 incremental run (S/4HANA)** : `material_documents` (`cortex.sap.products.materials_movement`) adds 13 `MATDOC` stock columns and expands `uniqueKey` with `material_document_record_type`.
- **Required when posting non-two-decimal currencies (`TCURX` scaling)** : `asset_annual_cumulative_balances` (S/4HANA) and `vendor_open_items`, `vendor_cleared_items`, `customer_open_items`, and `customer_cleared_items` (ECC). (`accounts_payable`, `accounts_receivable`, and `purchasing_document_headers` are already in the 23-table list above.)
- **Required if enabling the `sales_performance` SAP ERP sample** : `sales_performance` (`cortex_samples.sap.products.sales_performance`; refresh after `customers`) adds v7.1 columns such as `signed_net_value_in_document_currency` validated by the new `signed_net_value_bounds` assertion (see [Sales Performance Insights](https://docs.cloud.google.com/cortex/docs/solution-samples/sales-performance-insights.md.txt)).

#### Expand to view recommended full-refresh tables (join and unique-key cleanup)

Run a one-time full refresh on these incremental tables to purge legacy duplicates from version 7.0.x join and nullable `LEFT JOIN` unique-key defects:

- **Customer, vendor, and address joins** : `business_partner_addresses`, `business_partner_bank_details`, and downstream `supplier_spend_analysis` (refresh after `vendors`).
- **Tightened `uniqueKey` (ECC, S/4HANA)** : `vendor_invoice_account_assignments` and `countries`.
- **Guarded nullable `LEFT JOIN` unique keys (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`, and `units_of_measurement`.
- **Guarded nullable `LEFT JOIN` unique keys (ECC only)** : `special_stocks_with_vendor`.
- **Guarded nullable `LEFT JOIN` unique keys (S/4HANA only)** : `financial_hierarchy_nodes` and `group_journal_entries` (also adds clustering).

## Behavior changes and orphaned objects

- **`sales_document_flow` materialization** : Default `materializationType` changed from `incremental` to `table` on ECC and S/4HANA so unbilled outbound deliveries remain visible (increasing row counts). Remove any stale `materializationType: incremental` override before compiling, because compilation fails closed on `incremental` models without `uniqueKeys`. No `--full-refresh` is required.
- **Orphaned S/4HANA tables** : `materials_by_storage_location` moved from `cortex.sap.products.materials` to ECC-only `cortex.sap.products.inventory_and_special_stocks`. On S/4HANA, drop the legacy `PRODUCT_DATASET.materials_by_storage_location` table (and unused `mard`, `mbew`, `mbewh`, or `t001l` foundation tables when no other enabled S/4HANA product references them) after confirming no downstream consumers query them.
- **Assertions on existing data** : Default assertions can fail on pre-upgrade duplicate rows until you complete the one-time full refresh. Severity tags emit `severity_LEVEL`, while blocking behavior is set per rule (`blocking: true`).

## Migrate custom data products and Python builders

If you maintain custom modules or Python builders, apply the following updates
before building (see the
[Extensibility guide](https://docs.cloud.google.com/cortex/docs/extensibility-guide.md.txt) for full reference).

### Custom YAML and JavaScript data products

- **Use `publisher.publish()` / `publisher.operate()`** : Replace bare `publish(...)` and `operate(...)` calls with `const publisher = require("includes/publisher.js");` so blocking assertions and row-/column-level security hooks run.
- **Update `incremental.getFilter()` calls** : Pass either an options object (`{ targetColumn: "..." }` or `{ timestampColumn: "..." }`) or a known source type shorthand (`"sap"`, `"sfdc"`, or `"salesforce"`) as the third argument; other strings now throw an error.
- **Declare assertions explicitly** : Replace version 7.0.x implicit key assertions with `assertions.standardRules` in `table_settings.default.yaml` (see [Data quality assertions](https://docs.cloud.google.com/cortex/docs/data-quality-assertions.md.txt)).
- **Clean up deprecated keys and builder aliases** : Remove `type:` from `manifest.yaml` and `moduleType:` from `config/config.yaml`. Replace deprecated aliases (`generic_product`, `composite_product`, `generic_composite_product`, `sap_bdc_product` → `flat_product`; `sfdc` → `sfdc_foundation`). Note that `flat_product` defaults to `incremental` (whereas legacy `generic_product` / `composite_product` defaulted to `table`), so set `materializationType` explicitly or provide `uniqueKeys`.

### Custom Python builders

- **Import from `common.sdk`** : Replace `common.builders.*`, `common.schemas.*`, and removed `common.registry` imports with `common.sdk`.
- **Use concrete subclasses** : Subclass `FlatProductBuilder` or `FoundationBuilder` directly (not `ProductBuilder[DataProductModuleConfig]`) and accept `(self, node, ctx)` in `build()`.
- **Set `table_settings_schema = None` for programmatic builders** : Builders subclassing `FlatProductBuilder` expect a `table_settings` file by default; set `table_settings_schema = None` if your builder generates SQL without one.
- **Relocate builders** : Move deprecated blueprint-local `./builder.py` modules into `NAMESPACE/builders/` with a `plugin_id` referenced in `manifest.yaml`, and remove `__init__.py` files inside the namespace tree.

## What's next

- Follow the end-to-end checklist in [Upgrade Cortex Framework](https://docs.cloud.google.com/cortex/docs/upgrade/overview.md.txt).
- Review [Cortex Framework deprecations](https://docs.cloud.google.com/cortex/docs/deprecations.md.txt#v7-1-deprecations) for items scheduled for removal in version 8.0.
- Review [Data quality assertions](https://docs.cloud.google.com/cortex/docs/data-quality-assertions.md.txt) to customize blocking rules and severity tags.