# Deployment configuration

This page explains the deployment configuration options for
Google Cloud Cortex Framework across two configuration files:

- **[Deployment configuration (`config/config.yaml`)](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#config-config-yaml)** : Defines environment variables, build settings, dataset mappings, row- and column-level security policies, module registrations (`foundations`, `catalogs`, and `products`), deployment targets, conversational analytics data agents, and Gemini agent registration.
- **[Table settings (`table_settings.yaml`)](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#config-table-settings-yaml)**: Controls module-specific table scope, materialization strategies, partitioning, clustering, labels, tags, declarative data quality assertions, and row- and column-level security in BigQuery.

This page also includes [Examples](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#examples) and
[How-to guides](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#how-to-guides) for common customization and multi-instance
deployment scenarios.

## Configuration file: `config/config.yaml`

The `config/config.yaml` file---typically initialized from the
`config/config.yaml.example` template---is the primary workspace configuration
for a Cortex Framework deployment. Relative
`data.namespaces[].path` and `tableSettings` paths resolve relative to the
directory that contains `config/config.yaml`. Relative
`conversationalAnalytics.agents[].agentSettings` paths use a three-step
resolution order (the configuration file directory, the workspace root, and the
packaged `agents/` directory). For Git deployment targets,
`auth.credentialsPath` and `auth.sshKnownHostsPath` expand `~` and resolve
relative to the current working directory. Relative local `repositoryUrl` paths
(such as `./repo` or `../repo`) resolve relative to the current working
directory, but `repositoryUrl` doesn't expand `~` and rejects values starting
with `~`. Use `camelCase` key naming canonically across all configuration
files; schema validation rejects unknown keys in `config/config.yaml`
(including `data.security` and `gemini`) and external `agent_settings.yaml`
files. Most `config/config.yaml` blocks reject `snake_case` keys, though
`data.modules.catalogs` accepts legacy `snake_case` aliases for backward
compatibility (`catalog_id`, `project_id`, `project`, `dataset_id`,
`listing_id`, `binds_namespaces`, `connection_settings`, and
`inline_table_settings`), and `agent_settings.yaml` accepts either `camelCase`
or `snake_case` names for defined fields.

`config/config.yaml` is organized into five top-level blocks:

- **Build environment (`buildEnvironment`)** *(optional)* : Configures the Google Cloud project billed for build-time metadata queries (such as reading SAP `DD03L` or inspecting BigQuery schemas), conversational analytics data agent provisioning, and Gemini registration. You can omit this block in local build or compile-only workflows that don't inspect BigQuery schemas or provision agents.
- **Data (`data`)** : Configures BigQuery dataset locations, workspace-wide assertion settings, row- and column-level security policies, module namespaces (`cortex`, `cortex_samples`, and `cortex_v6_compatibility`), source and target dataset mappings, and active module instances (`foundations`, `catalogs`, and `products`).
- **Deployment (`deployment`)** *(optional)* : Configures one or more target deployment destinations (`type: dataform` workspaces or `type: git` repositories) where compiled Dataform artifacts are synchronized. You can omit this block in local build or compile-only workflows without deployment targets.
- **Conversational analytics (`conversationalAnalytics`)** *(optional)* : Configures [BigQuery conversational analytics data
  agents](https://docs.cloud.google.com/cortex/docs/conversational-analytics) provisioned and synchronized by [`uv run cortex-create-ca-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-create-ca-agents.md.txt).
- **Gemini (`gemini`)** *(optional)* : Configures the [Gemini](https://docs.cloud.google.com/cortex/docs/gemini.md.txt) app and published conversational analytics data agents registered by [`uv run cortex-register-gemini-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-register-gemini-agents.md.txt).

### Environment variable substitution

Before validating the YAML schema, Cortex Framework expands
`$VAR_NAME` and `${VAR_NAME}` placeholders across all string values in
`config/config.yaml` using your active shell environment:

```yaml
buildEnvironment:
  buildProjectId: "${CORTEX_BUILD_PROJECT_ID}"

data:
  datasets:
    - id: sap_raw
      projectId: "${SAP_RAW_PROJECT_ID}"
      datasetId: cortex_sap_raw
```

Keep the following rules in mind when using environment variable placeholders:

- Every referenced variable must be set in your environment before running a `uv run cortex-*` command. Unresolved placeholders fail configuration loading immediately with a validation error.
- Escape a literal dollar sign as `$$` so the preprocessor preserves `$` without attempting variable substitution.
- `${ref(...)}` tokens used in [row- and column-level security](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt#dynamic-entitlement-lookups) row filter predicates are preserved verbatim by the preprocessor for build-time Dataform reference resolution and don't need to be escaped as `$${ref(...)}`.

### Build environment

The `buildEnvironment` block specifies the Google Cloud project billed
for build-time metadata inspection jobs:

```yaml
buildEnvironment:
  buildProjectId: YOUR_BUILD_PROJECT_ID
```

Replace the following:

- `YOUR_BUILD_PROJECT_ID`: Google Cloud project ID billed for build-time BigQuery schema inspection jobs, conversational analytics data agent provisioning, and Gemini registration, for example: `my-cortex-build-project`.

The following table describes the `buildEnvironment` parameters:

| Parameter | Meaning | Default value | Description |
| `buildEnvironment.buildProjectId` | Build project ID | None | Google Cloud project ID where build-time schema inspection queries execute, conversational analytics data agents are provisioned, and Gemini apps and agents are registered. Required when `conversationalAnalytics.enabled` is `true` with enabled agents, or when `gemini.enabled` is `true`. |
| `buildEnvironment.timeout` | Timeout (seconds) | None | Optional reserved integer field accepted by the configuration schema. It has no runtime effect on client RPC timeouts. |
|---|---|---|---|

### Data section overview

The `data` section defines your BigQuery region, assertion
settings, row- and column-level security policies, module namespaces, dataset
mappings, and module instances:

```yaml
data:
  # Geographic location for BigQuery datasets (for example: US, EU, us-central1).
  bigQueryLocation: US

  # Data quality assertion settings.
  assertionsEnabled: true
  defaultAssertionDataset: "dataform_assertions"
  # assertionSeverities: ["P0", "P1", "P2"]
  # defaultAssertionSeverity: "P1"

  # Optional row- and column-level security (CLS/RLS) settings.
  # security:
  #   enabled: true
  #   autoGrantDataformServiceAccount: true
  #   policyTags: {}
  #   domainRules: []

  # Optional strict allowlist of active module namespaces.
  # Omit `namespaces` to auto-discover; omit `path` for built-in namespaces or
  # installed `cortex.namespaces` wheels.
  namespaces:
    - name: cortex
    - name: cortex_samples
    - name: cortex_v6_compatibility
    # Local custom namespace (resolved relative to config/config.yaml):
    # - name: custom_domain
    #   path: ../src/data_modules/custom_domain

  # Named BigQuery source and target dataset mappings.
  datasets:
    - ...

  # Data foundation, external catalog, and data product module instances.
  modules:
    foundations:
      - ...
    catalogs:
      - ...
    products:
      - ...
```

### Data: BigQuery location

Defines the geographic location of your BigQuery source and target
datasets. For regional availability, see
[BigQuery locations](https://docs.cloud.google.com/bigquery/docs/locations.md.txt) and
[Dataform locations](https://docs.cloud.google.com/dataform/docs/locations.md.txt).

| Parameter | Meaning | Default value | Description |
| `data.bigQueryLocation` | BigQuery location | None (for example, `US`) | Required top-level field in `DataConfig` specifying the BigQuery multi-region or region for all datasets in `data.datasets[]` (for example, `US`, `EU`, `us-central1`, or `europe-west1`). Also serves as the default provisioning location for conversational analytics data agents and Gemini apps when their respective `location` override is omitted, and determines where golden-query dry runs execute. |
|---|---|---|---|

### Data: Data quality assertions

Defines workspace-wide settings for
[declarative data quality assertions](https://docs.cloud.google.com/cortex/docs/data-quality-assertions.md.txt)
across data foundations and data products. Assertions are enabled globally by
default (`data.assertionsEnabled: true`) on tables that declare an `assertions`
block and can also be controlled per table (`assertions.enabled: false`) or per
rule (`enabled: false`) in `table_settings.yaml` or `inlineTableSettings`.

| Parameter | Meaning | Default value | Description |
| `data.assertionsEnabled` | Global assertion switch | `true` | Global kill-switch for all declarative data quality assertions across foundations and data products. Set to `false` to suppress all generated Dataform assertion views, downstream blocking dependencies, and in-transaction SAP CDC assertion checks without editing `table_settings.yaml`; build-time schema and template validation still runs against declared rules. |
| `data.defaultAssertionDataset` | Assertion views dataset | `dataform_assertions` | BigQuery dataset ID where Dataform materializes compiled assertion views in each target project. Validated and provisioned automatically when `data.assertionsEnabled` is `true` and you pass `--create-datasets` 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). Configure a unique dataset ID per deployment when multiple Cortex Framework workspaces share the same target project. |
| `data.assertionSeverities` | Allowed severity levels | None | Optional non-empty allowlist of custom severity identifiers matching `^[a-zA-Z0-9_-]+$` (for example, `[P0, P1, P2]`). Must be configured together with `data.defaultAssertionSeverity`; attaches a `severity_<value>` Dataform tag to every generated assertion. |
| `data.defaultAssertionSeverity` | Default assertion severity | None | Default severity assigned to assertion rules that omit a per-rule `severity` attribute. Required when `data.assertionSeverities` is set and must belong to that allowlist. |
|---|---|---|---|

### Data: Row- and column-level security

The optional `data.security` block configures global
[row- and column-level security](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt) (Tier 1)
and module-scoped domain rules (Tier 2) across materialized
BigQuery tables built by Dataform. It registers
logical aliases for Data Catalog policy tag URIs, manages automatic
Dataform pipeline service account bypass grants, and applies
baseline column policy tags and mandatory row filters across matching modules:

```yaml
data:
  security:
    enabled: true
    autoGrantDataformServiceAccount: true
    # Optional fallback email (bare or with "serviceAccount:" prefix) when a
    # dataform target omits serviceAccount:
    # pipelineServiceAccount: "dataform-sa@example.com"
    policyTags:
      pii_tax_id: projects/TAXONOMY_PROJECT_ID/locations/us/taxonomies/TAXONOMY_ID/policyTags/POLICY_TAG_ID
    domainRules:
      - name: sap_finance_governance
        enabled: true
        modulePaths:
          - "cortex.sap.foundations.*"
          - "cortex.sap.products.vendors"
        # moduleIds: ["erp"]
        columnTags:
          - policyTag: pii_tax_id
            allowTableOverride: false
            matchExact: ["stcd1", "stcd2"]
            matchSuffix: ["_stcd1"]
        mandatoryRowFilters:
          - name: sap_bukrs_entitlement
            allowTableOverride: false
            applyIfColumnsExist: ["bukrs"]
            defaultGrantees:
              - group:sap-finance-analysts@DOMAIN
            filterPredicate: >-
              bukrs IN (
                SELECT company_code
                FROM ${ref("security_entitlements", "user_company_codes")}
                WHERE user_email = SESSION_USER()
              )
```

Replace the following:

- `TAXONOMY_PROJECT_ID`: Google Cloud project ID hosting the Data Catalog taxonomy, for example: `my-governance-project`.
- `TAXONOMY_ID`: numeric Data Catalog taxonomy ID.
- `POLICY_TAG_ID`: numeric Data Catalog policy tag ID.
- `DOMAIN`: organization domain for your BigQuery row access policy grantee group, for example: `example.com`.

The following table describes the `data.security` parameters:

| Parameter | Meaning | Default value | Description |
| `data.security.enabled` | Global security switch | `true` | Global switch for declarative row- and column-level security. Set to `false` to skip Tier 2 domain rules and Tier 3 table security resolution workspace-wide and skip Data Catalog pre-flight checks during `cortex-deploy`, `cortex-build-and-deploy` (`type: dataform`), `cortex-demo`, and `cortex-apply-security` (`cortex-build` doesn't run Data Catalog pre-flight checks, and still rejects explicit Tier 3 `security` blocks on `view` models even when `data.security` is omitted or `enabled: false`). Running `uv run cortex-apply-security` with `enabled: false` tears down previously applied Cortex Framework column policy tags and managed row access policies in BigQuery; deleting the `data.security` block instead exits as a no-op and leaves existing tags and policies attached. |
| `data.security.autoGrantDataformServiceAccount` | Automatic pipeline bypass | `true` | When `true`, appends the reserved `cortex_pipeline_sa_bypass` row access policy (predicate `TRUE`) on tables with active row-level security so the Dataform execution service account can read upstream governed tables. Resolves the service account from `deployment.targets[].targetSettings.serviceAccount` first and falls back to `data.security.pipelineServiceAccount`. |
| `data.security.pipelineServiceAccount` | Fallback pipeline service account | None | Optional fallback service account email used for `cortex_pipeline_sa_bypass` when an enabled `type: dataform` target omits `targetSettings.serviceAccount` (for example, the default Dataform service agent `service-PROJECT_NUMBER@gcp-sa-dataform.iam.gserviceaccount.com`), or when only `type: git` targets are enabled. Accepts either a bare email or an email with a `serviceAccount:` prefix (stripped automatically, matching `targetSettings.serviceAccount`). |
| `data.security.policyTags` | Policy tag alias map | `{}` | Map of logical alias keys to full Data Catalog policy tag URIs matching `projects/<project>/locations/<location>/taxonomies/<taxonomy>/policyTags/<tag>`. Alias keys must be non-empty and can't start with `projects/`. |
| `data.security.domainRules` | Domain security rules | `[]` | Ordered list of Tier 2 domain rules scoping column policy tags and mandatory row filters to matching foundation and product modules. Every enabled domain rule, `columnTags` entry, and `mandatoryRowFilters` entry must match at least one enabled materialized table or column, or the build fails. |
| `domainRules[].name` | Domain rule name | None | Required unique identifier for the domain rule (case-insensitive across `data.security.domainRules`). |
| `domainRules[].enabled` | Domain rule switch | `true` | Specifies whether this domain rule (including both `columnTags` and `mandatoryRowFilters`) is active. Set to `false` on Day 2 to tear down column policy tags and row filters managed by this rule across matching tables (unless kept active by another rule or Tier 3 override). |
| `domainRules[].modulePaths` | Module path globs | None | Optional non-empty list of unique, case-sensitive `fnmatch` glob patterns matched against each module's `modulePath` (for example, `cortex.sap.*`). At least one of `modulePaths` or `moduleIds` is required; when both are set, they combine with logical AND. |
| `domainRules[].moduleIds` | Exact module IDs | None | Optional non-empty list of unique exact `moduleId` values (for example, `erp` or `sap_accounts_payable`). At least one of `modulePaths` or `moduleIds` is required; when both are set, they combine with logical AND. |
| `domainRules[].columnTags` | Column policy tag rules | `[]` | List of Tier 2 column-level security rules. Each entry defines a `policyTag` (alias from `data.security.policyTags` or full URI), optional `enabled` (default `true`), optional `allowTableOverride` (default `false`), and at least one selector in `matchExact` or `matchSuffix` (both enforce case-insensitive uniqueness and are matched case-insensitively). |
| `domainRules[].mandatoryRowFilters` | Mandatory row filters | `[]` | List of Tier 2 row-level security filters applied whenever all columns in `applyIfColumnsExist` (unique, case-insensitive) are present on a matching table. Each entry defines a unique `name` (can't be `cortex_pipeline_sa_bypass`), optional `enabled` (default `true`), optional `allowTableOverride` (default `false`), and---when enabled---non-empty `filterPredicate` (supporting non-self-referencing `${ref(...)}` lookup-table tokens) and `defaultGrantees`. When multiple Tier 2 filters match a table without Tier 3 `rowAccessPolicies`, their `defaultGrantees` are intersected (disjoint grantee sets fail validation with `CortexConfigError`). |
|---|---|---|---|

### Data: Cortex Framework namespaces

Namespaces map logical module prefixes in `modulePath` to built-in packages,
installed Python wheel packages (`cortex.namespaces` entry points), or local
directories containing module manifests, Dataform definitions,
annotations, and default table settings. Cortex Framework ships
three built-in namespaces:

- `cortex`: Curated Cortex Framework data foundations and source-aligned or domain data products.
- `cortex_samples`: Consumption [solution sample](https://docs.cloud.google.com/cortex/docs/solution-samples/overview.md.txt) data products, such as [Sales Performance Insights](https://docs.cloud.google.com/cortex/docs/solution-samples/sales-performance-insights.md.txt) and [Supplier Spend Analysis](https://docs.cloud.google.com/cortex/docs/solution-samples/supplier-spend-analysis.md.txt).
- `cortex_v6_compatibility`: Backward-compatible [Version 6 compatibility](https://docs.cloud.google.com/cortex/docs/v6-compatibility.md.txt) SAP reporting views.

The `data.namespaces` key is optional and controls how
Cortex Framework discovers modules:

- **Strict allowlist (when `namespaces` is present)** : Listing `data.namespaces` (including `namespaces: []`) restricts discovery strictly to the listed namespaces. Any module whose prefix isn't in the list isn't indexed.
- **Auto-discovery (when `namespaces` is omitted)** : Omitting the `data.namespaces` key automatically discovers all built-in namespaces and installed `cortex.namespaces` wheel entry points.
- **Explicit `null` rejected** : Setting `namespaces: null` (or leaving the key with all entries commented out) fails configuration validation.
- **Multi-root override stacking** : You can list the same namespace `name` more than once to patch individual shipped modules without copying the entire namespace. Entries are searched in listed order---for example, placing `- name: cortex` with `path: ../src/data_modules/cortex_override` ahead of a pathless `- name: cortex` entry replaces matching `modulePath` directories wholesale while keeping all other shipped `cortex` modules and builders available.

You can also register custom namespaces or third-party namespaces to isolate
your organization's custom modules (see
[Namespaces](https://docs.cloud.google.com/cortex/docs/extensibility-guide-namespaces.md.txt)).

The following table describes the `data.namespaces` parameters:

| Parameter | Meaning | Default value | Description |
| `data.namespaces` | Active module namespaces | Omitted (auto-discovery) | Optional. Omit this key to automatically discover all built-in namespaces and installed `cortex.namespaces` wheel packages. Setting a list (including `[]`) enforces a strict allowlist; setting `namespaces: null` (such as commenting out all list items) raises a validation error. |
| `data.namespaces[].name` | Namespace identifier | None | Required. Namespace prefix used as the first segment of `modulePath` (for example, `cortex`, `cortex_samples`, or `cortex_v6_compatibility`). Must be a valid non-keyword Python identifier and can't collide with Python standard library modules, reserved Cortex Framework packages (`common`, `tools`, `data_modules`, `dataform_includes`, `tests`), or installed third-party packages that don't advertise a matching `cortex.namespaces` entry point. |
| `data.namespaces[].path` | Namespace directory path | None | Optional. Local file system path to a custom namespace or override root directory, resolved relative to `config/config.yaml` (or absolute). **Omit `path`** for built-in namespaces (`cortex`, `cortex_samples`, `cortex_v6_compatibility`) and installed third-party or partner `cortex.namespaces` wheel packages so Python discovers them through package entry points. Setting a legacy built-in `data_modules/<namespace>` path emits a deprecation warning and falls back to the built-in namespace root on wheel installations where that local path doesn't exist; setting any other nonexistent local path fails validation. |
|---|---|---|---|

### Data: Sources and target datasets

The `data.datasets` list maps logical dataset IDs to physical Google Cloud
projects and BigQuery datasets. Foundation and product modules
reference these entries by `id` in `dataSourceId` and `dataTargetId`:

```yaml
datasets:
  - id: sap_raw
    projectId: YOUR_SOURCE_PROJECT_ID
    datasetId: cortex_sap_raw
  - id: sap_foundation
    projectId: YOUR_TARGET_PROJECT_ID
    datasetId: cortex7_sap_data_foundation
  - id: sfdc_raw
    projectId: YOUR_SOURCE_PROJECT_ID
    datasetId: cortex_sfdc_raw
  - id: sfdc_foundation
    projectId: YOUR_TARGET_PROJECT_ID
    datasetId: cortex7_sfdc_data_foundation
  - id: product_target
    projectId: YOUR_TARGET_PROJECT_ID
    datasetId: cortex7_data_products
  - id: samples_target
    projectId: YOUR_TARGET_PROJECT_ID
    datasetId: cortex7_samples
  - id: cortex_v6_compatibility_target
    projectId: YOUR_TARGET_PROJECT_ID
    datasetId: cortex_v6_compatibility
```

Replace the following:

- `YOUR_SOURCE_PROJECT_ID`: Google Cloud project ID hosting your raw replicated source datasets, for example: `my-cortex-source-project`.
- `YOUR_TARGET_PROJECT_ID`: Google Cloud project ID hosting your conformed foundation and analytical data product datasets, for example: `my-cortex-target-project`.

The following table describes the `data.datasets` parameters:

| Parameter | Meaning | Default value | Description |
| `data.datasets[].id` | Logical dataset ID | None | Required. Unique logical identifier referenced by `dataSourceId` or `dataTargetId` (for example, `sap_raw`, `sap_foundation`, or `product_target`). |
| `data.datasets[].projectId` | Project ID | None | Required. Google Cloud project ID hosting the BigQuery dataset. |
| `data.datasets[].datasetId` | BigQuery dataset ID | None | Required. Physical BigQuery dataset name. All datasets in `data.datasets[]` reside in the location specified by `data.bigQueryLocation`. |
|---|---|---|---|

### Data: Modules

The `data.modules` block registers the transformation and catalog modules that
assemble your Dataform dependency graph across the following lists:

- [`foundations`](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#data_modules_foundations) (alias `foundation` is also accepted)
- [`catalogs`](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#data_modules_catalogs)
- [`products`](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#data_modules_products) (alias `product` is also accepted)

### Data: Modules: Foundations

This section configures [data foundation](https://docs.cloud.google.com/cortex/docs/data-foundation.md.txt) modules
that conform raw replicated source tables into standardized latest-record
tables in BigQuery. If your source dataset already provides
deduplicated latest records, set `external: true` to point downstream products
directly at `dataSourceId` without building target foundation tables.

```yaml
modules:
  foundations:
    # SAP ERP foundation module instance.
    - moduleId: erp
      modulePath: cortex.sap.foundations.sap
      dataSourceId: sap_raw
      dataTargetId: sap_foundation
      moduleSettings:
        sapVersion: s4
        # Required metadata only; doesn't filter foundation or product rows.
        mandt: "100"
      enabled: true
      external: false
      # Mutually exclusive: specify either an external file path or inline overrides.
      # tableSettings: "cortex/sap/foundations/sap/table_settings.yaml"
      # inlineTableSettings:
      #   common:
      #     - source:
      #         tableName: bkpf

    # Salesforce foundation module instance.
    - moduleId: sfdc
      modulePath: cortex.sfdc.foundations.sfdc
      dataSourceId: sfdc_raw
      dataTargetId: sfdc_foundation
      enabled: true
      external: false
      # tableSettings: "cortex/sfdc/foundations/sfdc/table_settings.yaml"
```

The following table describes the `data.modules.foundations` parameters:

| Parameter | Meaning | Default value | Description |
| `moduleId` | Module identifier | None | Required. Unique identifier for the foundation module instance (for example, `erp` or `sfdc`), referenced by downstream `dependencyBindings`. |
| `modulePath` | Module path | None | Required. Namespaced dot-path to the foundation module (for example, `cortex.sap.foundations.sap` or `cortex.sfdc.foundations.sfdc`). |
| `dataSourceId` | Source dataset reference | None | Required. References the `id` in `data.datasets` containing raw inbound source tables. |
| `dataTargetId` | Target dataset reference | None | References the `id` in `data.datasets` where conformed foundation tables materialize. Required when `external` is `false`; **must be omitted** when `external` is `true` (setting both fails validation). |
| `moduleSettings.sapVersion` | SAP system version | None | Required for SAP ERP foundation modules using the `sap_foundation` builder (for example, `cortex.sap.foundations.sap`). Selects dialect-specific logic and table settings: `ecc` (SAP ECC) or `s4` (SAP S/4HANA). |
| `moduleSettings.mandt` | SAP client (Mandant) | None | Required SAP client identifier for SAP ERP foundation modules using the `sap_foundation` builder (for example, `cortex.sap.foundations.sap`). Must be a quoted string (such as `"100"`, `"200"`, or `"800"`; `cortex_v6_compatibility` models enforce a 3-character alphanumeric value matching `[0-9A-Za-z]{3}`). Forwarded to downstream modules in `includes/config.js` and consumed by [`cortex_v6_compatibility`](https://docs.cloud.google.com/cortex/docs/v6-compatibility.md.txt) views and [`uv run cortex-demo`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-demo.md.txt). Curated `cortex.sap.*` foundation and data product tables are multi-client by design and don't filter rows by `mandt`; use [`data.security` row access policies](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt) or replication filters when single-client isolation is required. |
| `enabled` | Module enablement | `true` | Specifies whether the foundation module is built and deployed. |
| `external` | External foundation | `false` | When `true`, skips generating target foundation tables and routes downstream data products directly to `dataSourceId`. |
| `tableSettings` | External table settings path | `../src/data_modules/{namespace_dir}/{system_type}/foundations/{system_sub_type}/table_settings.default.yaml` | Optional path to a custom [`table_settings.yaml`](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#config-table-settings-yaml) file, resolved relative to `config/config.yaml`. Mutually exclusive with `inlineTableSettings`. For foundation modules, a custom `tableSettings` file **replaces `table_settings.default.yaml` completely** rather than merging---copy the default file, edit entries in place, and re-diff custom copies on Cortex Framework upgrades. **Recommended custom path:** `{namespace_dir}/{system_type}/foundations/{system_sub_type}/table_settings.yaml` |
| `inlineTableSettings` | Inline table settings | None | Optional inline table settings embedded directly in `config/config.yaml`, validated against the same foundation schema as an external `table_settings.yaml` file. Mutually exclusive with `tableSettings`. |
|---|---|---|---|

### Data: Modules: Catalogs

Catalog modules let Cortex Framework reference external zero-copy
tables without physical replication. Cortex Framework supports
the following catalog types:

- `lakehouse_delta_share`: Connects to BigLake Delta Sharing catalogs and shares (such as [SAP Business Data Cloud](https://docs.cloud.google.com/cortex/docs/source-system-integration/sap-bdc.md.txt)).
- `analytics_hub`: Connects to linked BigQuery datasets subscribed through [BigQuery sharing (formerly Analytics Hub)](https://docs.cloud.google.com/cortex/docs/source-system-integration/analytics-hub.md.txt), such as Google WeatherNext forecasts, Dun \& Bradstreet commercial datasets, public or partner data exchanges, cross-organization shares, and [Salesforce Data 360](https://docs.cloud.google.com/cortex/docs/source-system-integration/salesforce-data-cloud.md.txt).

```yaml
modules:
  catalogs:
    # BigLake Delta Sharing catalog (for example, SAP Business Data Cloud).
    - id: sap_bdc_catalog
      type: lakehouse_delta_share
      bindsNamespaces: [sap_bdc]
      connectionSettings:
        catalogId: sap_bdc_catalog
        projectId: SAP_BDC_CATALOG_PROJECT_ID
        location: europe-west3
        shares:
          - shareId: customer_v1_he2_100_p8123
          - shareId: salesorder_v1_he2_100_p8124
      # Optional table filter (mutually exclusive: tableSettings or inlineTableSettings).
      # tableSettings: "sap_bdc/table_settings.yaml"
      # enabled: true

    # BigQuery Sharing (Analytics Hub) linked dataset catalog (for example, Salesforce Data 360).
    - id: sfdc_data_cloud_catalog
      type: analytics_hub
      bindsNamespaces: [sfdc_data_cloud]
      connectionSettings:
        projectId: LINKED_DATASET_PROJECT_ID
        datasetId: LINKED_DATASET_ID
        location: US
        # listingId: "projects/PROVIDER_PROJECT/locations/US/dataExchanges/EXCHANGE_ID/listings/LISTING_ID"
      inlineTableSettings:
        tables:
          - UnifiedIndividual__dlm
          - UnifiedAccount__dlm
        # Optional variant-specific table lists (for example, s4: [acdoca]):
        # variants:
        #   s4:
        #     - acdoca
      # Optional variant domain bindings (for example, {sap: s4}):
      # variants:
      #   sap: s4
      # enabled: true

    # Commercial or public BigQuery Sharing catalog (for example, Google WeatherNext).
    - id: ah_weathernext_catalog
      type: analytics_hub
      bindsNamespaces: [cortex.external.weathernext]
      connectionSettings:
        projectId: LINKED_DATASET_PROJECT_ID
        datasetId: WEATHERNEXT_DATASET_ID
        location: US
      inlineTableSettings:
        tables:
          - weathernext_3_0_0
      # Downstream product modules can bind to analytics_hub catalogs using:
      # - 1-part catalog ID: dependencyBindings: { weatherCatalog: ah_weathernext_catalog }
      # - 2-part table binding: dependencyBindings: { weatherNext: ah_weathernext_catalog.weathernext_3_0_0 }
```

Replace the following:

- `SAP_BDC_CATALOG_PROJECT_ID`: Google Cloud project ID hosting the BigLake Delta Sharing catalog, for example: `my-sap-bdc-catalog-project`.
- `LINKED_DATASET_PROJECT_ID`: Google Cloud project ID hosting the subscribed BigQuery sharing linked dataset, for example: `my-analytics-hub-project`.
- `LINKED_DATASET_ID`: BigQuery dataset ID of your subscribed Salesforce Data 360 linked dataset, for example: `sfdc_data_360_linked`.
- `WEATHERNEXT_DATASET_ID`: BigQuery dataset ID of your subscribed WeatherNext linked dataset, for example: `weathernext_linked`.

The following table describes the `data.modules.catalogs` parameters:

| Parameter | Meaning | Default value | Description |
| `id` | Catalog identifier | None | Required. Unique identifier for the external catalog module instance. |
| `type` | Catalog type | `lakehouse_delta_share` | Catalog technology type. Allowed values are `lakehouse_delta_share` and `analytics_hub`. |
| `bindsNamespaces` | Bound namespaces | `[]` | Logical namespace prefixes bound by this catalog (for example, `[sap_bdc]`, `[sfdc_data_cloud]`, or `[cortex.external.weathernext]`). |
| `variants` | Variant domain bindings | None | Optional map of variant domains to active variant values (for example, `{sap: s4}`) used when versioned downstream data products bind to this catalog without an upstream foundation supplying that variant domain. |
| `connectionSettings.projectId` | Project ID | None | Required. Google Cloud project ID hosting the Delta Sharing catalog or subscribed BigQuery sharing linked dataset. |
| `connectionSettings.location` | Location | None | Geographic location for the catalog (required for `lakehouse_delta_share`; optional for `analytics_hub`, where pre-flight validation warns if it differs from the physical BigQuery dataset location). |
| `connectionSettings.catalogId` | Physical catalog ID | None | Required for `lakehouse_delta_share`. Physical BigLake catalog ID. |
| `connectionSettings.shares` | Delta Sharing shares | `[]` | For `lakehouse_delta_share`: list of Delta Sharing shares to import, each specifying a `shareId`. |
| `connectionSettings.datasetId` | Linked dataset ID | None | Required for `analytics_hub`. BigQuery dataset ID of the subscribed linked dataset, validated during pre-flight checks for existence, link state, and regional compatibility with `data.bigQueryLocation`. |
| `connectionSettings.listingId` | Listing resource path | None | Optional for `analytics_hub`. Source listing resource path (`projects/.../locations/.../dataExchanges/.../listings/...`) used by [`uv run cortex-metadata`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-metadata.md.txt) and regional availability checks. |
| `tableSettings` | External table filter path | None | Optional for `lakehouse_delta_share`. Path to a `CatalogTableSettings` YAML file (declaring at least one table across `tables` or `variants`) resolved relative to `config/config.yaml`. Mutually exclusive with `inlineTableSettings`. |
| `inlineTableSettings` | Inline table settings | None | Required for `analytics_hub` (a `CatalogTableSettings` map declaring at least one shared table or view name across `tables` or `variants` exposed as Dataform sources); optional for `lakehouse_delta_share` (mutually exclusive with `tableSettings`). |
| `enabled` | Catalog enablement | `true` | Specifies whether the catalog is enabled. |
|---|---|---|---|

### Data: Modules: Products

[Data product](https://docs.cloud.google.com/cortex/docs/data-product.md.txt) modules define the joins, currency
conversions, and calculations that transform foundation tables, catalog sources,
or upstream data products into consumption-ready tables and views. See
`config/config.yaml.example` in the repository for the complete list of prebuilt
SAP, Salesforce, sample (`cortex_samples`), and compatibility
(`cortex_v6_compatibility`) product entries. The shipped
`cortex_v6_compatibility` modules are
`sap_cortex_v6_compatibility_accounts_payable`,
`sap_cortex_v6_compatibility_finance`,
`sap_cortex_v6_compatibility_inventory`,
`sap_cortex_v6_compatibility_master_data`,
`sap_cortex_v6_compatibility_purchasing`, and
`sap_cortex_v6_compatibility_sales`.

```yaml
modules:
  products:
    # Curated SAP source-aligned data product (cortex namespace).
    - moduleId: sap_purchasing_organizational_structure
      modulePath: cortex.sap.products.purchasing_organizational_structure
      dependencyBindings:
        sapModule: erp
      dataTargetId: product_target
      enabled: true
      syncToKc: true
      # tableSettings: "cortex/sap/products/purchasing_organizational_structure/table_settings.yaml"

    # Curated Salesforce consumption data product (cortex namespace).
    - moduleId: sfdc_opportunity_pipeline
      modulePath: cortex.sfdc.products.opportunity_pipeline
      dependencyBindings:
        sfdcAccounts: sfdc_accounts
        sfdcConfiguration: sfdc_configuration
        sfdcCurrencyAndConversion: sfdc_currency_and_conversion
        sfdcOpportunities: sfdc_opportunities
        sfdcProductsAndPricing: sfdc_products_and_pricing
      dataTargetId: product_target
      enabled: true
      syncToKc: true

    # Sample consumption data product (cortex_samples namespace).
    - moduleId: sap_sales_performance
      modulePath: cortex_samples.sap.products.sales_performance
      dependencyBindings:
        sapCustomers: sap_customers
        sapMaterials: sap_materials
        sapSalesOrganizationalStructure: sap_sales_organizational_structure
        sapSalesDocuments: sap_sales_documents
        sapDeliveryDocuments: sap_delivery_documents
      dataTargetId: samples_target
      enabled: false
      syncToKc: false

    # Version 6 compatibility data products (cortex_v6_compatibility namespace).
    # Product moduleSettings and bound foundation moduleSettings (mandt, sapVersion)
    # are serialized into compiled includes/config.js files.
    - moduleId: sap_cortex_v6_compatibility_master_data
      modulePath: cortex_v6_compatibility.sap.products.master_data
      dependencyBindings:
        sapModule: erp
      dataTargetId: cortex_v6_compatibility_target
      enabled: false
      syncToKc: false
      moduleSettings:
        targetCurrencies: ["USD", "EUR"]
        rateType: "M"
        languages: ["E", "S"]
    - moduleId: sap_cortex_v6_compatibility_finance
      modulePath: cortex_v6_compatibility.sap.products.finance
      dependencyBindings:
        sapModule: erp
        sapMasterData: sap_cortex_v6_compatibility_master_data
      dataTargetId: cortex_v6_compatibility_target
      enabled: false
      syncToKc: false
      moduleSettings:
        targetCurrencies: ["USD", "EUR"]
        rateType: "M"
        profitCenterHierarchySubclass: "A000"
        costCenterHierarchySubclass: "A000"
```

The following table describes the `data.modules.products` parameters:

| Parameter | Meaning | Default value | Description |
| `moduleId` | Module identifier | None | Required. Unique identifier for the data product module instance, referenced by downstream `dependencyBindings` and conversational analytics `dataProducts`. |
| `modulePath` | Module path | None | Required. Namespaced dot-path to the product directory (for example, `cortex.sap.products.sales_documents`, `cortex_samples.sap.products.sales_performance`, or `cortex_v6_compatibility.sap.products.finance`). |
| `dataTargetId` | Target dataset reference | None | Required. References the `id` in `data.datasets` where output tables and views materialize (such as `product_target` or `samples_target`). |
| `dataSourceId` | Optional source dataset reference | None | Optional reference to an `id` in `data.datasets` for product modules that read directly from a configured source dataset. |
| `dependencyBindings` | Upstream dependencies | `{}` | Maps logical dependency keys declared in the module's `manifest.yaml` to active `moduleId` or catalog entries (for example, `sapModule: erp` for SAP ERP and `cortex_v6_compatibility` modules, `sapMasterData: sap_cortex_v6_compatibility_master_data`, `sfdcModule: sfdc`, upstream product IDs, or `<catalog_id>.<table_name>`). For SAP ECC deployments copied from `config/config.yaml.example` (which defaults to S/4HANA), replace the default S/4HANA-only bindings on `sap_accounts_receivable_insights` (switch `sapAccountsReceivableS4` to `sapAccountsReceivableEcc`) and `sap_financial_statements` (switch `sapUniversalJournal` to `sapAccountingDocuments` and `sapGeneralLedgerItems`) as shown in the template's inline comments. |
| `moduleSettings` | Product module parameters | None | Optional map of module-level parameters validated at build time and passed to compiled Dataform models (alongside upstream foundation settings such as `mandt` and `sapVersion`). Used by [`cortex_v6_compatibility` SAP products](https://docs.cloud.google.com/cortex/docs/v6-compatibility.md.txt) to configure parameters such as `targetCurrencies`, `rateType`, `languages`, `paymentDocTypes`, `cashDiscountTransactionKey`, `parkedInvoiceStatuses`, `invoiceDocTypes`, `receivablesTargetCurrency`, `profitCenterHierarchySubclass`, and `costCenterHierarchySubclass`. |
| `enabled` | Module enablement | `true` | Specifies whether the data product module is built and deployed. |
| `syncToKc` | Knowledge Catalog sync | `true` | Controls whether the data product metadata is synchronized to [Knowledge Catalog](https://docs.cloud.google.com/cortex/docs/knowledge-catalog.md.txt). |
| `tableSettings` | External table settings path | `../src/data_modules/{namespace_dir}/.../table_settings.default.yaml` | Optional path to a sparse custom [`table_settings.yaml`](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#config-table-settings-yaml) override file, resolved relative to `config/config.yaml` and merged field-by-field onto `table_settings.default.yaml`. Mutually exclusive with `inlineTableSettings`. Declare only the tables and fields you want to override rather than copying the full default file so upstream defaults update cleanly across upgrades. **Recommended custom path:** `{namespace_dir}/{system_type}/products/{product_name}/table_settings.yaml` |
| `inlineTableSettings` | Inline table settings | None | Optional inline table settings embedded directly in `config/config.yaml`, validated against the product's table settings schema. Mutually exclusive with `tableSettings`. |
|---|---|---|---|

> [!NOTE]
> **Note:** For new analytical workloads, deploy curated `cortex.*` data products. Enable `cortex_v6_compatibility` modules (`enabled: false` by default in `config/config.yaml.example`) only when migrating existing dashboards or queries that depend on legacy PascalCase view names. When customizing `table_settings.yaml` (including declarative assertions) on `cortex_v6_compatibility` modules, key entries by the `snake_case` definition stem while keeping the `PascalCase` `tableName` override; see [Version 6 compatibility](https://docs.cloud.google.com/cortex/docs/v6-compatibility.md.txt).

### Deployment environment

Cortex Framework supports deploying compiled Dataform
packages directly to managed Dataform workspaces (`type: dataform`) or
to remote and local Git repositories (`type: git`). For workflow details and
authentication patterns, see [Deployment](https://docs.cloud.google.com/cortex/docs/deployment.md.txt).

```yaml
deployment:
  targets:
    - type: dataform
      enabled: true
      targetSettings:
        repositoryProjectId: YOUR_REPO_PROJECT_ID
        repositoryRegion: us-central1
        repositoryName: cortex-repository
        workspaceName: dev
        ignoredPaths: ["definitions/custom"]
        # serviceAccount: "dataform-sa@example.com"
    - type: git
      enabled: false
      targetSettings:
        repositoryUrl: YOUR_GIT_REPO_URL
        branch: main
        targetDir: ""
        commitMessage: "Deploy Cortex Framework artifacts {timestamp}"
        authorEmail: "deployer@example.com"
        authorName: "Cortex Deployer"
        push: true
        ignorePatterns:
          - "README.md"
          - "definitions/custom/**"
        skipPreflightChecks: false
        auth:
          credentialsEnvVar: GIT_DEPLOY_TOKEN
          strictHostKeyChecking: true
          allowSystemAuth: true
```

Replace the following:

- `YOUR_REPO_PROJECT_ID`: Google Cloud project ID hosting your Dataform repository, for example: `my-cortex-repo-project`.
- `YOUR_GIT_REPO_URL`: SSH, HTTPS, HTTP, or local (`file://` or file system path) target Git repository location, for example: `https://github.com/my-org/cortex-dataform.git`.

> [!NOTE]
> **Note:** Cortex Framework doesn't fall back to a default commit email. At deploy time, a commit email must come from `targetSettings.authorEmail`, your effective `git config user.email`, or both `GIT_AUTHOR_EMAIL` and `GIT_COMMITTER_EMAIL`. You can omit `authorEmail` and `authorName` when you rely on your own Git configuration, such as for signed commits.

The following table describes the parameters for `deployment.targets`:

| Parameter | Meaning | Default value | Description |
| `type` | Deployment target type | None | Required. Target deployer plugin: `dataform` (syncs files to a Google Cloud Dataform workspace) or `git` (commits and pushes files to a Git repository). |
| `enabled` | Target enablement | `true` | Specifies whether the deployment target runs during [`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). |
| `targetSettings.repositoryProjectId` | Repository project ID (`dataform`) | None | Required for `type: dataform`. Google Cloud project ID where the Dataform repository is managed. |
| `targetSettings.repositoryRegion` | Repository region (`dataform`) | None | Required for `type: dataform`. Google Cloud region for the Dataform repository (for example, `us-central1` or `europe-west1`). |
| `targetSettings.repositoryName` | Repository name (`dataform`) | None | Required for `type: dataform`. Name of the target Dataform repository. |
| `targetSettings.workspaceName` | Workspace name (`dataform`) | None | Required for `type: dataform`. Name of the Dataform workspace updated during deployment. |
| `targetSettings.serviceAccount` | Service account email (`dataform`) | None | Optional custom service account email configured when creating a Dataform repository. Accepts either a bare email or an email with a `serviceAccount:` prefix. Also serves as the primary service account for automatic `cortex_pipeline_sa_bypass` row access policy grants when `data.security.autoGrantDataformServiceAccount` is `true` (takes precedence over `data.security.pipelineServiceAccount`; see [Dataform pipeline service account bypass](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt#pipeline-sa-bypass)). |
| `targetSettings.ignoredPaths` | Ignored workspace paths (`dataform`) | `["definitions/custom"]` | Non-empty relative workspace paths excluded bi-directionally during Dataform workspace reconciliation: remote files and directories under `ignoredPaths` are skipped during remote traversal and never deleted, and local compiled files under `ignoredPaths` are omitted from local discovery and never uploaded or overwritten. Paths are normalized to POSIX format (stripping leading and trailing slashes) and matched strictly on path-segment boundaries (`path == p` or `path.startswith(p + "/")`), so `"definitions/custom"` matches `definitions/custom/...` without colliding with sibling folders that share a character prefix (such as `definitions/customer` or `definitions/custom_xyz`). If you register a custom namespace named `custom` under `data.namespaces` (which compiles to `definitions/custom/...`), set `ignoredPaths: []` so `uv run cortex-deploy` uploads and manages those files. The internal `.df-credentials.json` file is always excluded regardless of `ignoredPaths`. |
| `targetSettings.repositoryUrl` | Git repository URL (`git`) | None | Required for `type: git`. Target repository location using SCP-style SSH (`git@...`), `ssh://...`, `https://...`, `http://...`, `file:///...`, or a local file system path. Local file system paths must start with `/`, `./`, `../`, `file://`, or a Windows drive letter; bare relative directory names without `./` are rejected. Unsupported schemes (such as `git://`) are rejected, and any inline URL credentials are automatically redacted in logs (prefer `targetSettings.auth` for credentials). |
| `targetSettings.branch` | Target Git branch (`git`) | `main` | Branch reconciled and committed to during [Git deployment](https://docs.cloud.google.com/cortex/docs/deployment.md.txt#git-deployment). If missing on a non-empty remote, the deployer prompts for confirmation before creating it (or auto-confirms with `--yes`). |
| `targetSettings.targetDir` | Repository subdirectory (`git`) | `""` | Optional relative subdirectory inside the Git repository where compiled artifacts are reconciled (leading slashes, `..` traversal, and `.git` paths are rejected). Sibling directories outside `targetDir` remain untouched. |
| `targetSettings.commitMessage` | Git commit message (`git`) | `"Deploy Cortex Framework artifacts {timestamp}"` | Commit message template; `{timestamp}` expands to the runtime UTC timestamp (`YYYY-MM-DD HH:MM:SS UTC`). |
| `targetSettings.authorEmail` | Git commit email (`git`) | None | Optional in `config/config.yaml`, but a commit author and committer email is required at deploy time because Cortex Framework doesn't fall back to a hardcoded default email. Provide an email through `targetSettings.authorEmail`, your effective `git config user.email` (conditional `includeIf` rules are verified after the staging repository is cloned), or both `GIT_AUTHOR_EMAIL` and `GIT_COMMITTER_EMAIL` environment variables. When set, `authorEmail` overrides both `user.email` and the `GIT_AUTHOR_EMAIL` and `GIT_COMMITTER_EMAIL` environment variables for the commit. Whitespace-only values normalize to `None`. Values must use `<local>@<domain>` syntax without whitespace, angle brackets (`<`, `>`), control characters, multiple `@` signs, or a leading `-`. Omit this parameter to use your own Git configuration, such as for signed commits. |
| `targetSettings.authorName` | Git commit display name (`git`) | None | Optional Git author and committer display name for the commit. When set, overrides both `user.name` and the `GIT_AUTHOR_NAME` and `GIT_COMMITTER_NAME` environment variables. When omitted or whitespace-only (normalized to `None`), Git uses your configured `user.name` or `GIT_AUTHOR_NAME` and `GIT_COMMITTER_NAME` environment variables; if `git config user.name` isn't set, the deployer passes `-c user.name="Cortex Deployer"` as a fallback (which those environment variables still override). Must not contain angle brackets (`<`, `>`) or control characters. Omit this parameter to use your own Git configuration, such as for signed commits. |
| `targetSettings.push` | Push commit to remote (`git`) | `true` | When `true`, pushes the commit to `origin` (fast-forward only; force pushes are disabled); set to `false` to validate reconciliation and commit locally without pushing. |
| `targetSettings.ignorePatterns` | Protected Git globs (`git`) | `[]` | `fnmatch` glob patterns relative to `targetDir` that protect existing repository files and directories from overwrite or deletion during reconciliation (`.git` is always protected). |
| `targetSettings.skipPreflightChecks` | Skip remote preflight check (`git`) | `false` | Skips the `git ls-remote` remote connectivity and branch check before cloning. |
| `targetSettings.auth.credentialsEnvVar` | Credentials environment variable (`git`) | None | Name of an environment variable holding SSH private key content or an HTTPS credential (`username:token` or raw personal access token). Mutually exclusive with `auth.credentialsPath`. |
| `targetSettings.auth.credentialsPath` | Credentials path (`git`) | None | File system path to a readable, non-empty SSH private key file or HTTPS token file. Mutually exclusive with `auth.credentialsEnvVar`. |
| `targetSettings.auth.strictHostKeyChecking` | Strict SSH host key verification (`git`) | `true` | When `true`, the deployer uses OpenSSH default host key checking with `BatchMode=yes` for SSH remotes instead of explicitly passing `StrictHostKeyChecking=yes`. When `false`, the deployer disables host key checking by passing `StrictHostKeyChecking=no` and `UserKnownHostsFile=/dev/null`. |
| `targetSettings.auth.sshKnownHostsPath` | Custom SSH `known_hosts` path (`git`) | None | Optional path to a custom SSH `known_hosts` file for enterprise Git hosts. The deployer uses this file only when `auth.strictHostKeyChecking` is `true` and ignores it when `auth.strictHostKeyChecking` is `false`. |
| `targetSettings.auth.allowSystemAuth` | Allow ambient Git or SSH credentials (`git`) | `true` | Allows falling back to system Git credential helpers or `ssh-agent` when explicit `auth` credentials are omitted. Set to `false` in shared CI runners to require explicit credentials. |
|---|---|---|---|

### Conversational analytics (`conversationalAnalytics`)

The optional top-level `conversationalAnalytics` block configures
[BigQuery conversational analytics data
agents](https://docs.cloud.google.com/cortex/docs/conversational-analytics) provisioned and synchronized by
[`uv run cortex-create-ca-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-create-ca-agents.md.txt)
after your Dataform pipelines materialize target tables in
BigQuery. `DataAgent` resources are created in
`buildEnvironment.buildProjectId` in `conversationalAnalytics.location` (or the
normalized lowercase region from `data.bigQueryLocation` when `location` is
omitted). Set `location: global` to make agents appear in the
BigQuery Agents Hub UI.

```yaml
conversationalAnalytics:
  enabled: true
  location: global # Optional: defaults to lowercased data.bigQueryLocation; use global for BigQuery Agents Hub UI.
  agents:
    # Option 1: Modular agent referencing an external agent_settings.yaml file
    # (resolved relative to config/, workspace root, or packaged src/agents/).
    - agentId: cortex-sap-financial-analysis-agent
      # displayName: "Financial Analysis Agent"
      enabled: true
      contextVersion: published
      agentSettings: ../src/agents/cortex/sap/financial_analysis/agent_settings.yaml

    # Option 2: Self-contained inline agent configuration.
    - agentId: sfdc-opportunity-pipeline-agent
      displayName: "Salesforce Opportunity Pipeline Agent"
      enabled: true
      contextVersion: published
      inlineAgentSettings:
        description: "Answers pipeline and win-rate questions on Salesforce opportunities."
        labels:
          domain: "sales"
          source: "sfdc"
        dataProducts:
          - id: sfdc_opportunity_pipeline
            includeTables:
              - opportunity_pipeline
              - opportunity_pipeline_overview
        inlineSystemInstruction: |
          You are a sales operations analyst assistant. Base pipeline metrics
          on open, non-deleted opportunities unless asked otherwise.
        goldenQueries:
          - question: "What is the open pipeline amount by stage?"
            inlineSql: |
              SELECT
                opportunity_stage_name,
                SUM(total_sale_amount_corporate_currency) AS open_pipeline_amount
              FROM `{sfdc_opportunity_pipeline.project_id}.{sfdc_opportunity_pipeline.dataset_id}.opportunity_pipeline`
              WHERE NOT COALESCE(is_opportunity_closed, FALSE)
                AND NOT COALESCE(is_deleted, FALSE)
              GROUP BY 1
              ORDER BY open_pipeline_amount DESC
        options:
          enablePythonAnalysis: false
          maxBilledBytes: 10737418240
```

The following table describes the `conversationalAnalytics` parameters in
`config/config.yaml`:

| Parameter | Meaning | Default value | Description |
| `conversationalAnalytics.enabled` | Global enablement | `true` | Specifies whether conversational analytics synchronization runs when you invoke [`uv run cortex-create-ca-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-create-ca-agents.md.txt). Requires `buildEnvironment.buildProjectId` when `true` with enabled agents. |
| `conversationalAnalytics.location` | Agent provisioning location | Lowercased `data.bigQueryLocation` | Optional Google Cloud location override for conversational analytics `DataAgent` resources (for example, `global`, `us`, `eu`, `us-east4`, or `europe-west2`; normalized to lowercase). Use `global` to display agents in the BigQuery Agents Hub UI. Golden-query dry runs still execute in `data.bigQueryLocation`. |
| `agents[].agentId` | Agent resource ID | None | Required. Unique Google Cloud `DataAgent` resource ID (1 to 63 lowercase letters, digits, or hyphens, starting with a letter and not ending with a hyphen). |
| `agents[].displayName` | Display name override | None | Human-readable name (1 to 256 characters) shown in BigQuery Studio. Required if `displayName` isn't set inside `agentSettings` or `inlineAgentSettings`. |
| `agents[].enabled` | Agent enablement | `true` | Specifies whether this agent entry is reconciled during synchronization. |
| `agents[].contextVersion` | Context slot | `published` | Target context slot on the `DataAgent` resource. Allowed values are `published` and `staging`. |
| `agents[].agentSettings` | External settings path | None | Path to an external YAML settings file, resolved in order: (1) relative to `config/config.yaml`, (2) relative to the workspace/repository root, and (3) from the packaged `src/agents/` directory inside an installed `cortex` wheel when the relative path contains an `agents` segment. Mutually exclusive with `inlineAgentSettings`. |
| `agents[].inlineAgentSettings` | Inline settings map | None | Inline agent context definition following the same schema as an external `agent_settings.yaml` file. Mutually exclusive with `agentSettings`. |
|---|---|---|---|

The following table describes the fields supported inside an external
`agent_settings.yaml` file or an `inlineAgentSettings` block:

| Parameter | Meaning | Default value | Description |
| `displayName` | Default display name | None | Optional default display name (1 to 256 characters), overridden when `agents[].displayName` is set. |
| `description` | Agent description | None | Required summary description of the agent's purpose and domain (1 to 1,024 characters). |
| `labels` | Resource labels | `{}` | Optional map of up to 63 user-defined lowercase Google Cloud labels out of the 64-label `DataAgent` resource limit. Keys must match `^[a-z][a-z0-9_-]{0,62}$` and values must match `^[a-z0-9_-]{0,63}$`. Cortex Framework reserves one slot for the managed `cortex-framework-version` label. |
| `dataProducts` | Referenced data products | None | Required non-empty list of enabled product modules (knowledge sources) with `id` matching `moduleId` or module name in `data.modules.products`, plus an optional non-empty `includeTables` subset of enabled module tables. |
| `systemInstruction` / `inlineSystemInstruction` | System prompt | None | Mutually exclusive path to an external Markdown or text file (resolved relative to `agent_settings.yaml`) or inline instruction string guiding SQL generation and domain rules. |
| `schemaRelationships` | Join relationships | `[]` | Optional explicit join definitions pairing `leftTable` and `rightTable` (`dataProduct`, `table`, `columns`) with an optional `confidenceScore` (`0.0` to `1.0`, default `1.0`). |
| `glossaryTerms` | Business glossary | `[]` | Optional list of domain terms (`displayName`, `description`, and optional `labels`). |
| `goldenQueries` | Verified queries | `[]` | Optional list of natural-language `question` entries paired with `sql` (external path) or `inlineSql`---supporting `{<product>.project_id}`, `{<product>.dataset_id}`, and camelCase aliases `{<product>.projectId}` and `{<product>.datasetId}`---and optional `parameters` (`name`, `dataType`, `description`). Validated with zero-cost BigQuery dry runs. |
| `options.enablePythonAnalysis` | Python code interpreter | `false` | Enables or disables Python analysis execution inside the data agent. |
| `options.maxBilledBytes` | Maximum billed bytes | `10737418240` | Per-query BigQuery maximum bytes billed guardrail (10 GiB by default, up to 500 GB; set to `null` to omit). |
|---|---|---|---|

### Gemini (`gemini`)

The optional top-level `gemini` block registers published
conversational analytics data agents inside a Gemini app
(Discovery Engine engine) using
[`uv run cortex-register-gemini-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-register-gemini-agents.md.txt).
You can also pass `--create-app` to create or update the app on demand before
registering agents. For prerequisites and end-to-end steps, see
[Gemini integration](https://docs.cloud.google.com/cortex/docs/gemini.md.txt).

```yaml
gemini:
  enabled: true
  app:
    appId: cortex-gemini-assistant
    displayName: "Cortex Gemini Assistant" # Required with --create-app
    location: global # Optional: defaults to lowercased data.bigQueryLocation
    companyName: "Example Corp"
  agents:
    - agentId: cortex-sap-financial-analysis-agent
      # displayName: "Financial Analysis Agent" # Optional override
      enabled: true
    - agentId: sfdc-opportunity-pipeline-agent
      enabled: true
```

The following table describes the `gemini` parameters in
`config/config.yaml`:

| Parameter | Meaning | Default value | Description |
| `gemini.enabled` | Global enablement | `true` | Specifies whether [`uv run cortex-register-gemini-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-register-gemini-agents.md.txt) runs. Requires `buildEnvironment.buildProjectId` when `true`. |
| `gemini.app.appId` | App resource ID | None | Required. Unique Discovery Engine engine ID (1 to 63 lowercase letters, digits, hyphens, or underscores, starting with a lowercase letter or digit and not ending with a hyphen). |
| `gemini.app.displayName` | App display name | None | Human-readable app name (1 to 256 characters). Required when creating or updating the app with `--create-app`; optional when registering agents into an existing app. |
| `gemini.app.location` | App location | Lowercased `data.bigQueryLocation` | Optional Discovery Engine location override (for example, `global`, `us`, or `eu`; normalized to lowercase). Must be a location supported by `discoveryengine.googleapis.com`. |
| `gemini.app.companyName` | Company name | None | Optional organization name stored on the app when using `--create-app`. If omitted on subsequent runs, preserves the existing server-side value. |
| `gemini.agents[].agentId` | Registered agent ID | None | Required. Unique ID (same format as `conversationalAnalytics.agents[].agentId`) matching an enabled agent in `conversationalAnalytics.agents`. |
| `gemini.agents[].displayName` | Agent display name override | None | Optional display name (1 to 256 characters) shown in Gemini. Defaults to the referenced conversational analytics agent's `displayName`. |
| `gemini.agents[].enabled` | Agent registration switch | `true` | Specifies whether this agent is registered when you run `uv run cortex-register-gemini-agents`. |
|---|---|---|---|

> [!NOTE]
> **Note:** Configuration validation enforces cross-references whenever `gemini.enabled` is `true`: `buildEnvironment.buildProjectId` must be set, `conversationalAnalytics.enabled` must be `true` when any `gemini.agents` entry is enabled, and each enabled `gemini.agents[].agentId` must match a unique, enabled entry in `conversationalAnalytics.agents` configured with `contextVersion: published`.

*** ** * ** ***

## Configuration file: `table_settings.yaml`

Module-level `table_settings.yaml` files (or `inlineTableSettings` blocks inside
`config/config.yaml`) control how raw source tables are conformed and how
analytical data models are materialized in BigQuery. You use table
settings to configure enablement, materialization types, Dataform
tags, BigQuery labels, clustering, partitioning, custom filter
thresholds, declarative data quality assertions, and row- and column-level
security.

Nested configuration blocks---including foundation `target`, `partitionDetails`,
`clusterDetails`, `bigQueryLabels`, `assertions`, `security`, and
`CatalogTableSettings`---reject unknown keys. Data product table entries
(`ProductTableItem`) accept custom extra keys except disallowed keys such as
`removeIsDeleted` or `remove_is_deleted` (on Salesforce products) and misplaced
or misspelled `security` keys.

### Dynamic dependency resolution

By default, Cortex Framework optimizes deployment footprint and
execution time by compiling and deploying only the foundation tables required by
your enabled data products. If a table configured in a foundation
`table_settings.yaml` doesn't have any active downstream data product depending
on it, the builder omits that table from deployment.

To override this optimization and always deploy a foundation table, set
`deployAlways: true` on the entry (see the
[SAP ERP](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#data-foundation-style-sap-erp) and
[Salesforce](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#data-foundation-style-sfdc) parameter references).

### Configuration paths and inline overrides

Each foundation or product module resolves table settings using one of three
mutually exclusive mechanisms:

- **External custom file (`tableSettings`, recommended)** : Copy the module's `table_settings.default.yaml` into your `config/` directory, customize it, and set `tableSettings` in `config/config.yaml` to the path **relative to
  `config/config.yaml`** :
  - **Foundation modules** : `cortex/sap/foundations/sap/table_settings.yaml` (stored on disk at `config/cortex/sap/foundations/sap/table_settings.yaml`) or `cortex/sfdc/foundations/sfdc/table_settings.yaml`.
  - **Product modules** : `cortex/sap/products/accounting_documents/table_settings.yaml` or `cortex/sfdc/products/opportunities/table_settings.yaml`.
- **Inline configuration (`inlineTableSettings`)** : Embed table settings directly on the module entry in `config/config.yaml` for compact overrides without maintaining a separate YAML file. You can't set both `tableSettings` and `inlineTableSettings` on the same module.
- **Default module fallback** : When neither `tableSettings` nor `inlineTableSettings` is specified, Cortex Framework loads `table_settings.default.yaml` from the module's physical directory under the registered namespace (for example, `../src/data_modules/cortex/sap/foundations/sap/table_settings.default.yaml`).

> [!IMPORTANT]
> **Important:** `tableSettings` and `inlineTableSettings` behave differently for data foundation modules versus data product modules:

- **Data foundation modules (`foundations`)** : Specifying `tableSettings` or `inlineTableSettings` **replaces** `table_settings.default.yaml` wholesale for that module instance rather than merging with it. When customizing a shared foundation module (such as `erp` or `sfdc`), keep all foundation tables required by your enabled downstream data products in your custom settings, or isolate custom tables in a [separate foundation instance](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#multiple-data-foundation-instances).
- **Data product modules (`products`)** : Specifying `tableSettings` or `inlineTableSettings` **merges** your explicit per-table field overrides on top of the module's `table_settings.default.yaml`. You only need to list the tables and fields you want to customize (for example, changing `materializationType`, `partitionDetails`, `filters`, or `assertions` on a single table leaves all other default tables and fields intact).

*** ** * ** ***

### Configuration styles

`table_settings.yaml` uses two schema styles depending on the module category:

- **Data foundation style** : List-based mapping that defines source-to-target table relationships, change data capture (CDC) handling, and BigQuery storage layout:
  - **SAP ERP (`cortex.sap.foundations.sap`)** : Groups table lists under versioned root keys (`ecc`, `s4`, and `common`).
  - **Salesforce (`cortex.sfdc.foundations.sfdc`)** : Uses a flat root-level YAML list (`SfdcFoundationTableSettings`) without versioned root keys.
- **Data product style** : Map-based dictionary that defines how analytical tables or views materialize (`incremental`, `table`, or `view`) and optimize storage:
  - **Versioned products (`VersionedProductTableSettings` /
    `SapProductTableSettings`)** : Groups asset maps under `common` and variant-specific root keys---for SAP ERP (`SapProductTableSettings`), `ecc` applies to SAP ECC, `s4` applies to SAP S/4HANA, and `common` applies to both dialects.
  - **Flat products (`FlatProductTableSettings` and
    `SfdcProductTableSettings`)** : Maps each target asset name directly at the root of the YAML file without `ecc`, `s4`, or `common` wrappers. This format applies to `flat_product` modules (such as SAP BDC and custom products) and `sfdc_product` modules; `sap_bdc_product` and `generic_product` are deprecated legacy aliases of `flat_product` (see [Deprecations](https://docs.cloud.google.com/cortex/docs/deprecations.md.txt#v7-1-deprecations)).

*** ** * ** ***

### Data foundation style for SAP ERP

In an SAP ERP foundation module (`cortex.sap.foundations.sap`),
`table_settings.yaml` organizes list entries under `ecc`, `s4`, and `common`.
Each item maps a raw source table to a conformed target table and configures
its BigQuery layout.

#### YAML syntax example

```yaml
common:
  - source:
      tableName: raw_custom_bkpf
      sapTableName: bkpf
      isCdc: true
    target:
      tableName: bkpf # Optional: defaults to source.sapTableName (or source.tableName)
      bigQueryLabels:
        - key: data_class
          value: transactional
        - key: line_of_business
          value: finance
      dataformTags: [sap, common, finance, hourly]
      clusterDetails:
        columns: [bukrs, gjahr]
      partitionDetails:
        column: budat
        partitionType: time
        dataType: DATE
        timeGrain: day
    deployAlways: false
```

#### Parameter reference

| Parameter | Type | Required | Default / Example | Description |
| `ecc` \| `s4` \| `common` | `array[object]` | No | `[]` | Lists of foundation table entries scoped to SAP ECC (`ecc`), SAP S/4HANA (`s4`), or both dialects (`common`). |
| `[].source` | `object` | Yes | None | Describes the raw inbound table in `dataSourceId` (for example, `sap_raw`). See [Source settings](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#source_settings). |
| `[].target` | `object` | No | `{}` | Describes the conformed target table in `dataTargetId` (for example, `sap_foundation`). If omitted, target defaults derive from `source`. See [Target settings](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#target_settings). |
| `[].deployAlways` | `boolean` | No | `false` | When `true`, always builds and deploys the foundation table even if no enabled data product depends on it. See [Dynamic dependency resolution](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#dynamic-dependency-resolution). |
| `[].assertions` | `map` | No | None | Optional declarative data quality assertions (`standardRules` and `customRules`) evaluated against the conformed foundation table. Also accepted under `target.assertions`; don't specify both on the same entry (if both are set, `target.assertions` takes precedence). See [Data quality assertions](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-assertions). |
|---|---|---|---|---|

##### Source settings

Defines the raw inbound SAP table characteristics:

| Parameter | Type | Required | Default / Example | Description |
| `tableName` | `string` | **Yes** | None | Physical name of the raw source table in BigQuery (case-insensitive) as replicated from SAP. |
| `sapTableName` | `string` | No | Same as `tableName` | Canonical SAP dictionary table name (case-insensitive) used for `DD03L` metadata lookup and default target table naming when `source.tableName` has a connector prefix. |
| `isCdc` | `boolean` | No | `true` | Controls CDC reconstruction versus full-snapshot processing: - `true` (default): Reconstructs latest records from CDC logs using record timestamps (`recordstamp`) and operation flags. - `false`: Rebuilds the conformed table as a full snapshot on each run. |
| `keys` | `array[string]` | No | None | Optional primary-key column list overriding SAP `DD03L` key discovery when reconstructing CDC records or generating `unique_key` assertions (for example, on custom raw views without dictionary key entries). |
|---|---|---|---|---|

##### Target settings

Defines the output conformed table layout in the target dataset:

| Parameter | Type | Required | Default / Example | Description |
| `tableName` | `string` | No | Same as `source.sapTableName` or `source.tableName` | Name of the conformed foundation table created in `dataTargetId`. Defaults to `source.sapTableName` when set, or `source.tableName` otherwise. |
| `dataformTags` | `array[string]` | No | `[]` (for example, `[sap, finance]`) | Arbitrary metadata tags attached to the Dataform action for selective pipeline runs (such as `dataform run --tags ...`). |
| `bigQueryLabels` | `array[map]` | No | `[]` | List of `key` and `value` pairs applied as BigQuery labels on the target table (for example, `key: data_class`, `value: transactional`). Keys must match `^[a-z][a-z0-9_-]{0,62}$` and values must match `^[a-z0-9_-]{0,63}$`; uppercase letters, invalid characters, or values longer than 63 characters fail schema validation. Deterministic lowercasing and 54-character prefix plus `_` and 8-character SHA-256 hex digest truncation apply only to framework-generated module labels. |
| `clusterDetails` | `map` | No | None | Optional BigQuery clustering configuration. See [Clustering details](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#clustering-details). |
| `partitionDetails` | `map` | No | None | Optional BigQuery partitioning configuration. See [Partitioning details](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#partitioning-details). |
| `assertions` | `map` | No | None | Optional declarative data quality assertions nested under `target` (recommended over entry-level `[].assertions`; don't specify both on the same entry---if both are set, `target.assertions` takes precedence). See [Data quality assertions](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-assertions). |
| `security` | `map` | No | None | Optional table-level column policy tags and row access policies (`TableSecurityConfig`). Must be nested under `target.security`; placing `security` (or child keys such as `columnTags` or `rowAccessPolicies`) at the table entry root or under `source` fails validation. See [Row- and column-level security](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-security). |
|---|---|---|---|---|

*** ** * ** ***

### Data foundation style for Salesforce

In a Salesforce data foundation module (`cortex.sfdc.foundations.sfdc`),
`table_settings.yaml` is structured as a flat root-level YAML list
(`SfdcFoundationTableSettings`). Each list entry maps a `PascalCase` raw
Salesforce SObject table to a `snake_case` conformed table in
BigQuery.

#### YAML syntax example

```yaml
- source:
    tableName: Account
    isCdc: true
    keys:
      - Id
  target:
    tableName: account # Optional: defaults to snake_case of sfdcTableName or tableName
    bigQueryLabels:
      - key: data_class
        value: master_data
      - key: line_of_business
        value: sales
    dataformTags: [salesforce, sales, sales_cloud, foundation, masterdata, daily]
    clusterDetails:
      columns: [Id, AccountNumber]
  deployAlways: false

- source:
    tableName: CurrencyType
    isCdc: false
  target:
    tableName: currency_type
    dataformTags: [salesforce, sales, sales_cloud, foundation, masterdata, daily]
    clusterDetails:
      columns: [Id, IsoCode]
```

#### Parameter reference

| Parameter | Type | Required | Default / Example | Description |
| `[].source` | `object` | Yes | None | Describes the replicated SObject table in the raw Salesforce BigQuery dataset (for example, `sfdc_raw`). |
| `[].target` | `object` | No | `{}` | Describes the conformed target table in the Salesforce foundation dataset (for example, `sfdc_foundation`). |
| `[].assertions` | `map` | No | None | Optional declarative Dataform assertion overrides (also accepted under `target.assertions`; don't specify both on the same entry---if both are set, `target.assertions` takes precedence). |
| `[].deployAlways` | `boolean` | No | `false` | When `true`, deploys and builds the foundation table even when no enabled data product depends on it. |
|---|---|---|---|---|

##### Source settings

| Parameter | Type | Required | Default / Example | Description |
| `tableName` | `string` | **Yes** | None (for example, `Account`) | Physical name of the raw Salesforce table in BigQuery as created by BigQuery Data Transfer Service or your replication connector. |
| `sfdcTableName` | `string` | No | Same as `tableName` | Canonical Salesforce SObject API name (such as `OpportunityLineItem`) when the raw BigQuery table uses a custom prefix or alias. Used for annotation lookup and default target naming. |
| `keys` | `array[string]` | No | `['Id']` | Primary-key columns on the raw SObject table used for deduplication and uniqueness assertions. |
| `isCdc` | `boolean` | No | `true` | Controls incremental versus full-refresh processing: - `true` (default): Builds an incremental merge model using the highest-priority audit timestamp available on the raw table (`SystemModstamp`, `LastModifiedDate`, or `CreatedDate`) with a 10-minute lookback window. - `false`: Rebuilds the conformed table as a full snapshot on each run (used for low-volume reference objects such as `CurrencyType`, `Organization`, and `RecordType`, or objects without incremental watermark columns). |
|---|---|---|---|---|

##### Target settings

| Parameter | Type | Required | Default / Example | Description |
| `tableName` | `string` | No | `snake_case` of source | Name of the conformed foundation table in BigQuery. When omitted, Cortex Framework converts `sfdcTableName` (or `source.tableName`) from `PascalCase` to `snake_case` (for example, `OpportunityHistory` becomes `opportunity_history`). |
| `dataformTags` | `array[string]` | No | `["sfdc", "foundation"]` (for example, `[salesforce, foundation, daily]`) | Metadata tags attached to the Dataform action for selective tag-based execution. Defaults to `["sfdc", "foundation"]` when omitted or empty. |
| `bigQueryLabels` | `array[map]` | No | `[]` | Key-value pairs applied as BigQuery table labels. Keys must match `^[a-z][a-z0-9_-]{0,62}$` and values must match `^[a-z0-9_-]{0,63}$`; uppercase letters, invalid characters, or values longer than 63 characters fail schema validation. Deterministic lowercasing and 54-character prefix plus `_` and 8-character SHA-256 hex digest truncation apply only to framework-generated module labels. |
| `clusterDetails` | `map` | No | None | Optional BigQuery clustering configuration using `PascalCase` Salesforce column names (such as `Id`). See [Clustering details](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#clustering-details). |
| `partitionDetails` | `map` | No | None | Optional BigQuery partitioning configuration using `PascalCase` Salesforce column names (such as `SystemModstamp` or `CreatedDate`). See [Partitioning details](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#partitioning-details). |
| `assertions` | `map` | No | None | Optional declarative data quality assertions nested under `target` (recommended over entry-level `[].assertions`; don't specify both on the same entry---if both are set, `target.assertions` takes precedence). See [Data quality assertions](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-assertions). |
| `security` | `map` | No | None | Optional table-level column policy tags and row access policies (`TableSecurityConfig`). Must be nested under `target.security`; placing `security` (or child keys such as `columnTags` or `rowAccessPolicies`) at the table entry root or under `source` fails validation. See [Row- and column-level security](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-security). |
|---|---|---|---|---|

> [!NOTE]
> **Note:** Conformed Salesforce foundation tables retain soft-deleted records in place with `IsDeleted = TRUE` (exposed as `is_deleted = TRUE` in source-aligned data products). Adding `removeIsDeleted` or `remove_is_deleted` to foundation or product `table_settings.yaml` fails schema validation. Prebuilt consumption overview tables exclude rows where `is_deleted = TRUE` automatically, and custom queries can filter soft-deleted records with `WHERE NOT is_deleted`.

Custom Salesforce fields (`*__c`) on configured SObjects require no column list
in `table_settings.yaml`: `uv run cortex-build` inspects raw
BigQuery table schemas and projects all standard and `*__c`
columns automatically (with `onSchemaChange: "EXTEND"` when `isCdc: true`).
`table_settings.yaml` configures only BigQuery physical layout,
tags, labels, scalar or list `filters`, `assertions`, and `security`---not column
selection, custom SObject join lists, or dynamic SQL logic. To onboard a custom
Salesforce SObject table (for example, `My_Custom_Object__c`, which conforms to
`my_custom_object__c` unless `target.tableName` is set), add an entry to the
root YAML list with `deployAlways: true` (or isolate custom SObjects in a
[separate foundation instance](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#multiple-data-foundation-instances)), and
project custom `*__c` fields or custom SObject joins (such as polymorphic
`WhatId` targets beyond the `'CustomObject'` prefix classification in
`activities`) in a custom or extended data product SQL definition.

*** ** * ** ***

### Data product style

In a data product module, `table_settings.yaml` maps each target analytical
table or view key (matching the definition file stem, case-insensitive) to a
`ProductTableItem` configuration block that controls materialization,
enablement, published table name, tags, labels, filters, assertions, security,
and storage layout:

- **Versioned products (`VersionedProductTableSettings` /
  `SapProductTableSettings`)** : Nest target asset maps under `common` and variant-specific root keys (`ecc` and `s4` for SAP ERP products using `SapProductTableSettings`).
- **Flat products (`FlatProductTableSettings` and
  `SfdcProductTableSettings`)** : Place target asset maps directly at the root of the file for `flat_product` modules (such as SAP BDC and custom products) and `sfdc_product` modules (`sap_bdc_product` and `generic_product` are deprecated legacy aliases of `flat_product`). Including version section wrappers (such as `common`, `ecc`, or `s4`) in flat product settings raises a validation error during `uv run cortex-build`.

#### YAML syntax example (SAP ERP)

```yaml
common:
  currency_conversion:
    materializationType: table
    bigQueryLabels:
      - key: data_class
        value: transactional
      - key: line_of_business
        value: finance
    dataformTags: [sap, dataproduct, common]
    enabled: true
    retentionDays: 365 # Custom parameter passed to Dataform context
s4:
  customers:
    materializationType: incremental
    bigQueryLabels:
      - key: data_class
        value: master
    dataformTags: [sap, dataproduct, masterdata]
    enabled: true
    clusterDetails:
      columns: [mandt, ktokd]
    partitionDetails:
      column: erdat
      partitionType: time
      dataType: DATE
      timeGrain: day
```

#### YAML syntax example (Salesforce)

```yaml
opportunity_pipeline:
  enabled: true
  materializationType: incremental
  partitionDetails:
    column: opportunity_created_date
    partitionType: time
    dataType: DATE
    timeGrain: MONTH
  clusterDetails:
    columns: [is_opportunity_closed, forecast_category_name, opportunity_owner_id]
  bigQueryLabels:
    - key: line_of_business
      value: sales
    - key: data_class
      value: reporting
  dataformTags: [salesforce, sales, sales_cloud, consumption_product, reporting, daily]
  filters:
    decision_maker_roles:
      - Decision Maker
      - Economic Buyer
      - Executive Sponsor
      - Economic Decision Maker
    single_threaded_contact_threshold: 1
    stalled_opportunity_days_threshold: 14

opportunity_pipeline_overview:
  enabled: true
  materializationType: table
  partitionDetails:
    column: opportunity_created_date
    partitionType: time
    dataType: DATE
    timeGrain: MONTH
  clusterDetails:
    columns: [opportunity_type, account_industry, primary_product_family]
  bigQueryLabels:
    - key: line_of_business
      value: sales
    - key: data_class
      value: reporting
  dataformTags: [salesforce, sales, sales_cloud, consumption_product, reporting, daily]
```

#### Parameter reference

| Parameter | Type | Required | Default / Example | Description |
| `ecc` \| `s4` \| `common` | `map` | No | `{}` | Versioned data products only (`SapProductTableSettings` / `VersionedProductTableSettings`). Maps dialect-agnostic assets under `common` and dialect-specific assets under variant keys such as `ecc` or `s4`. |
| `[table_name]` | `map` | No | `{}` | `ProductTableItem` descriptor configuring a target analytical asset (at root level for `FlatProductTableSettings` and `SfdcProductTableSettings`, or under `ecc`, `s4`, or `common` for `SapProductTableSettings`). |
| `[table_name].tableName` | `string` | No | Same as YAML entry key | Optional published BigQuery table or view name override (valid identifier: letters, digits, and underscores). Lets you key settings by a `snake_case` definition stem while publishing a differently cased asset name (for example, `PascalCase` views in `cortex_v6_compatibility`). Distinct enabled entries can't resolve to the same `tableName`. |
| `[table_name].enabled` | `boolean` | No | `true` | Controls whether the analytical table or view is compiled into the Dataform workspace: - `true` (default): Processes the definition, injects `tableConfig` properties, and writes it to the output workspace. - `false`: Skips the asset during build without deleting source definition files. |
| `[table_name].materializationType` | `string` | No | `incremental` (schema default; module defaults vary in `table_settings.default.yaml`) | Controls how the analytical asset materializes in BigQuery: - `incremental`: Processes updated or added records since the previous run. Schema default on `ProductTableItem` when omitted---including `flat_product` (`FlatProductBuilder`, whose `default_materialization_type` is `None`)---and configured in `table_settings.default.yaml` for all prebuilt Salesforce (`sfdc_product`) source-aligned models and the four consumption detail tables (`opportunity_pipeline`, `sales_activities`, `case_management`, and `leads_capture_conversions`). Bundled `cortex_samples` products explicitly configure `view`, `table`, or `incremental` in their `table_settings.default.yaml`. - `table`: Rebuilds the table from scratch on every run. Configured in `table_settings.default.yaml` for the four Salesforce consumption `*_overview` models (`opportunity_pipeline_overview`, `sales_activities_overview`, `case_management_overview`, and `leads_capture_conversions_overview`), supported on `flat_product` (including SAP BDC products) with optional `partitionDetails` and `clusterDetails`, and explicitly configured alongside `view` and `incremental` in `table_settings.default.yaml` for bundled `cortex_samples` products. The deprecated `generic_product` compatibility shim (`GenericProductBuilder`, a legacy alias of `flat_product`) defaults to `table` when omitted. - `view`: Deploys the asset as a BigQuery SQL view. Supported across all data product builders (`sap_product`, `sfdc_product`, `flat_product`, and `versioned_product`) in `table_settings.yaml`, including SAP BDC `flat_product` samples (`sap_bdc_product` is a deprecated legacy alias of `flat_product` that no longer defaults to `view`), curated SAP insights views, and `cortex_v6_compatibility` views. |
| `[table_name].dataformTags` | `array[string]` | No | `[]` (for example, `[sap, dataproduct]`) | Arbitrary unique metadata tags attached to the analytical asset in Dataform for selective pipeline runs (such as `dataform run --tags ...`). |
| `[table_name].bigQueryLabels` | `array[map]` | No | `[]` | Unique key-value pairs applied as BigQuery labels on the target analytical asset (for example, `key: data_class`, `value: master`). Keys must match `^[a-z][a-z0-9_-]{0,62}$` and values must match `^[a-z0-9_-]{0,63}$`; uppercase letters, invalid characters, or values longer than 63 characters fail schema validation. Deterministic lowercasing and 54-character prefix plus `_` and 8-character SHA-256 hex digest truncation apply only to framework-generated module labels and pass-through `bigquery.labels` maps. |
| `[table_name].bigquery` | `map[string, any]` | No | None | Optional pass-through BigQuery options object forwarded to the Dataform action's `bigquery` configuration block (for example, additional table options or labels merged with `bigQueryLabels`). For `view` assets, only `bigquery.labels` is emitted. |
| `[table_name].clusterDetails` | `map` | No | None | Optional BigQuery clustering configuration (not applicable when `materializationType` is `view`). See [Clustering details](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#clustering-details). |
| `[table_name].partitionDetails` | `map` | No | None | Optional BigQuery partitioning configuration (not applicable when `materializationType` is `view`). See [Partitioning details](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#partitioning-details). |
| `[table_name].filters` | `map[string, any]` | No | None | Structured business-rule thresholds and value lists passed to data product definitions that consume `tableConfig.filters` (such as SLA thresholds, stalled-deal day counts, and decision-maker role lists on prebuilt Salesforce consumption data products, or weather-risk thresholds on solution samples). Omitted from `tableConfig` when unset. |
| `[table_name].assertions` | `map` | No | None | Optional declarative data quality assertions (`standardRules` and `customRules`) evaluated against the data product asset. See [Data quality assertions](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-assertions). |
| `[table_name].security` | `map` | No | None | Optional table-level column policy tags and row access policies (`TableSecurityConfig`) for materialized tables (`table` or `incremental`; rejected on `view` models). Must be placed at the table item root; nesting `security` under `target` fails validation. See [Row- and column-level security](https://docs.cloud.google.com/cortex/docs/deployment-configuration.md.txt#table-settings-security). |
|---|---|---|---|---|

Unlike the data foundation style, the data product style accepts arbitrary
custom parameters on each table entry (`ProductTableItem`), except disallowed
keys such as `removeIsDeleted` or `remove_is_deleted` on Salesforce products
and misplaced or misspelled `security` keys (such as `target.security`,
root-level `columnTags`, or typos such as `secruty`). Nested sub-blocks
(`partitionDetails`, `clusterDetails`, `bigQueryLabels`, `assertions`, and
`security`) reject unknown keys. Extra parameters on a product table entry are
injected into the `const tableConfig = ...` object inside that table's compiled
Dataform definition file (replacing the `// ___TABLE_CONFIG___`
placeholder) rather than written to `includes/config.js`.

> [!NOTE]
> **Note:** For versioned SAP ERP products (`SapProductTableSettings`), `common` holds dialect-agnostic table entries and `ecc` or `s4` hold dialect-specific table entries. Defining the same table name (case-insensitive) in both `common` and `ecc` or `s4` fails schema validation---move a table from `common` into `ecc` and `s4` when the two SAP versions require different settings. Table name lookup against definition files (`*.js` or `*.sqlx`) is case-insensitive.

#### Data quality assertions

Both data foundation (`[].assertions` or `target.assertions`) and data product
(`[table_name].assertions`) table settings accept an optional `assertions` map
(`TableAssertionsConfig`) to generate Dataform assertion views in
`data.defaultAssertionDataset`:

- `enabled` (`boolean`, default `true`): Enables or disables assertions for the table while keeping static rule authoring checks active at build time.
- `lookbackDays` (`integer >= 1`, optional): Default partition-pruning window in days for standard rules on the table that set `prunePartition: true`.
- `standardRules` (`array[map]`, optional): Built-in rule definitions supporting `non_null`, `unique_key`, `range`, `foreign_key`, `accepted_values`, and `cross_layer_parity` (with optional `sap_currency_decimal_shift`). Note that `cross_layer_parity` rules don't allow `blocking: true` or `prunePartition: true`.
- `customRules` (`array[map]`, optional): Custom SQL assertions defined inline with `sqlExpression` or through reusable SQL templates (`templateFile` and `params`), plus optional custom Dataform `tags` (`array[string]`).

Every rule supports `enabled` (`boolean`, default `true`), `blocking`
(`boolean`, default `false`, except on `cross_layer_parity`), and `severity`
(when `data.assertionSeverities` is configured). On SAP CDC foundation tables,
rules with `blocking: true` are also enforced inside the BigQuery
`BEGIN TRANSACTION ... MERGE ... COMMIT TRANSACTION` block, rolling back the
merge if a check fails. For complete rule schemas, SAP functional templates, and
validation workflows, see
[Data quality assertions](https://docs.cloud.google.com/cortex/docs/data-quality-assertions.md.txt).

#### Row- and column-level security

Both data foundation (`target.security`) and materialized data product
(`[table_name].security`) table settings accept an optional `security` map
(`TableSecurityConfig`) for Tier 3 table-level column policy tag and row access
policy overrides. Placement is strictly validated---foundation entries reject
root-level or `source.security` blocks, product entries reject `target.security`
blocks, and `view`-materialized product models reject explicit `security`
blocks:

- `enabled` (`boolean`, default `true`): Enables or opts the table out of overridable security policies. Setting `enabled: false` triggers Day-2 teardown of row access policies and Cortex Framework-managed column policy tags, and fails validation if any non-overridable (`allowTableOverride: false`) Tier 2 rule applies to the table.
- `columnTags` (`map[string, map]`, optional): Maps unique (case-insensitive) BigQuery column names to `{ policyTag: <alias | uri | null> }`. Specify an alias from `data.security.policyTags` or a full Data Catalog policy tag URI to attach or replace a tag, or explicit `null` to clear an overridable Tier 2 policy tag (blank strings fail validation).
- `rowAccessPolicies` (`array[map]`, optional): Table-level BigQuery row access policies. Each entry defines a unique `name` (can't be `cortex_pipeline_sa_bypass`), optional `enabled` (`boolean`, default `true`), optional `inheritDomainFilter` (`boolean`, default `true`), and---when enabled---non-empty `grantees` (`array[string]`) and `filterPredicate` (`string`, supporting non-self-referencing `${ref(...)}` lookup-table tokens).

For precedence rules, `${ref(...)}` lookup syntax, pipeline service account
bypass behavior, and reconciliation workflows, see
[Row- and column-level security](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt).

*** ** * ** ***

### Advanced BigQuery settings

Both foundation and data product table settings share the same structure for
optimizing BigQuery storage and query performance through
**clustering** and **partitioning**.

*** ** * ** ***

#### Clustering details

Clustering co-locates data within storage blocks based on up to four columns,
accelerating queries that filter (`WHERE`) or join (`JOIN`) on those keys:

```yaml
clusterDetails:
  columns: [bukrs, gjahr]
```

##### Parameter reference

| Parameter | Type | Required | Example | Description |
| `columns` | `array[string]` | **Yes** | `[bukrs, gjahr]` | Ordered list of zero to four unique column names (case-insensitive duplicate check; letters, digits, and underscores only). Pass an empty list (`[]`) to disable clustering when overriding a default. Column order determines the sort hierarchy. On data foundations, when the raw source table schema is available, build-time validation rejects unclusterable BigQuery types (`FLOAT64`, `FLOAT`, `BYTES`, `JSON`, `TIME`, `INTERVAL`, `STRUCT`, `RECORD`, and `ARRAY`) and warns on missing columns. On data products, only syntactic validation (at most four unique valid column identifiers) runs at build time, and BigQuery validates column types when queries run. |
|---|---|---|---|---|

*** ** * ** ***

#### Partitioning details

Partitioning divides a large table into physical segments based on a `DATE`,
`DATETIME`, `TIMESTAMP`, or `INT64` column so queries scan only matching
partitions:

```yaml
partitionDetails:
  column: budat
  partitionType: time
  dataType: DATE
  timeGrain: day
```

##### Parameter reference

| Parameter | Type | Required | Example | Description |
| `column` | `string` | **Yes** | `budat` | Column name used to partition the table (letters, digits, and underscores only). Must match a column of the corresponding data type on the table. |
| `partitionType` | `string` | **Yes** | `time` | Partitioning strategy: - `time`: Partitions by a `DATE`, `DATETIME`, or `TIMESTAMP` column (pair with `dataType` and optional `timeGrain`). - `integer`: Partitions an `INT64` column by integer range buckets using `rangeStart`, `rangeEnd`, and `rangeInterval` (supported on data products and both SAP ERP and Salesforce foundation tables). Legacy values `DATE`, `DATETIME`, and `TIMESTAMP` in `partitionType` are deprecated and scheduled for removal in version 8.0; migrate to `partitionType: time` with `dataType`. |
| `dataType` | `string` | Conditional | `DATE` | Physical BigQuery column type for `partitionType: time` (forbidden when `partitionType` is `integer`). Allowed values are `DATE`, `DATETIME`, and `TIMESTAMP`. **Required on time-partitioned data products** (omitting `dataType` on a product emits a deprecation warning and leaves the table unpartitioned until version 8.0); **optional on data foundations**, where the type is inferred from the raw source table schema when available. |
| `timeGrain` | `string` | No | `day` | Optional time granularity when `partitionType` is `time` (defaults to `day`; forbidden when `partitionType` is `integer`). Allowed values are `hour`, `day`, `month`, and `year` (case-insensitive). `DATE` columns support only `day`, `month`, and `year`; `hour` applies only to `DATETIME` and `TIMESTAMP` columns. |
| `rangeStart` | `integer` | Conditional | `1` | **Required when `partitionType` is `integer`** (forbidden for `time`). Inclusive start value of the first range partition. |
| `rangeEnd` | `integer` | Conditional | `1000` | **Required when `partitionType` is `integer`** . Exclusive end value of the last range partition (must be strictly greater than `rangeStart`). |
| `rangeInterval` | `integer` | Conditional | `10` | **Required when `partitionType` is `integer`** . Positive width of each integer partition bucket (`> 0`). |
|---|---|---|---|---|

> [!IMPORTANT]
> **Important:** When you configure `partitionType: integer`, you must specify all three range parameters (`rangeStart`, `rangeEnd`, and `rangeInterval`), and omit `dataType` and `timeGrain`.

*** ** * ** ***

## Examples

The following examples show complete `table_settings.yaml` configurations for
SAP ERP data foundation and data product modules.

### Foundation table settings example

This example configures an SAP foundation layer with clustered and partitioned
transactional tables (`acdoca`, `bkpf`, `ekpo`) alongside a vendor master table
(`lfa1`):

```yaml
# ==============================================================================
# S/4HANA-Specific Tables
# ==============================================================================
s4:
  - source:
      tableName: acdoca
    target:
      bigQueryLabels:
        - key: data_class
          value: transactional
      dataformTags: [sap, s4, finance, transactional, hourly]
      clusterDetails:
        columns: [rclnt, rbukrs, gjahr]

# ==============================================================================
# ECC-Specific Tables
# ==============================================================================
ecc:
  - source:
      tableName: faglflexa
    target:
      bigQueryLabels:
        - key: data_class
          value: transactional
      dataformTags: [sap, ecc, finance, transactional, hourly]

# ==============================================================================
# Common Tables (ECC & S/4HANA)
# ==============================================================================
common:
  # Financial document header (partitioned by posting date)
  - source:
      tableName: bkpf
      isCdc: true
    target:
      bigQueryLabels:
        - key: data_class
          value: transactional
      dataformTags: [sap, common, finance, hourly]
      clusterDetails:
        columns: [bukrs, gjahr]
      partitionDetails:
        column: budat
        partitionType: time
        dataType: DATE
        timeGrain: day

  # Purchasing document items (partitioned by change date)
  - source:
      tableName: ekpo
    target:
      bigQueryLabels:
        - key: data_class
          value: transactional
      dataformTags: [sap, common, logistics, purchasing, hourly]
      clusterDetails:
        columns: [mandt, ebeln]
      partitionDetails:
        column: aedat
        partitionType: time
        dataType: DATE
        timeGrain: month

  # Vendor master data table
  - source:
      tableName: lfa1
    target:
      bigQueryLabels:
        - key: data_class
          value: master
      dataformTags: [sap, common, masterdata, vendor, daily]
```

### Data product table settings example

This example configures materialization strategies for analytical data product
assets---setting transactional `sales_documents` to `incremental` to reduce scan
costs, `customers` to `table` for full master-data refreshes, and
`sales_performance_summary` to `view`:

```yaml
# Settings applied for both ECC and S/4HANA pipelines
common:
  # Transactional data product - incremental build
  sales_documents:
    materializationType: incremental
    bigQueryLabels:
      - key: data_class
        value: transactional
    dataformTags: [sap, dataproduct, sales, transactional]
    clusterDetails:
      columns: [vkorg, vbeln]
    partitionDetails:
      column: audat
      partitionType: time
      dataType: DATE
      timeGrain: day

  # Master data product - full table rebuild
  customers:
    materializationType: table
    bigQueryLabels:
      - key: data_class
        value: master
    dataformTags: [sap, dataproduct, masterdata]
    clusterDetails:
      columns: [mandt, ktokd]

  # Aggregated reporting asset - virtual SQL view
  sales_performance_summary:
    materializationType: view
    bigQueryLabels:
      - key: data_class
        value: transactional
    dataformTags: [sap, dataproduct, sales, reporting]
```

## How-to guides

This section provides step-by-step instructions for customizing foundation
table scope and deploying multiple foundation instances.

### Customize foundation table scope

To add custom source tables or remove unused tables in an existing data
foundation module without creating separate module instances:

1. Copy the default `table_settings.default.yaml` file into your `config/` directory---for example, `config/cortex/sap/foundations/sap/custom_table_settings.yaml` for SAP ERP or `config/cortex/sfdc/foundations/sfdc/custom_table_settings.yaml` for Salesforce.
2. Add custom tables or remove unused entries (under `ecc`, `s4`, or `common`
   for SAP ERP, or in the flat root-level list for Salesforce). Set
   `deployAlways: true` if no enabled data product declares the custom table in
   its `manifest.yaml`:

   - **SAP ERP (`cortex.sap.foundations.sap`)**:

     ```yaml
     common:
       - source:
           tableName: CUSTOM_RAW_TABLE_NAME
         target:
           dataformTags: [custom_tag]
         deployAlways: true
     ```

     Replace the following:
     - `CUSTOM_RAW_TABLE_NAME`: physical table name in your raw BigQuery SAP source dataset, for example: `ztcustom`.
   - **Salesforce (`cortex.sfdc.foundations.sfdc`)**:

     ```yaml
     # Keep standard SObject entries required by enabled Salesforce data products,
     # and append custom SObjects (for example, My_Custom_Object__c):
     - source:
         tableName: CUSTOM_SOBJECT_NAME
         isCdc: true
       target:
         dataformTags: [salesforce, foundation, custom]
         clusterDetails:
           columns: [Id]
       deployAlways: true
     ```

     Replace the following:
     - `CUSTOM_SOBJECT_NAME`: physical table name in your raw BigQuery Salesforce source dataset, for example: `My_Custom_Object__c`.
3. Reference your custom file in `config/config.yaml` using a path relative to
   the `config/` directory (or embed a compact override directly with
   `inlineTableSettings`):

   ```yaml
   data:
     modules:
       foundations:
         - moduleId: erp
           modulePath: cortex.sap.foundations.sap
           dataSourceId: sap_raw
           dataTargetId: sap_foundation
           moduleSettings:
             sapVersion: s4
             mandt: "100"
           tableSettings: "cortex/sap/foundations/sap/custom_table_settings.yaml"
   ```
4. Optional: To enrich the conformed table with table and column descriptions,
   create an annotation YAML file under
   `src/data_modules/cortex/sap/foundations/sap/annotations/` (or
   `src/data_modules/cortex/sfdc/foundations/sfdc/annotations/` for Salesforce,
   named in `snake_case`). For details on the annotation schema, see
   [Data foundation module creation](https://docs.cloud.google.com/cortex/docs/extensibility-guide-data-foundation.md.txt#step_5_create_field-level_metadata_annotations).

### Deploy multiple foundation instances

You can deploy two or more separate instances of the same foundation module in
a single `config/config.yaml` file---for example, to ingest multiple SAP systems
or Salesforce orgs, segment custom tables, or target separate
BigQuery datasets.

#### Before you begin

- Verify that the raw source tables exist in each inbound BigQuery dataset.
- For SAP ERP foundation modules, verify that `DD03L` contains column metadata for every table in scope (see [SAP ERP integration](https://docs.cloud.google.com/cortex/docs/source-system-integration/sap-erp.md.txt)). For Salesforce foundation modules, grant your build principal `roles/bigquery.dataViewer` on each raw dataset and `roles/bigquery.jobUser` on `buildEnvironment.buildProjectId` so `uv run cortex-build` can inspect table schemas (see [Salesforce integration](https://docs.cloud.google.com/cortex/docs/source-system-integration/salesforce.md.txt)).

#### Procedure

1. Register distinct target dataset entries under `data.datasets` in
   `config/config.yaml`:

   ```yaml
   data:
     datasets:
       - id: sap_raw
         projectId: SOURCE_PROJECT_ID
         datasetId: cortex_sap_raw
       - id: data_foundation_core
         projectId: TARGET_PROJECT_ID
         datasetId: data_foundation_sap_core
       - id: data_foundation_custom
         projectId: TARGET_PROJECT_ID
         datasetId: data_foundation_sap_custom
   ```

   Replace the following:
   - `SOURCE_PROJECT_ID`: Google Cloud project ID hosting the raw SAP dataset, for example: `my-cortex-source-project`.
   - `TARGET_PROJECT_ID`: Google Cloud project ID hosting your conformed foundation datasets, for example: `my-cortex-target-project`.
2. Define each foundation instance under `data.modules.foundations` with its
   own unique `moduleId`, `dataTargetId`, `moduleSettings`, and optional
   `tableSettings`:

   ```yaml
   data:
     modules:
       foundations:
         # Core SAP ERP foundation module instance
         - moduleId: erp_core
           modulePath: cortex.sap.foundations.sap
           dataSourceId: sap_raw
           dataTargetId: data_foundation_core
           moduleSettings:
             sapVersion: s4
             mandt: "100"

         # Custom SAP tables foundation module instance
         - moduleId: erp_custom
           modulePath: cortex.sap.foundations.sap
           dataSourceId: sap_raw
           dataTargetId: data_foundation_custom
           moduleSettings:
             sapVersion: s4
             mandt: "100"
           tableSettings: "cortex/sap/foundations/sap/custom_datafoundation_table_settings.yaml"
   ```

   For curated `cortex.sap.*` foundation and data product modules, tables remain
   multi-client and don't filter rows by `moduleSettings.mandt` (`mandt` is
   forwarded to `cortex_v6_compatibility` models and `cortex-demo`). Multiple
   foundation instances that share the same `dataSourceId` process all SAP
   clients present in the raw tables regardless of their configured `mandt`
   values.
3. Create
   `config/cortex/sap/foundations/sap/custom_datafoundation_table_settings.yaml`
   with the custom table scope:

   ```yaml
   common:
     - source:
         tableName: CUSTOM_SAP_TABLE_NAME
       target:
         dataformTags: [sap, s4, hourly]
         clusterDetails:
           columns: [carrid, connid]
         partitionDetails:
           column: fldate
           partitionType: time
           dataType: DATE
           timeGrain: day
       deployAlways: true
   ```

   Replace the following:
   - `CUSTOM_SAP_TABLE_NAME`: raw SAP table name in `sap_raw`, for example: `sflight`.
4. Optional: Add field-level metadata annotations under
   `src/data_modules/cortex/sap/foundations/sap/annotations/` as described in
   [Data foundation module creation](https://docs.cloud.google.com/cortex/docs/extensibility-guide-data-foundation.md.txt#step_5_create_field-level_metadata_annotations).

5. Build and deploy your workspace using
   [`uv run cortex-build-and-deploy`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-build-and-deploy.md.txt),
   then execute the generated Dataform actions as described in
   [Post-deployment steps](https://docs.cloud.google.com/cortex/docs/post-deployment-steps.md.txt).

### Validate configuration before deployment

Before synchronizing compiled pipelines to Dataform or Git across
multi-project environments, verify your Identity and Access Management (IAM) permissions
and run offline SQL compilation checks:

- **Multi-project IAM permissions** :
  - Grant your build principal `roles/bigquery.jobUser` on `buildEnvironment.buildProjectId` and `roles/bigquery.dataViewer` on each raw source dataset (`dataSourceId`).
  - Grant the target Dataform service account `roles/bigquery.dataViewer` on raw source datasets and `roles/bigquery.dataEditor` on all target foundation, data product, and `data.defaultAssertionDataset` datasets, plus `roles/bigquery.jobUser` on the repository project.
- **Local SQL graph compilation** : Build and compile all enabled modules into an
  ephemeral workspace (connects to BigQuery when non-external
  foundations or catalogs are enabled), or pass `--dist-dir dist` after
  `uv run cortex-build` to compile strictly offline without
  BigQuery credentials:

  ```bash
  export CORTEX_CONFIG_FILE=config/config.yaml

  uv run cortex-compile --config $CORTEX_CONFIG_FILE
  ```
- **Full local build** : Build the `dist` package and automatically validate
  declarative assertion rules and templates against live source schemas before
  deploying:

  ```bash
  export CORTEX_CONFIG_FILE=config/config.yaml

  uv run cortex-build --config $CORTEX_CONFIG_FILE
  ```

## What's next

- [Deploy Cortex Framework](https://docs.cloud.google.com/cortex/docs/deployment.md.txt)
- [Post-deployment steps](https://docs.cloud.google.com/cortex/docs/post-deployment-steps.md.txt)
- [Configure data quality assertions](https://docs.cloud.google.com/cortex/docs/data-quality-assertions.md.txt)
- [Configure row- and column-level security](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt)
- [Configure conversational analytics data agents](https://docs.cloud.google.com/cortex/docs/conversational-analytics.md.txt)
- [Extend Cortex Framework](https://docs.cloud.google.com/cortex/docs/extensibility-guide.md.txt)