Skip to content

feat(gooddata-sdk): [AUTO] Add AFM execution parameters, WhatIfScenario, and new filter types#1565

Open
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C001-20260420-r82171
Open

feat(gooddata-sdk): [AUTO] Add AFM execution parameters, WhatIfScenario, and new filter types#1565
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C001-20260420-r82171

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added SDK wrappers for WhatIfScenario analysis (AfmWhatIfMeasureAdjustmentConfig, AfmWhatIfScenarioItem, AfmWhatIfScenarioConfig) and MetricDefinitionOverride support in ExecutionDefinition / compute_model_to_api_model. AllTimeDateFilter with emptyValueHandling and MatchAttributeFilter were already fully implemented. DashboardArbitraryAttributeFilter was determined to be a dashboard-context filter not requiring an SDK compute-layer wrapper. All new classes are exported from gooddata_sdk.init. Unit tests added for all new classes.

Impact: new_feature | Services: gooddata-afm-client, gooddata-metadata-client
Tickets: CQ-2056

Files changed

  • packages/gooddata-sdk/src/gooddata_sdk/compute/model/what_if.py
  • packages/gooddata-sdk/src/gooddata_sdk/compute/model/execution.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/compute_model/test_metric_definition_override.py

Agent decisions

Decisions (4)

MetricDefinitionOverride placement — Placed in execution.py alongside ExecutionDefinition

  • Alternatives: New file metric_overrides.py, In metric.py
  • Why: MetricDefinitionOverride is consumed exclusively by ExecutionDefinition.as_api_model() and compute_model_to_api_model(). Co-locating avoids an extra file and mirrors how TotalDefinition/TotalDimension live in execution.py.

WhatIf class naming with Afm prefix — AfmWhatIfMeasureAdjustmentConfig / AfmWhatIfScenarioItem / AfmWhatIfScenarioConfig

  • Alternatives: WhatIfMeasureAdjustmentConfig (clashes with API client name), CatalogWhatIf... (Catalog prefix is for catalog-domain entities)
  • Why: Afm prefix matches the compute/AFM execution layer these models live in.

_check_type=False on AFM model constructor — Added _check_type=False to models.AFM() call in compute_model_to_api_model

  • Alternatives: Not passing it
  • Why: Necessary to avoid type validation error when passing measure_definition_overrides as an extra kwarg. Follows the existing SDK pattern.

DashboardArbitraryAttributeFilter not wrapped — No SDK wrapper added

  • Alternatives: Add SDK compute-layer wrapper
  • Why: This is a dashboard-context filter (DashboardFilter), not an AFM execution filter. The SDK compute layer has no mechanism for dashboard filters and no service method that would consume it.
Assumptions to verify (3)
  • WhatIfScenarioConfig is used in VisualizationConfig.what_if and is not wired into AfmExecution directly; the SDK wrappers let users build VisualizationConfig payloads manually.
  • AfmObjectIdentifierCoreIdentifier.type accepts arbitrary strings since ObjId.as_afm_id() already passes arbitrary type strings.
  • The measure_definition_overrides=None default does not break existing callers of compute_model_to_api_model.
Risks (2)
  • If backend validates AFM.measureDefinitionOverrides item.type strictly against the allowed_values enum, fact-type override tests may fail.
  • WhatIfScenarioItem.to_dict() camelCase key assertions depend on the auto-generated API client correctly serializing those fields.
Layers touched (3)
  • entity_model — New MetricDefinitionOverride class and WhatIf wrappers; ExecutionDefinition updated with measure_definition_overrides param; compute_model_to_api_model updated to pass overrides to AFM.
    • packages/gooddata-sdk/src/gooddata_sdk/compute/model/what_if.py
    • packages/gooddata-sdk/src/gooddata_sdk/compute/model/execution.py
  • public_api — Exported MetricDefinitionOverride, AfmWhatIfMeasureAdjustmentConfig, AfmWhatIfScenarioItem, AfmWhatIfScenarioConfig.
    • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • tests — Unit tests covering as_api_model() serialization for all new classes.
    • packages/gooddata-sdk/tests/compute_model/test_metric_definition_override.py

Source commits (gdc-nas)

  • c9c966b Merge pull request #21589 from gooddata/dho/cq-2114-flag
  • 7f74f3e Merge pull request #21535 from gooddata/dho/cq-2114-execution-context
  • 0468f7f Merge pull request #21536 from gooddata/dho/cq-2114-prop
  • af3e42d Merge pull request #21504 from gooddata/dho/cq-2114-automation-filters
  • f21d1fc Merge pull request #21527 from pmsgd/pms/cq-2056
  • 7382d93 Merge pull request #21572 from gooddata/CQ-2056-2
  • cf171ae Merge pull request #21497 from pmsgd/pms/cq-495
  • 1a3380f Merge pull request #21235 from pmsgd/pms/cq-2030
OpenAPI diff
+      "AllTimeDateFilter": {
+        "description": "An all-time date filter that does not restrict by date range.",
+        "properties": {
+          "allTimeDateFilter": {
+            "properties": {
+              "emptyValueHandling": { "enum": ["INCLUDE","EXCLUDE","ONLY"], "type": "string" }
+            }
+          }
+        }
+      },
+      "DashboardArbitraryAttributeFilter": {
+        "properties": {
+          "dashboardArbitraryAttributeFilter": {
+            "properties": {
+              "displayForm": { "$ref": "#/components/schemas/AfmObjectIdentifierAttribute" }
+            }
+          }
+        }
+      },
+      "MatchAttributeFilter": { ... },
+      "WhatIfScenario": { ... },
+      "measureDefinitionOverrides": { ... },
       "parameterItems": {
+        "items": { "$ref": "#/components/schemas/ParameterItem" },
+        "type": "array"
+      }

Workflow run


Generated by SDK OpenAPI Sync workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant