Skip to content
Merged
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
4 changes: 2 additions & 2 deletions gooddata-sdk/gooddata_sdk/compute/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ def as_api_model(self) -> OpenApiModel:


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

self._apply_on_result = None
self._apply_on_result = _apply_on_result

@property
def apply_on_result(self) -> Union[bool, None]:
Expand Down
22 changes: 15 additions & 7 deletions gooddata-sdk/gooddata_sdk/compute/model/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from datetime import datetime
from importlib.util import find_spec
from typing import Optional, Union
from typing import Any, Optional, Union

from gooddata_api_client.model.inline_filter_definition_inline import InlineFilterDefinitionInline

Expand Down Expand Up @@ -510,10 +510,10 @@ def description(self, labels: dict[str, str], format_locale: Optional[str] = Non
class InlineFilter(Filter):
"""Filter using a custom MAQL expression.

Automatically decides, whether to create or update.
Automatically decides, whether to create or update.

Args:
maql (str): The MAQL expression string that defines the filter condition.
Args:
maql (str): The MAQL expression string that defines the filter condition.

Example:
```python
Expand All @@ -529,14 +529,22 @@ class InlineFilter(Filter):
```
"""

def __init__(self, maql: str):
super().__init__()
def __init__(
self, maql: str, apply_on_result: Optional[bool] = None, local_identifier: Optional[Union[ObjId, str]] = None
) -> None:
super().__init__(apply_on_result)

self.maql = maql
self.local_identifier = local_identifier

def is_noop(self) -> bool:
return False

def as_api_model(self) -> afm_models.InlineFilterDefinition:
body = InlineFilterDefinitionInline(self.maql)
kwargs: dict[str, Any] = {}
if self.apply_on_result is not None:
kwargs["apply_on_result"] = self.apply_on_result
if self.local_identifier is not None:
kwargs["local_identifier"] = str(self.local_identifier)
body = InlineFilterDefinitionInline(self.maql, **kwargs)
return afm_models.InlineFilterDefinition(body, _check_type=False)
Loading