gooddata-sdk 1.79.2.dev1__py3-none-any.whl → 1.80.1.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gooddata_sdk/__init__.py +23 -0
- gooddata_sdk/catalog/base.py +37 -4
- gooddata_sdk/catalog/workspace/aac.py +157 -4
- gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/analytics_model.py +155 -0
- gooddata_sdk/catalog/workspace/entity_model/content_objects/custom_application_setting.py +73 -0
- gooddata_sdk/catalog/workspace/service.py +93 -0
- {gooddata_sdk-1.79.2.dev1.dist-info → gooddata_sdk-1.80.1.dev1.dist-info}/METADATA +5 -5
- {gooddata_sdk-1.79.2.dev1.dist-info → gooddata_sdk-1.80.1.dev1.dist-info}/RECORD +11 -10
- {gooddata_sdk-1.79.2.dev1.dist-info → gooddata_sdk-1.80.1.dev1.dist-info}/WHEEL +0 -0
- {gooddata_sdk-1.79.2.dev1.dist-info → gooddata_sdk-1.80.1.dev1.dist-info}/entry_points.txt +0 -0
- {gooddata_sdk-1.79.2.dev1.dist-info → gooddata_sdk-1.80.1.dev1.dist-info}/licenses/LICENSE.txt +0 -0
gooddata_sdk/__init__.py
CHANGED
|
@@ -232,10 +232,16 @@ if TYPE_CHECKING:
|
|
|
232
232
|
CatalogWorkspaceContentService,
|
|
233
233
|
)
|
|
234
234
|
from gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model import (
|
|
235
|
+
CatalogAbsolutePublisherDocumentPeriod,
|
|
235
236
|
CatalogDeclarativeAnalytics,
|
|
236
237
|
CatalogDeclarativeMemoryItem,
|
|
237
238
|
CatalogDeclarativeMetric,
|
|
238
239
|
CatalogDeclarativeParameter,
|
|
240
|
+
CatalogDeclarativePublisherDocument,
|
|
241
|
+
CatalogDeclarativePublisherDocumentPageTemplate,
|
|
242
|
+
CatalogDeclarativePublisherDocumentTemplate,
|
|
243
|
+
CatalogPublisherDocumentPeriod,
|
|
244
|
+
CatalogRelativePublisherDocumentPeriod,
|
|
239
245
|
)
|
|
240
246
|
from gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.export_definition import (
|
|
241
247
|
CatalogDeclarativeExportDefinition,
|
|
@@ -281,6 +287,9 @@ if TYPE_CHECKING:
|
|
|
281
287
|
CatalogDeclarativeWorkspaceModel,
|
|
282
288
|
CatalogDeclarativeWorkspaces,
|
|
283
289
|
)
|
|
290
|
+
from gooddata_sdk.catalog.workspace.entity_model.content_objects.custom_application_setting import (
|
|
291
|
+
CatalogCustomApplicationSetting,
|
|
292
|
+
)
|
|
284
293
|
from gooddata_sdk.catalog.workspace.entity_model.content_objects.dataset import (
|
|
285
294
|
CatalogAttribute,
|
|
286
295
|
CatalogDataset,
|
|
@@ -389,6 +398,7 @@ _LAZY_IMPORTS: dict[str, str] = {
|
|
|
389
398
|
"CatalogAILakeOperation": "gooddata_sdk.catalog.ai_lake.service",
|
|
390
399
|
"CatalogAILakeOperationError": "gooddata_sdk.catalog.ai_lake.service",
|
|
391
400
|
"CatalogAILakeService": "gooddata_sdk.catalog.ai_lake.service",
|
|
401
|
+
"CatalogAbsolutePublisherDocumentPeriod": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
392
402
|
"CatalogAppearanceService": "gooddata_sdk.catalog.appearance.service",
|
|
393
403
|
"CatalogAssigneeIdentifier": "gooddata_sdk.catalog.identifier",
|
|
394
404
|
"CatalogAssigneeRule": "gooddata_sdk.catalog.rule",
|
|
@@ -404,6 +414,7 @@ _LAZY_IMPORTS: dict[str, str] = {
|
|
|
404
414
|
"CatalogContentSlideTemplate": "gooddata_sdk.catalog.organization.common.slide_template",
|
|
405
415
|
"CatalogCoverSlideTemplate": "gooddata_sdk.catalog.organization.common.slide_template",
|
|
406
416
|
"CatalogCspDirective": "gooddata_sdk.catalog.organization.entity_model.directive",
|
|
417
|
+
"CatalogCustomApplicationSetting": "gooddata_sdk.catalog.workspace.entity_model.content_objects.custom_application_setting",
|
|
407
418
|
"CatalogDashboardAssigneeIdentifier": "gooddata_sdk.catalog.permission.declarative_model.manage_dashboard_permissions",
|
|
408
419
|
"CatalogDashboardPermissions": "gooddata_sdk.catalog.permission.declarative_model.dashboard_permissions",
|
|
409
420
|
"CatalogDashboardSlidesTemplate": "gooddata_sdk.catalog.organization.common.dashboard_slides_template",
|
|
@@ -452,6 +463,9 @@ _LAZY_IMPORTS: dict[str, str] = {
|
|
|
452
463
|
"CatalogDeclarativeNotificationChannel": "gooddata_sdk.catalog.organization.layout.notification_channel",
|
|
453
464
|
"CatalogDeclarativeOrganizationPermission": "gooddata_sdk.catalog.permission.declarative_model.permission",
|
|
454
465
|
"CatalogDeclarativeParameter": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
466
|
+
"CatalogDeclarativePublisherDocument": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
467
|
+
"CatalogDeclarativePublisherDocumentPageTemplate": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
468
|
+
"CatalogDeclarativePublisherDocumentTemplate": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
455
469
|
"CatalogDeclarativeReference": "gooddata_sdk.catalog.workspace.declarative_model.workspace.logical_model.dataset.dataset",
|
|
456
470
|
"CatalogDeclarativeSingleWorkspacePermission": "gooddata_sdk.catalog.permission.declarative_model.permission",
|
|
457
471
|
"CatalogDeclarativeTable": "gooddata_sdk.catalog.data_source.declarative_model.physical_model.table",
|
|
@@ -522,6 +536,8 @@ _LAZY_IMPORTS: dict[str, str] = {
|
|
|
522
536
|
"CatalogPermissionsAssignment": "gooddata_sdk.catalog.user.management_model.management",
|
|
523
537
|
"CatalogPermissionsForAssigneeIdentifier": "gooddata_sdk.catalog.permission.declarative_model.manage_dashboard_permissions",
|
|
524
538
|
"CatalogPermissionsForAssigneeRule": "gooddata_sdk.catalog.permission.declarative_model.manage_dashboard_permissions",
|
|
539
|
+
"CatalogPublisherDocumentPeriod": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
540
|
+
"CatalogRelativePublisherDocumentPeriod": "gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model",
|
|
525
541
|
"CatalogRsaSpecification": "gooddata_sdk.catalog.organization.entity_model.jwk",
|
|
526
542
|
"CatalogRunningSection": "gooddata_sdk.catalog.organization.common.running_section",
|
|
527
543
|
"CatalogScanModelRequest": "gooddata_sdk.catalog.data_source.action_model.requests.scan_model_request",
|
|
@@ -656,6 +672,7 @@ __all__ = [
|
|
|
656
672
|
"CatalogAILakeOperation",
|
|
657
673
|
"CatalogAILakeOperationError",
|
|
658
674
|
"CatalogAILakeService",
|
|
675
|
+
"CatalogAbsolutePublisherDocumentPeriod",
|
|
659
676
|
"CatalogAppearanceService",
|
|
660
677
|
"CatalogAssigneeIdentifier",
|
|
661
678
|
"CatalogAssigneeRule",
|
|
@@ -671,6 +688,7 @@ __all__ = [
|
|
|
671
688
|
"CatalogContentSlideTemplate",
|
|
672
689
|
"CatalogCoverSlideTemplate",
|
|
673
690
|
"CatalogCspDirective",
|
|
691
|
+
"CatalogCustomApplicationSetting",
|
|
674
692
|
"CatalogDashboardAssigneeIdentifier",
|
|
675
693
|
"CatalogDashboardPermissions",
|
|
676
694
|
"CatalogDashboardSlidesTemplate",
|
|
@@ -719,6 +737,9 @@ __all__ = [
|
|
|
719
737
|
"CatalogDeclarativeNotificationChannel",
|
|
720
738
|
"CatalogDeclarativeOrganizationPermission",
|
|
721
739
|
"CatalogDeclarativeParameter",
|
|
740
|
+
"CatalogDeclarativePublisherDocument",
|
|
741
|
+
"CatalogDeclarativePublisherDocumentPageTemplate",
|
|
742
|
+
"CatalogDeclarativePublisherDocumentTemplate",
|
|
722
743
|
"CatalogDeclarativeReference",
|
|
723
744
|
"CatalogDeclarativeSingleWorkspacePermission",
|
|
724
745
|
"CatalogDeclarativeTable",
|
|
@@ -789,6 +810,8 @@ __all__ = [
|
|
|
789
810
|
"CatalogPermissionsAssignment",
|
|
790
811
|
"CatalogPermissionsForAssigneeIdentifier",
|
|
791
812
|
"CatalogPermissionsForAssigneeRule",
|
|
813
|
+
"CatalogPublisherDocumentPeriod",
|
|
814
|
+
"CatalogRelativePublisherDocumentPeriod",
|
|
792
815
|
"CatalogRsaSpecification",
|
|
793
816
|
"CatalogRunningSection",
|
|
794
817
|
"CatalogScanModelRequest",
|
gooddata_sdk/catalog/base.py
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import builtins
|
|
5
|
+
import keyword
|
|
5
6
|
from typing import Any, TypeVar
|
|
6
7
|
|
|
7
|
-
from attrs import Attribute,
|
|
8
|
+
from attrs import Attribute, define, field, fields, has
|
|
8
9
|
from cattrs import structure
|
|
9
10
|
|
|
10
11
|
from gooddata_sdk.utils import AllPagedEntities
|
|
@@ -24,6 +25,17 @@ def value_in_allowed(instance: type[Base], attribute: Attribute, value: str, cli
|
|
|
24
25
|
)
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
def _client_attribute_name(name: str) -> str:
|
|
29
|
+
"""
|
|
30
|
+
Returns the generated client's attribute name for an attrs attribute name.
|
|
31
|
+
|
|
32
|
+
The client prefixes a keyword-named attribute with an underscore (``_from``); attrs code suffixes it (``from_``).
|
|
33
|
+
"""
|
|
34
|
+
if name.endswith("_") and keyword.iskeyword(name[:-1]):
|
|
35
|
+
return f"_{name[:-1]}"
|
|
36
|
+
return name
|
|
37
|
+
|
|
38
|
+
|
|
27
39
|
@define
|
|
28
40
|
class Base:
|
|
29
41
|
@classmethod
|
|
@@ -57,9 +69,30 @@ class Base:
|
|
|
57
69
|
return attribute.name.startswith("_")
|
|
58
70
|
|
|
59
71
|
def _get_snake_dict(self) -> dict[str, Any]:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
"""
|
|
73
|
+
Converts object into a snake_case dictionary keyed by the generated client's attribute names.
|
|
74
|
+
|
|
75
|
+
Attributes that are None or private are left out at every depth. An attribute named after a Python keyword
|
|
76
|
+
plus a trailing underscore (``from_``) is written under the client's name for it (``_from``); keys inside a
|
|
77
|
+
``dict`` value are user data and are never renamed.
|
|
78
|
+
"""
|
|
79
|
+
return self._snake_value(self)
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def _snake_value(cls, value: Any) -> Any:
|
|
83
|
+
if has(type(value)):
|
|
84
|
+
dictionary: dict[str, Any] = {}
|
|
85
|
+
for attribute in fields(type(value)):
|
|
86
|
+
attribute_value = getattr(value, attribute.name)
|
|
87
|
+
if attribute_value is None or cls._is_attribute_private(attribute):
|
|
88
|
+
continue
|
|
89
|
+
dictionary[_client_attribute_name(attribute.name)] = cls._snake_value(attribute_value)
|
|
90
|
+
return dictionary
|
|
91
|
+
if isinstance(value, dict):
|
|
92
|
+
return {key: cls._snake_value(item) for key, item in value.items()}
|
|
93
|
+
if isinstance(value, (list, tuple, set, frozenset)):
|
|
94
|
+
return [cls._snake_value(item) for item in value]
|
|
95
|
+
return value
|
|
63
96
|
|
|
64
97
|
@staticmethod
|
|
65
98
|
def client_class() -> Any:
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
# (C) 2026 GoodData Corporation
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
from collections.abc import Callable
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Any, Literal
|
|
6
7
|
|
|
7
8
|
from gooddata_code_convertors import (
|
|
9
|
+
ConversionError,
|
|
8
10
|
declarative_attribute_hierarchy_to_yaml,
|
|
9
11
|
declarative_dashboard_to_yaml,
|
|
10
12
|
declarative_dataset_to_yaml,
|
|
11
13
|
declarative_date_instance_to_yaml,
|
|
12
14
|
declarative_metric_to_yaml,
|
|
13
15
|
declarative_plugin_to_yaml,
|
|
16
|
+
declarative_publisher_document_template_to_yaml_v2,
|
|
17
|
+
declarative_publisher_document_to_yaml_v2,
|
|
18
|
+
declarative_publisher_page_template_to_yaml_v2,
|
|
14
19
|
declarative_visualisation_to_yaml,
|
|
15
20
|
yaml_attribute_hierarchy_to_declarative,
|
|
16
21
|
yaml_dashboard_to_declarative,
|
|
@@ -18,6 +23,9 @@ from gooddata_code_convertors import (
|
|
|
18
23
|
yaml_date_dataset_to_declarative,
|
|
19
24
|
yaml_metric_to_declarative,
|
|
20
25
|
yaml_plugin_to_declarative,
|
|
26
|
+
yaml_publisher_document_template_to_declarative_v2,
|
|
27
|
+
yaml_publisher_document_to_declarative_v2,
|
|
28
|
+
yaml_publisher_page_template_to_declarative_v2,
|
|
21
29
|
yaml_visualisation_to_declarative,
|
|
22
30
|
)
|
|
23
31
|
|
|
@@ -54,7 +62,20 @@ _VISUALIZATION_TYPES = frozenset(
|
|
|
54
62
|
|
|
55
63
|
# All known AAC type values
|
|
56
64
|
_ALL_AAC_TYPES = (
|
|
57
|
-
frozenset(
|
|
65
|
+
frozenset(
|
|
66
|
+
{
|
|
67
|
+
"dataset",
|
|
68
|
+
"date",
|
|
69
|
+
"metric",
|
|
70
|
+
"dashboard",
|
|
71
|
+
"plugin",
|
|
72
|
+
"attribute_hierarchy",
|
|
73
|
+
"document",
|
|
74
|
+
"document_template",
|
|
75
|
+
"page_template",
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
| _VISUALIZATION_TYPES
|
|
58
79
|
)
|
|
59
80
|
|
|
60
81
|
# Types that are "dataset-like" for the entities array
|
|
@@ -83,6 +104,36 @@ def _build_entities(aac_objects: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
83
104
|
]
|
|
84
105
|
|
|
85
106
|
|
|
107
|
+
# ---------------------------------------------------------------------------
|
|
108
|
+
# Convertor refusal errors (documents, document templates, page templates)
|
|
109
|
+
# ---------------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _convert(
|
|
113
|
+
convert: Callable[[dict[str, Any]], dict[str, Any]],
|
|
114
|
+
aac_type: str,
|
|
115
|
+
obj: dict[str, Any],
|
|
116
|
+
direction: Literal["read", "write"],
|
|
117
|
+
) -> dict[str, Any]:
|
|
118
|
+
"""Run a convertor on one object and name the object when the convertor refuses it.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
convert: The gooddata-code-convertors function to apply to obj.
|
|
122
|
+
aac_type: The AAC type of obj, used to name it in the error.
|
|
123
|
+
obj: The AAC dict when reading from code, the declarative dict when writing as code.
|
|
124
|
+
direction: "read" for AAC to declarative on load, "write" for declarative to AAC on store.
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
ValueError: The convertor refused obj.
|
|
128
|
+
"""
|
|
129
|
+
try:
|
|
130
|
+
return convert(obj)
|
|
131
|
+
except ConversionError as e:
|
|
132
|
+
name = f'{aac_type} "{obj.get("id")}" (version "{obj.get("version")}")'
|
|
133
|
+
action = f"read {name} from code" if direction == "read" else f"write {name} as code"
|
|
134
|
+
raise ValueError(f"Cannot {action}: {e}") from e
|
|
135
|
+
|
|
136
|
+
|
|
86
137
|
# ---------------------------------------------------------------------------
|
|
87
138
|
# Individual object conversions: AAC dict → Declarative dict
|
|
88
139
|
# ---------------------------------------------------------------------------
|
|
@@ -155,6 +206,33 @@ def aac_attribute_hierarchy_to_declarative(aac: dict[str, Any]) -> dict[str, Any
|
|
|
155
206
|
return yaml_attribute_hierarchy_to_declarative(aac)
|
|
156
207
|
|
|
157
208
|
|
|
209
|
+
def aac_document_to_declarative(aac: dict[str, Any]) -> dict[str, Any]:
|
|
210
|
+
"""Convert an AAC document dict to declarative format.
|
|
211
|
+
|
|
212
|
+
Raises:
|
|
213
|
+
ValueError: The convertor refused the document, for example because its version is not "2".
|
|
214
|
+
"""
|
|
215
|
+
return _convert(yaml_publisher_document_to_declarative_v2, "document", aac, "read")
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def aac_document_template_to_declarative(aac: dict[str, Any]) -> dict[str, Any]:
|
|
219
|
+
"""Convert an AAC document template dict to declarative format.
|
|
220
|
+
|
|
221
|
+
Raises:
|
|
222
|
+
ValueError: The convertor refused the document template, for example because its version is not "2".
|
|
223
|
+
"""
|
|
224
|
+
return _convert(yaml_publisher_document_template_to_declarative_v2, "document_template", aac, "read")
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def aac_page_template_to_declarative(aac: dict[str, Any]) -> dict[str, Any]:
|
|
228
|
+
"""Convert an AAC page template dict to declarative format.
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
ValueError: The convertor refused the page template, for example because its version is not "2".
|
|
232
|
+
"""
|
|
233
|
+
return _convert(yaml_publisher_page_template_to_declarative_v2, "page_template", aac, "read")
|
|
234
|
+
|
|
235
|
+
|
|
158
236
|
# ---------------------------------------------------------------------------
|
|
159
237
|
# Individual object conversions: Declarative dict → AAC dict
|
|
160
238
|
# Returns {"json": dict, "content": str}
|
|
@@ -226,6 +304,35 @@ def declarative_attribute_hierarchy_to_aac(declarative: dict[str, Any]) -> dict[
|
|
|
226
304
|
return declarative_attribute_hierarchy_to_yaml(declarative)
|
|
227
305
|
|
|
228
306
|
|
|
307
|
+
def declarative_document_to_aac(declarative: dict[str, Any]) -> dict[str, Any]:
|
|
308
|
+
"""Convert a declarative document dict to AAC format.
|
|
309
|
+
|
|
310
|
+
The AAC form carries no author fields (createdBy, createdAt, modifiedBy, modifiedAt).
|
|
311
|
+
|
|
312
|
+
Raises:
|
|
313
|
+
ValueError: The convertor refused the document, for example because its version is not "2".
|
|
314
|
+
"""
|
|
315
|
+
return _convert(declarative_publisher_document_to_yaml_v2, "document", declarative, "write")
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def declarative_document_template_to_aac(declarative: dict[str, Any]) -> dict[str, Any]:
|
|
319
|
+
"""Convert a declarative document template dict to AAC format.
|
|
320
|
+
|
|
321
|
+
Raises:
|
|
322
|
+
ValueError: The convertor refused the document template, for example because its version is not "2".
|
|
323
|
+
"""
|
|
324
|
+
return _convert(declarative_publisher_document_template_to_yaml_v2, "document_template", declarative, "write")
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def declarative_page_template_to_aac(declarative: dict[str, Any]) -> dict[str, Any]:
|
|
328
|
+
"""Convert a declarative page template dict to AAC format.
|
|
329
|
+
|
|
330
|
+
Raises:
|
|
331
|
+
ValueError: The convertor refused the page template, for example because its version is not "2".
|
|
332
|
+
"""
|
|
333
|
+
return _convert(declarative_publisher_page_template_to_yaml_v2, "page_template", declarative, "write")
|
|
334
|
+
|
|
335
|
+
|
|
229
336
|
# ---------------------------------------------------------------------------
|
|
230
337
|
# Format detection
|
|
231
338
|
# ---------------------------------------------------------------------------
|
|
@@ -245,7 +352,17 @@ def detect_yaml_format(path: Path) -> Literal["aac", "declarative"]:
|
|
|
245
352
|
return "declarative"
|
|
246
353
|
|
|
247
354
|
# Check for AAC markers: typed subdirectories
|
|
248
|
-
aac_subdirs = {
|
|
355
|
+
aac_subdirs = {
|
|
356
|
+
"datasets",
|
|
357
|
+
"metrics",
|
|
358
|
+
"visualisations",
|
|
359
|
+
"dashboards",
|
|
360
|
+
"plugins",
|
|
361
|
+
"attributeHierarchies",
|
|
362
|
+
"documents",
|
|
363
|
+
"documentTemplates",
|
|
364
|
+
"pageTemplates",
|
|
365
|
+
}
|
|
249
366
|
for subdir in aac_subdirs:
|
|
250
367
|
if (path / subdir).is_dir():
|
|
251
368
|
return "aac"
|
|
@@ -319,6 +436,9 @@ def load_aac_workspace_from_disk(
|
|
|
319
436
|
analytical_dashboards: list[dict[str, Any]] = []
|
|
320
437
|
dashboard_plugins: list[dict[str, Any]] = []
|
|
321
438
|
attribute_hierarchies: list[dict[str, Any]] = []
|
|
439
|
+
documents: list[dict[str, Any]] = []
|
|
440
|
+
document_templates: list[dict[str, Any]] = []
|
|
441
|
+
page_templates: list[dict[str, Any]] = []
|
|
322
442
|
|
|
323
443
|
for aac in aac_objects:
|
|
324
444
|
aac_type = aac.get("type")
|
|
@@ -341,6 +461,12 @@ def load_aac_workspace_from_disk(
|
|
|
341
461
|
dashboard_plugins.append(aac_plugin_to_declarative(aac))
|
|
342
462
|
case "attribute_hierarchy":
|
|
343
463
|
attribute_hierarchies.append(aac_attribute_hierarchy_to_declarative(aac))
|
|
464
|
+
case "document":
|
|
465
|
+
documents.append(aac_document_to_declarative(aac))
|
|
466
|
+
case "document_template":
|
|
467
|
+
document_templates.append(aac_document_template_to_declarative(aac))
|
|
468
|
+
case "page_template":
|
|
469
|
+
page_templates.append(aac_page_template_to_declarative(aac))
|
|
344
470
|
case vis_type if vis_type in _VISUALIZATION_TYPES:
|
|
345
471
|
visualization_objects.append(aac_visualization_to_declarative(aac, entities))
|
|
346
472
|
|
|
@@ -365,6 +491,12 @@ def load_aac_workspace_from_disk(
|
|
|
365
491
|
analytics["dashboardPlugins"] = dashboard_plugins
|
|
366
492
|
if attribute_hierarchies:
|
|
367
493
|
analytics["attributeHierarchyObjects"] = attribute_hierarchies
|
|
494
|
+
if documents:
|
|
495
|
+
analytics["documents"] = documents
|
|
496
|
+
if document_templates:
|
|
497
|
+
analytics["documentTemplates"] = document_templates
|
|
498
|
+
if page_templates:
|
|
499
|
+
analytics["pageTemplates"] = page_templates
|
|
368
500
|
if analytics:
|
|
369
501
|
workspace_model_dict["analytics"] = analytics
|
|
370
502
|
|
|
@@ -388,14 +520,26 @@ def store_aac_workspace_to_disk(model: CatalogDeclarativeWorkspaceModel, source_
|
|
|
388
520
|
"""Convert a declarative workspace model to AAC YAML files and write to disk.
|
|
389
521
|
|
|
390
522
|
Creates typed subdirectories (datasets/, metrics/, visualisations/, dashboards/,
|
|
391
|
-
plugins/, attributeHierarchies/)
|
|
523
|
+
plugins/, attributeHierarchies/, documents/, documentTemplates/, pageTemplates/)
|
|
524
|
+
under source_dir.
|
|
525
|
+
|
|
526
|
+
Raises:
|
|
527
|
+
ValueError: The convertor refused a document, document template or page template.
|
|
528
|
+
Nothing is written in that case.
|
|
392
529
|
"""
|
|
393
|
-
source_dir.mkdir(parents=True, exist_ok=True)
|
|
394
530
|
model_dict = model.to_dict(camel_case=True)
|
|
395
531
|
|
|
396
532
|
ldm = model_dict.get("ldm", {})
|
|
397
533
|
analytics = model_dict.get("analytics", {})
|
|
398
534
|
|
|
535
|
+
documents = [(d["id"], declarative_document_to_aac(d)) for d in analytics.get("documents", [])]
|
|
536
|
+
document_templates = [
|
|
537
|
+
(t["id"], declarative_document_template_to_aac(t)) for t in analytics.get("documentTemplates", [])
|
|
538
|
+
]
|
|
539
|
+
page_templates = [(p["id"], declarative_page_template_to_aac(p)) for p in analytics.get("pageTemplates", [])]
|
|
540
|
+
|
|
541
|
+
source_dir.mkdir(parents=True, exist_ok=True)
|
|
542
|
+
|
|
399
543
|
for dataset in ldm.get("datasets", []):
|
|
400
544
|
result = declarative_dataset_to_aac(dataset)
|
|
401
545
|
_write_aac_file(source_dir, "datasets", dataset["id"], result["content"])
|
|
@@ -423,3 +567,12 @@ def store_aac_workspace_to_disk(model: CatalogDeclarativeWorkspaceModel, source_
|
|
|
423
567
|
for hierarchy in analytics.get("attributeHierarchyObjects", []):
|
|
424
568
|
result = declarative_attribute_hierarchy_to_aac(hierarchy)
|
|
425
569
|
_write_aac_file(source_dir, "attributeHierarchies", hierarchy["id"], result["content"])
|
|
570
|
+
|
|
571
|
+
for document_id, result in documents:
|
|
572
|
+
_write_aac_file(source_dir, "documents", document_id, result["content"])
|
|
573
|
+
|
|
574
|
+
for template_id, result in document_templates:
|
|
575
|
+
_write_aac_file(source_dir, "documentTemplates", template_id, result["content"])
|
|
576
|
+
|
|
577
|
+
for page_template_id, result in page_templates:
|
|
578
|
+
_write_aac_file(source_dir, "pageTemplates", page_template_id, result["content"])
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/analytics_model.py
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# (C) 2022 GoodData Corporation
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
import builtins
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Any, Union
|
|
6
7
|
|
|
7
8
|
from attrs import define, field
|
|
8
9
|
from cattrs import global_converter, structure
|
|
10
|
+
from gooddata_api_client.model.absolute_publisher_document_period import AbsolutePublisherDocumentPeriod
|
|
9
11
|
from gooddata_api_client.model.declarative_analytical_dashboard import DeclarativeAnalyticalDashboard
|
|
10
12
|
from gooddata_api_client.model.declarative_analytical_dashboard_extension import DeclarativeAnalyticalDashboardExtension
|
|
11
13
|
from gooddata_api_client.model.declarative_analytics import DeclarativeAnalytics
|
|
@@ -16,7 +18,13 @@ from gooddata_api_client.model.declarative_filter_context import DeclarativeFilt
|
|
|
16
18
|
from gooddata_api_client.model.declarative_memory_item import DeclarativeMemoryItem
|
|
17
19
|
from gooddata_api_client.model.declarative_metric import DeclarativeMetric
|
|
18
20
|
from gooddata_api_client.model.declarative_parameter import DeclarativeParameter
|
|
21
|
+
from gooddata_api_client.model.declarative_publisher_document import DeclarativePublisherDocument
|
|
22
|
+
from gooddata_api_client.model.declarative_publisher_document_page_template import (
|
|
23
|
+
DeclarativePublisherDocumentPageTemplate,
|
|
24
|
+
)
|
|
25
|
+
from gooddata_api_client.model.declarative_publisher_document_template import DeclarativePublisherDocumentTemplate
|
|
19
26
|
from gooddata_api_client.model.declarative_visualization_object import DeclarativeVisualizationObject
|
|
27
|
+
from gooddata_api_client.model.relative_publisher_document_period import RelativePublisherDocumentPeriod
|
|
20
28
|
|
|
21
29
|
from gooddata_sdk.catalog.base import Base
|
|
22
30
|
from gooddata_sdk.catalog.permission.declarative_model.permission import (
|
|
@@ -52,6 +60,9 @@ ATTRIBUTE_HIERARCHY_OBJECTS_DIR = "attribute_hierarchy_objects"
|
|
|
52
60
|
EXPORT_DEFINITION_DIR = "export_definitions"
|
|
53
61
|
MEMORY_ITEMS_DIR = "memory_items"
|
|
54
62
|
PARAMETERS_DIR = "parameters"
|
|
63
|
+
LAYOUT_DOCUMENTS_DIR = "documents"
|
|
64
|
+
LAYOUT_DOCUMENT_TEMPLATES_DIR = "document_templates"
|
|
65
|
+
LAYOUT_PAGE_TEMPLATES_DIR = "page_templates"
|
|
55
66
|
|
|
56
67
|
|
|
57
68
|
@define(kw_only=True)
|
|
@@ -84,6 +95,9 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
84
95
|
export_definitions: list[CatalogDeclarativeExportDefinition] = field(factory=list)
|
|
85
96
|
memory_items: list[CatalogDeclarativeMemoryItem] = field(factory=list)
|
|
86
97
|
parameters: list[CatalogDeclarativeParameter] = field(factory=list)
|
|
98
|
+
documents: list[CatalogDeclarativePublisherDocument] = field(factory=list)
|
|
99
|
+
document_templates: list[CatalogDeclarativePublisherDocumentTemplate] = field(factory=list)
|
|
100
|
+
page_templates: list[CatalogDeclarativePublisherDocumentPageTemplate] = field(factory=list)
|
|
87
101
|
|
|
88
102
|
@staticmethod
|
|
89
103
|
def client_class() -> type[DeclarativeAnalyticsLayer]:
|
|
@@ -155,6 +169,24 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
155
169
|
create_directory(folder)
|
|
156
170
|
return folder
|
|
157
171
|
|
|
172
|
+
@staticmethod
|
|
173
|
+
def get_documents_folder(analytics_model_folder: Path) -> Path:
|
|
174
|
+
folder = analytics_model_folder / LAYOUT_DOCUMENTS_DIR
|
|
175
|
+
create_directory(folder)
|
|
176
|
+
return folder
|
|
177
|
+
|
|
178
|
+
@staticmethod
|
|
179
|
+
def get_document_templates_folder(analytics_model_folder: Path) -> Path:
|
|
180
|
+
folder = analytics_model_folder / LAYOUT_DOCUMENT_TEMPLATES_DIR
|
|
181
|
+
create_directory(folder)
|
|
182
|
+
return folder
|
|
183
|
+
|
|
184
|
+
@staticmethod
|
|
185
|
+
def get_page_templates_folder(analytics_model_folder: Path) -> Path:
|
|
186
|
+
folder = analytics_model_folder / LAYOUT_PAGE_TEMPLATES_DIR
|
|
187
|
+
create_directory(folder)
|
|
188
|
+
return folder
|
|
189
|
+
|
|
158
190
|
def store_to_disk(self, workspace_folder: Path, sort: bool = False) -> None:
|
|
159
191
|
analytics_model_folder = self.get_analytics_model_folder(workspace_folder)
|
|
160
192
|
|
|
@@ -168,6 +200,9 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
168
200
|
export_definition_folder = self.get_export_definition_folder(analytical_dashboards_folder)
|
|
169
201
|
memory_item_folder = self.get_memory_item_folder(analytics_model_folder)
|
|
170
202
|
parameters_folder = self.get_parameters_folder(analytics_model_folder)
|
|
203
|
+
documents_folder = self.get_documents_folder(analytics_model_folder)
|
|
204
|
+
document_templates_folder = self.get_document_templates_folder(analytics_model_folder)
|
|
205
|
+
page_templates_folder = self.get_page_templates_folder(analytics_model_folder)
|
|
171
206
|
|
|
172
207
|
for analytical_dashboard in self.analytical_dashboards:
|
|
173
208
|
analytical_dashboard.store_to_disk(analytical_dashboards_folder, sort=sort)
|
|
@@ -199,6 +234,15 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
199
234
|
for parameter in self.parameters:
|
|
200
235
|
parameter.store_to_disk(parameters_folder, sort=sort)
|
|
201
236
|
|
|
237
|
+
for document in self.documents:
|
|
238
|
+
document.store_to_disk(documents_folder, sort=sort)
|
|
239
|
+
|
|
240
|
+
for document_template in self.document_templates:
|
|
241
|
+
document_template.store_to_disk(document_templates_folder, sort=sort)
|
|
242
|
+
|
|
243
|
+
for page_template in self.page_templates:
|
|
244
|
+
page_template.store_to_disk(page_templates_folder, sort=sort)
|
|
245
|
+
|
|
202
246
|
@classmethod
|
|
203
247
|
def load_from_disk(cls, workspace_folder: Path) -> CatalogDeclarativeAnalyticsLayer:
|
|
204
248
|
analytics_model_folder = cls.get_analytics_model_folder(workspace_folder)
|
|
@@ -212,6 +256,9 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
212
256
|
export_definition_folder = cls.get_export_definition_folder(analytical_dashboards_folder)
|
|
213
257
|
memory_item_folder = cls.get_memory_item_folder(analytics_model_folder)
|
|
214
258
|
parameters_folder = cls.get_parameters_folder(analytics_model_folder)
|
|
259
|
+
documents_folder = cls.get_documents_folder(analytics_model_folder)
|
|
260
|
+
document_templates_folder = cls.get_document_templates_folder(analytics_model_folder)
|
|
261
|
+
page_templates_folder = cls.get_page_templates_folder(analytics_model_folder)
|
|
215
262
|
|
|
216
263
|
analytical_dashboard_files = get_sorted_yaml_files(analytical_dashboards_folder)
|
|
217
264
|
analytical_dashboard_extension_files = get_sorted_yaml_files(analytical_dashboard_extensions_folder)
|
|
@@ -223,6 +270,9 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
223
270
|
export_definition_files = get_sorted_yaml_files(export_definition_folder)
|
|
224
271
|
memory_item_files = get_sorted_yaml_files(memory_item_folder)
|
|
225
272
|
parameter_files = get_sorted_yaml_files(parameters_folder)
|
|
273
|
+
document_files = get_sorted_yaml_files(documents_folder)
|
|
274
|
+
document_template_files = get_sorted_yaml_files(document_templates_folder)
|
|
275
|
+
page_template_files = get_sorted_yaml_files(page_templates_folder)
|
|
226
276
|
|
|
227
277
|
analytical_dashboards = [
|
|
228
278
|
CatalogDeclarativeAnalyticalDashboard.load_from_disk(analytical_dashboard_file)
|
|
@@ -257,6 +307,17 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
257
307
|
CatalogDeclarativeMemoryItem.load_from_disk(memory_item_file) for memory_item_file in memory_item_files
|
|
258
308
|
]
|
|
259
309
|
parameters = [CatalogDeclarativeParameter.load_from_disk(parameter_file) for parameter_file in parameter_files]
|
|
310
|
+
documents = [
|
|
311
|
+
CatalogDeclarativePublisherDocument.load_from_disk(document_file) for document_file in document_files
|
|
312
|
+
]
|
|
313
|
+
document_templates = [
|
|
314
|
+
CatalogDeclarativePublisherDocumentTemplate.load_from_disk(document_template_file)
|
|
315
|
+
for document_template_file in document_template_files
|
|
316
|
+
]
|
|
317
|
+
page_templates = [
|
|
318
|
+
CatalogDeclarativePublisherDocumentPageTemplate.load_from_disk(page_template_file)
|
|
319
|
+
for page_template_file in page_template_files
|
|
320
|
+
]
|
|
260
321
|
return cls(
|
|
261
322
|
analytical_dashboards=analytical_dashboards,
|
|
262
323
|
analytical_dashboard_extensions=analytical_dashboard_extensions,
|
|
@@ -268,6 +329,9 @@ class CatalogDeclarativeAnalyticsLayer(Base):
|
|
|
268
329
|
export_definitions=export_definitions,
|
|
269
330
|
memory_items=memory_items,
|
|
270
331
|
parameters=parameters,
|
|
332
|
+
documents=documents,
|
|
333
|
+
document_templates=document_templates,
|
|
334
|
+
page_templates=page_templates,
|
|
271
335
|
)
|
|
272
336
|
|
|
273
337
|
|
|
@@ -372,3 +436,94 @@ class CatalogDeclarativeParameter(CatalogAnalyticsBase):
|
|
|
372
436
|
@staticmethod
|
|
373
437
|
def client_class() -> type[DeclarativeParameter]:
|
|
374
438
|
return DeclarativeParameter
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
@define(kw_only=True)
|
|
442
|
+
class CatalogAbsolutePublisherDocumentPeriod(Base):
|
|
443
|
+
"""A document period between two calendar dates, both inclusive, given as ISO dates (``2026-01-31``)."""
|
|
444
|
+
|
|
445
|
+
type: str = field(default="absolute", init=False)
|
|
446
|
+
from_: str
|
|
447
|
+
to: str
|
|
448
|
+
# Required by the API but single-valued; the generated client defaults it the same way, and the code form omits it.
|
|
449
|
+
granularity: str = "GDC.time.date"
|
|
450
|
+
|
|
451
|
+
@staticmethod
|
|
452
|
+
def client_class() -> builtins.type[AbsolutePublisherDocumentPeriod]:
|
|
453
|
+
return AbsolutePublisherDocumentPeriod
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
@define(kw_only=True)
|
|
457
|
+
class CatalogRelativePublisherDocumentPeriod(Base):
|
|
458
|
+
"""A document period in units of ``granularity`` relative to the current one (``from_=-1, to=0``)."""
|
|
459
|
+
|
|
460
|
+
type: str = field(default="relative", init=False)
|
|
461
|
+
from_: int
|
|
462
|
+
to: int
|
|
463
|
+
granularity: str
|
|
464
|
+
|
|
465
|
+
@staticmethod
|
|
466
|
+
def client_class() -> builtins.type[RelativePublisherDocumentPeriod]:
|
|
467
|
+
return RelativePublisherDocumentPeriod
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
CatalogPublisherDocumentPeriod = Union[CatalogAbsolutePublisherDocumentPeriod, CatalogRelativePublisherDocumentPeriod]
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
@define(kw_only=True)
|
|
474
|
+
class CatalogDeclarativePublisherDocument(CatalogAnalyticsBaseMeta):
|
|
475
|
+
title: str
|
|
476
|
+
content: dict[str, Any]
|
|
477
|
+
period: CatalogPublisherDocumentPeriod
|
|
478
|
+
version: str
|
|
479
|
+
description: str | None = None
|
|
480
|
+
tags: list[str] | None = None
|
|
481
|
+
|
|
482
|
+
@staticmethod
|
|
483
|
+
def client_class() -> type[DeclarativePublisherDocument]:
|
|
484
|
+
return DeclarativePublisherDocument
|
|
485
|
+
|
|
486
|
+
@staticmethod
|
|
487
|
+
def structure_period(v: dict[str, Any], _: Any) -> CatalogPublisherDocumentPeriod:
|
|
488
|
+
period = dict(v)
|
|
489
|
+
for key in ("_from", "from"):
|
|
490
|
+
if key in period:
|
|
491
|
+
period["from_"] = period.pop(key)
|
|
492
|
+
period_type = period.get("type")
|
|
493
|
+
if period_type == "absolute":
|
|
494
|
+
return structure(period, CatalogAbsolutePublisherDocumentPeriod)
|
|
495
|
+
if period_type == "relative":
|
|
496
|
+
return structure(period, CatalogRelativePublisherDocumentPeriod)
|
|
497
|
+
raise ValueError(f"Unknown publisher document period type {period_type!r}, expected 'absolute' or 'relative'.")
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
global_converter.register_structure_hook(
|
|
501
|
+
CatalogPublisherDocumentPeriod,
|
|
502
|
+
CatalogDeclarativePublisherDocument.structure_period,
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
@define(kw_only=True)
|
|
507
|
+
class CatalogDeclarativePublisherDocumentTemplate(CatalogAnalyticsObjectBase):
|
|
508
|
+
title: str
|
|
509
|
+
content: dict[str, Any]
|
|
510
|
+
version: str
|
|
511
|
+
description: str | None = None
|
|
512
|
+
tags: list[str] | None = None
|
|
513
|
+
|
|
514
|
+
@staticmethod
|
|
515
|
+
def client_class() -> type[DeclarativePublisherDocumentTemplate]:
|
|
516
|
+
return DeclarativePublisherDocumentTemplate
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
@define(kw_only=True)
|
|
520
|
+
class CatalogDeclarativePublisherDocumentPageTemplate(CatalogAnalyticsObjectBase):
|
|
521
|
+
title: str
|
|
522
|
+
content: dict[str, Any]
|
|
523
|
+
version: str
|
|
524
|
+
description: str | None = None
|
|
525
|
+
tags: list[str] | None = None
|
|
526
|
+
|
|
527
|
+
@staticmethod
|
|
528
|
+
def client_class() -> type[DeclarativePublisherDocumentPageTemplate]:
|
|
529
|
+
return DeclarativePublisherDocumentPageTemplate
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# (C) 2026 GoodData Corporation
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Any, Union
|
|
5
|
+
|
|
6
|
+
from attrs import define, field
|
|
7
|
+
from gooddata_api_client.model.json_api_custom_application_setting_in import JsonApiCustomApplicationSettingIn
|
|
8
|
+
from gooddata_api_client.model.json_api_custom_application_setting_in_attributes import (
|
|
9
|
+
JsonApiCustomApplicationSettingInAttributes,
|
|
10
|
+
)
|
|
11
|
+
from gooddata_api_client.model.json_api_custom_application_setting_in_document import (
|
|
12
|
+
JsonApiCustomApplicationSettingInDocument,
|
|
13
|
+
)
|
|
14
|
+
from gooddata_api_client.model.json_api_custom_application_setting_out import JsonApiCustomApplicationSettingOut
|
|
15
|
+
from gooddata_api_client.model.json_api_custom_application_setting_post_optional_id import (
|
|
16
|
+
JsonApiCustomApplicationSettingPostOptionalId,
|
|
17
|
+
)
|
|
18
|
+
from gooddata_api_client.model.json_api_custom_application_setting_post_optional_id_document import (
|
|
19
|
+
JsonApiCustomApplicationSettingPostOptionalIdDocument,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from gooddata_sdk.catalog.base import Base
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@define(kw_only=True)
|
|
26
|
+
class CatalogCustomApplicationSetting(Base):
|
|
27
|
+
"""A workspace setting owned by a custom application.
|
|
28
|
+
|
|
29
|
+
Unlike CatalogWorkspaceSetting, the content is free-form and is scoped by
|
|
30
|
+
`application_name` rather than by a fixed setting type.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
id: str | None = field(default=None)
|
|
34
|
+
application_name: str
|
|
35
|
+
content: dict[str, Any] = field(repr=False)
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def client_class() -> type[JsonApiCustomApplicationSettingOut]:
|
|
39
|
+
return JsonApiCustomApplicationSettingOut
|
|
40
|
+
|
|
41
|
+
def _attributes(self) -> JsonApiCustomApplicationSettingInAttributes:
|
|
42
|
+
return JsonApiCustomApplicationSettingInAttributes(
|
|
43
|
+
application_name=self.application_name,
|
|
44
|
+
content=self.content,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_api(
|
|
48
|
+
self, post: bool = False
|
|
49
|
+
) -> Union[JsonApiCustomApplicationSettingInDocument, JsonApiCustomApplicationSettingPostOptionalIdDocument]:
|
|
50
|
+
if post:
|
|
51
|
+
# The generated model rejects id=None; "optional" means the key is omitted
|
|
52
|
+
# so that the backend generates the id.
|
|
53
|
+
kwargs: dict[str, Any] = {"id": self.id} if self.id is not None else {}
|
|
54
|
+
return JsonApiCustomApplicationSettingPostOptionalIdDocument(
|
|
55
|
+
data=JsonApiCustomApplicationSettingPostOptionalId(attributes=self._attributes(), **kwargs)
|
|
56
|
+
)
|
|
57
|
+
if self.id is None:
|
|
58
|
+
raise ValueError(
|
|
59
|
+
f"The combination for {post=} and {self.id=} is not valid. Id can be None only for post=True."
|
|
60
|
+
)
|
|
61
|
+
return JsonApiCustomApplicationSettingInDocument(
|
|
62
|
+
data=JsonApiCustomApplicationSettingIn(id=self.id, attributes=self._attributes())
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_api(cls, entity: dict[str, Any]) -> CatalogCustomApplicationSetting:
|
|
67
|
+
# Works on a plain dict: list responses are loaded with _check_return_type=False
|
|
68
|
+
# to avoid the composed-schema validation failure on *OutWithLinks items.
|
|
69
|
+
return cls(
|
|
70
|
+
id=entity["id"],
|
|
71
|
+
application_name=entity["attributes"]["applicationName"],
|
|
72
|
+
content=entity["attributes"]["content"],
|
|
73
|
+
)
|
|
@@ -30,6 +30,9 @@ from gooddata_sdk.catalog.workspace.declarative_model.workspace.workspace import
|
|
|
30
30
|
CatalogDeclarativeWorkspaces,
|
|
31
31
|
get_workspace_folder,
|
|
32
32
|
)
|
|
33
|
+
from gooddata_sdk.catalog.workspace.entity_model.content_objects.custom_application_setting import (
|
|
34
|
+
CatalogCustomApplicationSetting,
|
|
35
|
+
)
|
|
33
36
|
from gooddata_sdk.catalog.workspace.entity_model.content_objects.workspace_setting import CatalogWorkspaceSetting
|
|
34
37
|
from gooddata_sdk.catalog.workspace.entity_model.filter_view import (
|
|
35
38
|
CatalogFilterView,
|
|
@@ -204,6 +207,96 @@ class CatalogWorkspaceService(CatalogServiceBase):
|
|
|
204
207
|
workspace_settings = load_all_entities(get_workspace_settings).data
|
|
205
208
|
return [CatalogWorkspaceSetting.from_api(ws) for ws in workspace_settings]
|
|
206
209
|
|
|
210
|
+
def create_or_update_custom_application_setting(
|
|
211
|
+
self, workspace_id: str, custom_application_setting: CatalogCustomApplicationSetting
|
|
212
|
+
) -> UpsertOutcome:
|
|
213
|
+
"""Create a new custom application setting or overwrite an existing one with the same id.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
workspace_id (str):
|
|
217
|
+
ID of workspace where we create the setting
|
|
218
|
+
custom_application_setting (CatalogCustomApplicationSetting):
|
|
219
|
+
Catalog Custom Application Setting object to be created or updated.
|
|
220
|
+
If its id is None, the backend generates one. The generated id is not
|
|
221
|
+
returned or set on the object; use list_custom_application_settings to find it.
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
UpsertOutcome:
|
|
225
|
+
CREATED if the setting did not exist yet, UPDATED if it did.
|
|
226
|
+
"""
|
|
227
|
+
if custom_application_setting.id is None:
|
|
228
|
+
self._entities_api.create_entity_custom_application_settings(
|
|
229
|
+
workspace_id, custom_application_setting.to_api(True)
|
|
230
|
+
)
|
|
231
|
+
return UpsertOutcome.CREATED
|
|
232
|
+
try:
|
|
233
|
+
self.get_custom_application_setting(workspace_id, custom_application_setting.id)
|
|
234
|
+
self._entities_api.update_entity_custom_application_settings(
|
|
235
|
+
workspace_id,
|
|
236
|
+
custom_application_setting.id,
|
|
237
|
+
custom_application_setting.to_api(),
|
|
238
|
+
)
|
|
239
|
+
except NotFoundException:
|
|
240
|
+
self._entities_api.create_entity_custom_application_settings(
|
|
241
|
+
workspace_id, custom_application_setting.to_api(True)
|
|
242
|
+
)
|
|
243
|
+
return UpsertOutcome.CREATED
|
|
244
|
+
return UpsertOutcome.UPDATED
|
|
245
|
+
|
|
246
|
+
def delete_custom_application_setting(self, workspace_id: str, custom_application_setting_id: str) -> None:
|
|
247
|
+
"""Delete a custom application setting. Deleting a setting that does not exist is a no-op.
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
workspace_id (str):
|
|
251
|
+
ID of workspace containing the setting
|
|
252
|
+
custom_application_setting_id (str):
|
|
253
|
+
ID of the setting to delete
|
|
254
|
+
"""
|
|
255
|
+
try:
|
|
256
|
+
self._entities_api.delete_entity_custom_application_settings(workspace_id, custom_application_setting_id)
|
|
257
|
+
except NotFoundException:
|
|
258
|
+
pass
|
|
259
|
+
|
|
260
|
+
def get_custom_application_setting(
|
|
261
|
+
self, workspace_id: str, custom_application_setting_id: str
|
|
262
|
+
) -> CatalogCustomApplicationSetting:
|
|
263
|
+
"""Get a single custom application setting.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
workspace_id (str):
|
|
267
|
+
ID of workspace containing the setting
|
|
268
|
+
custom_application_setting_id (str):
|
|
269
|
+
ID of the setting
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
CatalogCustomApplicationSetting:
|
|
273
|
+
The requested setting.
|
|
274
|
+
"""
|
|
275
|
+
return CatalogCustomApplicationSetting.from_api(
|
|
276
|
+
self._entities_api.get_entity_custom_application_settings(
|
|
277
|
+
workspace_id, custom_application_setting_id, _check_return_type=False
|
|
278
|
+
).data
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
def list_custom_application_settings(self, workspace_id: str) -> list[CatalogCustomApplicationSetting]:
|
|
282
|
+
"""List all custom application settings in a workspace.
|
|
283
|
+
|
|
284
|
+
Args:
|
|
285
|
+
workspace_id (str):
|
|
286
|
+
ID of workspace
|
|
287
|
+
|
|
288
|
+
Returns:
|
|
289
|
+
list[CatalogCustomApplicationSetting]:
|
|
290
|
+
Settings of all custom applications in the workspace.
|
|
291
|
+
"""
|
|
292
|
+
get_custom_application_settings = functools.partial(
|
|
293
|
+
self._entities_api.get_all_entities_custom_application_settings,
|
|
294
|
+
workspace_id,
|
|
295
|
+
_check_return_type=False,
|
|
296
|
+
)
|
|
297
|
+
custom_application_settings = load_all_entities(get_custom_application_settings).data
|
|
298
|
+
return [CatalogCustomApplicationSetting.from_api(cas) for cas in custom_application_settings]
|
|
299
|
+
|
|
207
300
|
def resolve_all_workspace_settings(self, workspace_id: str) -> dict:
|
|
208
301
|
"""Resolve values for all settings in a workspace.
|
|
209
302
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: gooddata-sdk
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.80.1.dev1
|
|
4
4
|
Summary: GoodData Cloud Python SDK
|
|
5
|
-
Project-URL: Documentation, https://www.gooddata.ai/docs/python-sdk/1.
|
|
5
|
+
Project-URL: Documentation, https://www.gooddata.ai/docs/python-sdk/1.80.1.dev1
|
|
6
6
|
Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
|
|
7
7
|
Author-email: GoodData <support@gooddata.com>
|
|
8
8
|
License-Expression: MIT
|
|
@@ -23,8 +23,8 @@ Requires-Python: <4.0,>=3.10
|
|
|
23
23
|
Requires-Dist: attrs<=26.1.0,>=21.4.0
|
|
24
24
|
Requires-Dist: brotli==1.2.1
|
|
25
25
|
Requires-Dist: cattrs<=26.1.0,>=22.1.0
|
|
26
|
-
Requires-Dist: gooddata-api-client~=1.
|
|
27
|
-
Requires-Dist: gooddata-code-convertors>=11.
|
|
26
|
+
Requires-Dist: gooddata-api-client~=1.80.1.dev1
|
|
27
|
+
Requires-Dist: gooddata-code-convertors>=11.66.0
|
|
28
28
|
Requires-Dist: python-dateutil>=2.5.3
|
|
29
29
|
Requires-Dist: python-dotenv<2.0.0,>=1.2.2
|
|
30
30
|
Requires-Dist: pyyaml>=6.0
|
|
@@ -49,7 +49,7 @@ At the moment the SDK provides services to inspect and interact with the Semanti
|
|
|
49
49
|
* Compute Service
|
|
50
50
|
* Table Service
|
|
51
51
|
|
|
52
|
-
See [DOCUMENTATION](https://www.gooddata.ai/docs/python-sdk/1.
|
|
52
|
+
See [DOCUMENTATION](https://www.gooddata.ai/docs/python-sdk/1.80.1.dev1) for more details.
|
|
53
53
|
|
|
54
54
|
## Requirements
|
|
55
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gooddata_sdk/__init__.py,sha256=
|
|
1
|
+
gooddata_sdk/__init__.py,sha256=xpplJjRHxAB3mH5_egIal5wK7QJcGrMVl9B8HC5UziM,49309
|
|
2
2
|
gooddata_sdk/_apis.py,sha256=wPPpqKvhDVlNQZlcV1_PMZtmCKo3DtEn_GcymTeGX5o,872
|
|
3
3
|
gooddata_sdk/_lazy.py,sha256=-1xn1QkBX9txQmNo3ZsVitl6Z5VUqFvAl-dt5nTdYMw,1479
|
|
4
4
|
gooddata_sdk/_models.py,sha256=PBvb1fLE4tNP-eXUnhad5r-1y0-pdYoIER6w5Hm7sD4,7032
|
|
@@ -13,7 +13,7 @@ gooddata_sdk/type_converter.py,sha256=_8-W-fhwvjkU3p6qVWt3vIg3Wd8HnEdTP8X3fQzGx3
|
|
|
13
13
|
gooddata_sdk/utils.py,sha256=IxPEB5VxwLO1ZyFMT7i3y1WFGFt0dKYizwL7xo5-LUc,16639
|
|
14
14
|
gooddata_sdk/visualization.py,sha256=R_eKkFUy_RcytA7MoVYtokcS3-d71jQrPX_ZA_YhEJs,28281
|
|
15
15
|
gooddata_sdk/catalog/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
16
|
-
gooddata_sdk/catalog/base.py,sha256=
|
|
16
|
+
gooddata_sdk/catalog/base.py,sha256=Yq4hYnQw0-NnvX4Tz47ZEYQ0YgSEoFclGtZ1g9tjRGg,5485
|
|
17
17
|
gooddata_sdk/catalog/catalog_service_base.py,sha256=VDCHskNgm66sWWAQ8gYTWB5RiXuNad0roh2EPWUECCU,1478
|
|
18
18
|
gooddata_sdk/catalog/depends_on.py,sha256=aojP4dqabeQbWNakpTmAtwSnBtz25O6B-l4T2bVKtTk,1357
|
|
19
19
|
gooddata_sdk/catalog/entity.py,sha256=Ag8GWxxXZtAly9mbVHiPNtiZVvkNOVbdf5tycRIhF2E,12070
|
|
@@ -95,16 +95,16 @@ gooddata_sdk/catalog/user/entity_model/user_group.py,sha256=blhdm7WtHjlpKpCzhSuE
|
|
|
95
95
|
gooddata_sdk/catalog/user/management_model/__init__.py,sha256=o1wiahJIlTpKdWT1cA3jML1fRgBu9WCF0NqDIMYkvxA,190
|
|
96
96
|
gooddata_sdk/catalog/user/management_model/management.py,sha256=9K_2YKFG6Z8Vxlk_XMe9quXEGIcWOnyCg0rWaiNp7KU,2114
|
|
97
97
|
gooddata_sdk/catalog/workspace/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
98
|
-
gooddata_sdk/catalog/workspace/aac.py,sha256=
|
|
98
|
+
gooddata_sdk/catalog/workspace/aac.py,sha256=TFxGE9nKfr8ttkhsKD1uKHX8fscGYizVtEouKT_FtAs,21801
|
|
99
99
|
gooddata_sdk/catalog/workspace/content_service.py,sha256=d1DsmiK6ZefHqOirPJMKWrvRgzqQgYoNz3y_oAr9Odw,29748
|
|
100
100
|
gooddata_sdk/catalog/workspace/model_container.py,sha256=T4vegS7eaVdF6tWwlI07qaQXMrOkQI5RWZzjzRsaNy4,7371
|
|
101
|
-
gooddata_sdk/catalog/workspace/service.py,sha256=
|
|
101
|
+
gooddata_sdk/catalog/workspace/service.py,sha256=gdu2Ka4qRTuFAZqN8f-QxY5IDpYCMCNtsaV7QN4OVJs,74411
|
|
102
102
|
gooddata_sdk/catalog/workspace/declarative_model/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
103
103
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
104
104
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/automation.py,sha256=PKqi72FRPJwkiiWn6hhv-nPC12dSVO_49IRQp9PM_H4,2447
|
|
105
105
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/workspace.py,sha256=O_j6rmXACcE4QUS2Uc6Ghb1le_qK6QwtH_4D9XMQSG8,18004
|
|
106
106
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
107
|
-
gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/analytics_model.py,sha256=
|
|
107
|
+
gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/analytics_model.py,sha256=_afN56coJC2DLb2pJJwf3FANWQrUnVkTEpUUZVHgzVI,23047
|
|
108
108
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/base.py,sha256=Eks1mZLU-aufoUyoJacdowau2rRdLAuCMvMIQ7VESNE,1347
|
|
109
109
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/analytics_model/export_definition.py,sha256=8BZh_6kMwj6kTMZSDNILyJh0NPJuAD8NWWDLoVk7wqA,1431
|
|
110
110
|
gooddata_sdk/catalog/workspace/declarative_model/workspace/logical_model/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
@@ -121,6 +121,7 @@ gooddata_sdk/catalog/workspace/entity_model/filter_view.py,sha256=msWJzLwd8vmCAi
|
|
|
121
121
|
gooddata_sdk/catalog/workspace/entity_model/user_data_filter.py,sha256=ZyltawvPEoM-q2SIqHHXdY9_ngK_viZcoevwblQWmJg,7714
|
|
122
122
|
gooddata_sdk/catalog/workspace/entity_model/workspace.py,sha256=t9M-Z-b5LDIkB16x81JQAlDuE11hLR_DzVyeLFghzCk,2285
|
|
123
123
|
gooddata_sdk/catalog/workspace/entity_model/content_objects/__init__.py,sha256=EtDhuTegucDrXWu2Wp_wy5KXBZq-S4Nv_EQf7YuBxMk,190
|
|
124
|
+
gooddata_sdk/catalog/workspace/entity_model/content_objects/custom_application_setting.py,sha256=Jrwuxd51-qYUwsGP8Wj-gKKD4kmubFyhdVSi4DHJ_eI,3142
|
|
124
125
|
gooddata_sdk/catalog/workspace/entity_model/content_objects/dataset.py,sha256=iWQKsF9zonPSyP2a1Ny-6y16QhJp9wFHfn5FkeIMh6s,8652
|
|
125
126
|
gooddata_sdk/catalog/workspace/entity_model/content_objects/metric.py,sha256=antAbvR4A_S70jO86AM1QGzrBfkNT5z-SQUI1bENjIc,847
|
|
126
127
|
gooddata_sdk/catalog/workspace/entity_model/content_objects/workspace_setting.py,sha256=mN3S0qnYSZgPDpO_hbtLyWithzhb9fwl1D-xrzs7RV4,2608
|
|
@@ -142,8 +143,8 @@ gooddata_sdk/compute/model/base.py,sha256=ipcmIE28REefBxhnmsACaKcueW4c4njNdA1wXo
|
|
|
142
143
|
gooddata_sdk/compute/model/execution.py,sha256=7oJvKLwUd4NjUGOSN1HLsMZScja5bGsHv6vxJ2o56mU,21490
|
|
143
144
|
gooddata_sdk/compute/model/filter.py,sha256=7SKzJboHwPHAkuEuw1tAioXlK8uZoBdK2o2rwaiBK1Q,32609
|
|
144
145
|
gooddata_sdk/compute/model/metric.py,sha256=lk51dAMEFKKC0pVxiNU3Vl1ujXePR-_XHa0aOYD7Tn4,8430
|
|
145
|
-
gooddata_sdk-1.
|
|
146
|
-
gooddata_sdk-1.
|
|
147
|
-
gooddata_sdk-1.
|
|
148
|
-
gooddata_sdk-1.
|
|
149
|
-
gooddata_sdk-1.
|
|
146
|
+
gooddata_sdk-1.80.1.dev1.dist-info/METADATA,sha256=hxRZobpvcPuUAEiXCrhfqwFmHRlJz7-qCC4mDlb5eRU,3266
|
|
147
|
+
gooddata_sdk-1.80.1.dev1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
148
|
+
gooddata_sdk-1.80.1.dev1.dist-info/entry_points.txt,sha256=qCWXZSFst-ioZA4uMqpuFfnxQVkvmz7wm_tI24_YXHo,55
|
|
149
|
+
gooddata_sdk-1.80.1.dev1.dist-info/licenses/LICENSE.txt,sha256=7SIF-2y4RvjhPUydOEZpgs7MTyURU6JAeELQZmp0J9Q,78443
|
|
150
|
+
gooddata_sdk-1.80.1.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{gooddata_sdk-1.79.2.dev1.dist-info → gooddata_sdk-1.80.1.dev1.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|