Skip to content

Commit 7f74700

Browse files
authored
Merge pull request #1006 from hkad98/jkd/inline-filter
feat: add other params for InlineFilter
2 parents acabd7d + e0ab45a commit 7f74700

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

gooddata-sdk/gooddata_sdk/compute/model/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def as_api_model(self) -> OpenApiModel:
7171

7272

7373
class Filter(ExecModelEntity):
74-
def __init__(self) -> None:
74+
def __init__(self, _apply_on_result: Optional[bool] = None) -> None:
7575
super().__init__()
7676

77-
self._apply_on_result = None
77+
self._apply_on_result = _apply_on_result
7878

7979
@property
8080
def apply_on_result(self) -> Union[bool, None]:

gooddata-sdk/gooddata_sdk/compute/model/filter.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from datetime import datetime
55
from importlib.util import find_spec
6-
from typing import Optional, Union
6+
from typing import Any, Optional, Union
77

88
from gooddata_api_client.model.inline_filter_definition_inline import InlineFilterDefinitionInline
99

@@ -510,10 +510,10 @@ def description(self, labels: dict[str, str], format_locale: Optional[str] = Non
510510
class InlineFilter(Filter):
511511
"""Filter using a custom MAQL expression.
512512
513-
Automatically decides, whether to create or update.
513+
Automatically decides, whether to create or update.
514514
515-
Args:
516-
maql (str): The MAQL expression string that defines the filter condition.
515+
Args:
516+
maql (str): The MAQL expression string that defines the filter condition.
517517
518518
Example:
519519
```python
@@ -529,14 +529,22 @@ class InlineFilter(Filter):
529529
```
530530
"""
531531

532-
def __init__(self, maql: str):
533-
super().__init__()
532+
def __init__(
533+
self, maql: str, apply_on_result: Optional[bool] = None, local_identifier: Optional[Union[ObjId, str]] = None
534+
) -> None:
535+
super().__init__(apply_on_result)
534536

535537
self.maql = maql
538+
self.local_identifier = local_identifier
536539

537540
def is_noop(self) -> bool:
538541
return False
539542

540543
def as_api_model(self) -> afm_models.InlineFilterDefinition:
541-
body = InlineFilterDefinitionInline(self.maql)
544+
kwargs: dict[str, Any] = {}
545+
if self.apply_on_result is not None:
546+
kwargs["apply_on_result"] = self.apply_on_result
547+
if self.local_identifier is not None:
548+
kwargs["local_identifier"] = str(self.local_identifier)
549+
body = InlineFilterDefinitionInline(self.maql, **kwargs)
542550
return afm_models.InlineFilterDefinition(body, _check_type=False)

0 commit comments

Comments
 (0)