Skip to content

Commit b1985f4

Browse files
committed
feat(gooddata-sdk): [AUTO] Add dateTimeSemantics (LOCAL/UTC) field to DataSource schemas
1 parent 1c4dfe4 commit b1985f4

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/declarative_model/data_source.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class CatalogDeclarativeDataSource(Base):
142142
client_id: str | None = None
143143
authentication_type: str | None = None
144144
alternative_data_source_id: str | None = None
145+
date_time_semantics: str | None = None
145146

146147
def to_test_request(
147148
self,

packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/entity_model/data_source.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class CatalogDataSourceBase(Base):
4949
"type",
5050
"schema",
5151
"alternative_data_source_id",
52+
"date_time_semantics",
5253
]
5354

5455
id: str
@@ -61,6 +62,7 @@ class CatalogDataSourceBase(Base):
6162
decoded_parameters: list[dict[str, str]] | None = None
6263
credentials: Credentials = field(repr=False)
6364
alternative_data_source_id: str | None = None
65+
date_time_semantics: str | None = None
6466

6567
@type.validator # type: ignore
6668
def _check_allowed_values(self, attribute: Attribute, value: str) -> None:

packages/gooddata-sdk/tests/catalog/test_catalog_data_source.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,32 @@ def token_from_file_side_effect(file_path: Union[str, Path], base64_encode: bool
667667
# snapshot_data_sources fixture also restores in teardown
668668

669669

670+
@gd_vcr.use_cassette(str(_fixtures_dir / "demo_date_time_semantics.yaml"))
671+
def test_date_time_semantics(test_config: dict, snapshot_data_sources):
672+
sdk = GoodDataSdk.create(host_=test_config["host"], token_=test_config["token"])
673+
data_source_id = test_config["data_source"]
674+
path = _current_dir / "expected" / "declarative_data_sources.json"
675+
credentials_path = _current_dir / "load" / "data_source_credentials" / "data_sources_credentials.yaml"
676+
677+
def token_from_file_side_effect(file_path, base64_encode: bool):
678+
if file_path == "~/home/secrets.json":
679+
return test_config["bigquery_token"]
680+
elif file_path == "databricks-token":
681+
return test_config["databricks_token"]
682+
else:
683+
raise ValueError(f"Unexpected argument: {file_path}")
684+
685+
TokenCredentialsFromFile.token_from_file = MagicMock(side_effect=token_from_file_side_effect)
686+
687+
try:
688+
sdk.catalog_data_source.patch_data_source_attributes(data_source_id, {"date_time_semantics": "LOCAL"})
689+
updated = sdk.catalog_data_source.get_data_source(data_source_id=data_source_id)
690+
assert updated.date_time_semantics == "LOCAL"
691+
finally:
692+
data_sources_o = load_expected_data_sources(path, test_config)
693+
safe_delete(sdk.catalog_data_source.put_declarative_data_sources, data_sources_o, credentials_path)
694+
695+
670696
@gd_vcr.use_cassette(str(_fixtures_dir / "demo_test_scan_model.yaml"))
671697
def test_scan_model(test_config):
672698
sdk = GoodDataSdk.create(host_=test_config["host"], token_=test_config["token"])

0 commit comments

Comments
 (0)