Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cluster-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `af3e42d` Merge pull request #21504 from gooddata/dho/cq-2114-automation-filters
- `0468f7f` Merge pull request #21536 from gooddata/dho/cq-2114-prop
- `c9c966b` Merge pull request #21589 from gooddata/dho/cq-2114-flag
33 changes: 33 additions & 0 deletions cluster.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"id": "C002",
"title": "Add new dashboard filter types: Arbitrary and Match attribute filters",
"services": [
"gooddata-afm-client",
"gooddata-automation-client",
"gooddata-export-client",
"gooddata-metadata-client"
],
"commits": [
{
"sha": "af3e42ddf340409122c7c5c8d08395c1944a090f",
"author": "Dan Homola",
"author_email": "dan.homola@gooddata.com",
"message": "Merge pull request #21504 from gooddata/dho/cq-2114-automation-filters"
},
{
"sha": "0468f7fde58088d792640d31b82a9a71c96d1f71",
"author": "Dan Homola",
"author_email": "dan.homola@gooddata.com",
"message": "Merge pull request #21536 from gooddata/dho/cq-2114-prop"
},
{
"sha": "c9c966ba79b69c33f7cf09af252d4e2081308147",
"author": "Dan Homola",
"author_email": "dan.homola@gooddata.com",
"message": "Merge pull request #21589 from gooddata/dho/cq-2114-flag"
}
],
"diff": "--- a/gooddata-automation-client.json\n+++ b/gooddata-automation-client.json\n+ \"DashboardArbitraryAttributeFilter\": {\n+ \"properties\": {\n+ \"arbitraryAttributeFilter\": {\n+ \"properties\": {\n+ \"displayForm\": { \"$ref\": \"#/components/schemas/IdentifierRef\" },\n+ \"negativeSelection\": { \"type\": \"boolean\" },\n+ \"values\": { \"items\": { \"type\": \"string\" }, \"type\": \"array\" }\n+ },\n+ \"required\": [\"displayForm\",\"negativeSelection\",\"values\"]\n+ }\n+ },\n+ \"required\": [\"arbitraryAttributeFilter\"]\n+ },\n+ \"DashboardMatchAttributeFilter\": {\n+ \"properties\": {\n+ \"matchAttributeFilter\": {\n+ \"properties\": {\n+ \"operator\": { \"enum\": [\"contains\",\"startsWith\",\"endsWith\"] },\n+ \"literal\": { \"type\": \"string\" }\n+ },\n+ \"required\": [\"caseSensitive\",\"displayForm\",\"literal\",\"negativeSelection\",\"operator\"]\n+ }\n+ },\n+ \"required\": [\"matchAttributeFilter\"]\n+ },\n+ \"usesArbitraryValues\": { \"description\": \"If true, values in notInElements were filled free-form.\", \"type\": \"boolean\" }",
"jira_tickets": [],
"sdk_impact": "new_feature"
}
6 changes: 6 additions & 0 deletions packages/gooddata-sdk/src/gooddata_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,15 @@
CatalogDeclarativeExportDefinitionRequestPayload,
)
from gooddata_sdk.catalog.workspace.declarative_model.workspace.automation import (
CatalogAutomationDashboardTabularExport,
CatalogAutomationSchedule,
CatalogDashboardTabularExportRequestV2,
CatalogDeclarativeAutomation,
)
from gooddata_sdk.catalog.workspace.declarative_model.workspace.dashboard_filter import (
CatalogDashboardArbitraryAttributeFilter,
CatalogDashboardMatchAttributeFilter,
)
from gooddata_sdk.catalog.workspace.declarative_model.workspace.logical_model.data_filter_references import (
CatalogDeclarativeWorkspaceDataFilterReferences,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
from typing import Any

from attrs import define, field
from gooddata_api_client.model.automation_dashboard_tabular_export import AutomationDashboardTabularExport
from gooddata_api_client.model.automation_schedule import AutomationSchedule
from gooddata_api_client.model.automation_tabular_export import AutomationTabularExport
from gooddata_api_client.model.automation_visual_export import AutomationVisualExport
from gooddata_api_client.model.dashboard_tabular_export_request_v2 import DashboardTabularExportRequestV2
from gooddata_api_client.model.declarative_automation import DeclarativeAutomation

from gooddata_sdk.catalog.base import Base
Expand Down Expand Up @@ -51,6 +53,60 @@ def client_class() -> builtins.type[AutomationVisualExport]:
return AutomationVisualExport


@define(kw_only=True)
class CatalogDashboardTabularExportRequestV2(Base):
"""SDK wrapper for DashboardTabularExportRequestV2.

Represents the request payload for a dashboard tabular export, used within
automation ``dashboard_tabular_exports``.

The ``dashboard_filters_override`` field accepts raw filter dicts. Each dict
must be a serialised ``DashboardFilter`` (one of: ``attributeFilter``,
``dateFilter``, ``arbitraryAttributeFilter``, ``matchAttributeFilter``).
Use :class:`~gooddata_sdk.CatalogDashboardArbitraryAttributeFilter` or
:class:`~gooddata_sdk.CatalogDashboardMatchAttributeFilter` to build these dicts.

Attributes:
dashboard_id: Dashboard identifier.
file_name: Output filename without extension.
format: Export format – ``"XLSX"`` or ``"PDF"``.
dashboard_filters_override: Optional list of filter override dicts.
dashboard_tabs_filters_overrides: Optional per-tab filter overrides.
settings: Optional export settings dict.
widget_ids: Optional list of widget IDs to export (max 1).
"""

dashboard_id: str
file_name: str
format: str
dashboard_filters_override: list[dict] | None = None
dashboard_tabs_filters_overrides: dict | None = None
settings: dict | None = None
widget_ids: list[str] | None = None

@staticmethod
def client_class() -> builtins.type[DashboardTabularExportRequestV2]:
return DashboardTabularExportRequestV2


@define(kw_only=True)
class CatalogAutomationDashboardTabularExport(Base):
"""SDK wrapper for AutomationDashboardTabularExport.

Wraps a :class:`CatalogDashboardTabularExportRequestV2` for use in
:class:`CatalogDeclarativeAutomation`.

Attributes:
request_payload: The dashboard tabular export request.
"""

request_payload: CatalogDashboardTabularExportRequestV2

@staticmethod
def client_class() -> builtins.type[AutomationDashboardTabularExport]:
return AutomationDashboardTabularExport


@define(kw_only=True)
class CatalogDeclarativeAutomation(CatalogAnalyticsBaseMeta):
description: str | None = None
Expand All @@ -65,6 +121,7 @@ class CatalogDeclarativeAutomation(CatalogAnalyticsBaseMeta):
schedule: CatalogAutomationSchedule | None = None
tabular_exports: list[CatalogAutomationTabularExport] | None = None
visual_exports: list[CatalogAutomationVisualExport] | None = None
dashboard_tabular_exports: list[CatalogAutomationDashboardTabularExport] | None = None

@staticmethod
def client_class() -> builtins.type[DeclarativeAutomation]:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# (C) 2024 GoodData Corporation
from __future__ import annotations

import builtins
from typing import Literal

import attrs
from gooddata_api_client.model.dashboard_arbitrary_attribute_filter_arbitrary_attribute_filter import (
DashboardArbitraryAttributeFilterArbitraryAttributeFilter,
)
from gooddata_api_client.model.dashboard_match_attribute_filter_match_attribute_filter import (
DashboardMatchAttributeFilterMatchAttributeFilter,
)

from gooddata_sdk.catalog.base import Base

DashboardMatchOperator = Literal["contains", "startsWith", "endsWith"]


@attrs.define(kw_only=True)
class CatalogDashboardArbitraryAttributeFilter(Base):
"""SDK wrapper for the body of DashboardArbitraryAttributeFilter.

Represents a free-form attribute filter for dashboard filter overrides.
The ``display_form`` field should be an ``IdentifierRef`` dict, e.g.::

{"identifier": {"id": "label.my_label", "type": "label"}}

To build a dashboard filter override dict, wrap the result of
:meth:`to_dict` in the outer key::

{"arbitrary_attribute_filter": filter.to_dict(camel_case=False)}

Attributes:
display_form: IdentifierRef dict identifying the display form.
negative_selection: When ``True``, the filter excludes the listed values.
values: List of string values to filter on.
local_identifier: Optional local identifier for the filter.
title: Optional human-readable title.
"""

display_form: dict
negative_selection: bool
values: list[str] = attrs.field(factory=list)
local_identifier: str | None = None
title: str | None = None

@staticmethod
def client_class() -> builtins.type[DashboardArbitraryAttributeFilterArbitraryAttributeFilter]:
return DashboardArbitraryAttributeFilterArbitraryAttributeFilter


@attrs.define(kw_only=True)
class CatalogDashboardMatchAttributeFilter(Base):
"""SDK wrapper for the body of DashboardMatchAttributeFilter.

Represents a string-match attribute filter for dashboard filter overrides.
The ``display_form`` field should be an ``IdentifierRef`` dict, e.g.::

{"identifier": {"id": "label.my_label", "type": "label"}}

To build a dashboard filter override dict, wrap the result of
:meth:`to_dict` in the outer key::

{"match_attribute_filter": filter.to_dict(camel_case=False)}

Attributes:
display_form: IdentifierRef dict identifying the display form.
case_sensitive: When ``True``, the string match is case-sensitive.
literal: The string literal to match against.
negative_selection: When ``True``, the filter excludes matches.
operator: Match operator – one of ``"contains"``, ``"startsWith"``, ``"endsWith"``.
local_identifier: Optional local identifier for the filter.
title: Optional human-readable title.
"""

display_form: dict
case_sensitive: bool
literal: str
negative_selection: bool
operator: DashboardMatchOperator
local_identifier: str | None = None
title: str | None = None

@staticmethod
def client_class() -> builtins.type[DashboardMatchAttributeFilterMatchAttributeFilter]:
return DashboardMatchAttributeFilterMatchAttributeFilter
Loading
Loading