Skip to content

Commit d200a1e

Browse files
AIDAclaude
andcommitted
feat(gooddata-sdk): [AUTO] add grand_totals_position to ExportSettings
Adds a new optional `grand_totals_position` field (GrandTotalsPosition TypeAlias) to ExportSettings, wiring through the grand-total position enum (pinnedBottom, pinnedTop, bottom, top) added to TabularExportRequest Settings in the upstream OpenAPI specs. Exports GrandTotalsPosition from the public SDK __init__.py for typed usage by callers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 46c0f4b commit d200a1e

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎packages/gooddata-sdk/src/gooddata_sdk/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
ExportCustomOverride,
6767
ExportRequest,
6868
ExportSettings,
69+
GrandTotalsPosition,
6970
SlidesExportRequest,
7071
VisualExportRequest,
7172
)

‎packages/gooddata-sdk/src/gooddata_sdk/catalog/export/request.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# (C) 2023 GoodData Corporation
2-
from typing import Literal
2+
from typing import Literal, Optional
33

44
from attrs import define
55
from gooddata_api_client.model.custom_label import CustomLabel as ApiCustomLabel
@@ -12,6 +12,8 @@
1212

1313
from gooddata_sdk.catalog.base import Base
1414

15+
GrandTotalsPosition = Literal["pinnedBottom", "pinnedTop", "bottom", "top"]
16+
1517

1618
@define(kw_only=True)
1719
class ExportCustomLabel(Base):
@@ -46,6 +48,7 @@ def client_class() -> type[ApiCustomOverride]:
4648
class ExportSettings(Base):
4749
merge_headers: bool
4850
show_filters: bool
51+
grand_totals_position: Optional[GrandTotalsPosition] = None
4952

5053
@staticmethod
5154
def client_class() -> type[ApiSettings]:

‎packages/gooddata-sdk/tests/export/test_export_service.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
import os
77
from pathlib import Path
88

9+
import pytest
10+
911
from gooddata_sdk import (
1012
Attribute,
1113
ExecutionDefinition,
1214
ExportCustomLabel,
1315
ExportCustomMetric,
1416
ExportCustomOverride,
1517
ExportRequest,
18+
ExportSettings,
1619
GoodDataSdk,
20+
GrandTotalsPosition,
1721
ObjId,
1822
SimpleMetric,
1923
TableDimension,
@@ -89,6 +93,24 @@ def _tabular_by_visualization_id_base(test_config, export_format: str):
8993
_validate_clean(goal_path)
9094

9195

96+
@pytest.mark.parametrize(
97+
"grand_totals_position",
98+
[None, "pinnedBottom", "pinnedTop", "bottom", "top"],
99+
)
100+
def test_export_settings_grand_totals_position(grand_totals_position: GrandTotalsPosition):
101+
settings = ExportSettings(
102+
merge_headers=True,
103+
show_filters=False,
104+
grand_totals_position=grand_totals_position,
105+
)
106+
assert settings.grand_totals_position == grand_totals_position
107+
snake_dict = settings._get_snake_dict()
108+
if grand_totals_position is not None:
109+
assert snake_dict["grand_totals_position"] == grand_totals_position
110+
else:
111+
assert "grand_totals_position" not in snake_dict
112+
113+
92114
@gd_vcr.use_cassette(str(_fixtures_dir / "test_export_csv.yaml"))
93115
def test_export_csv(test_config):
94116
_tabular_export_base(test_config, "CSV")

0 commit comments

Comments
 (0)