Skip to content

Commit

Permalink
Merge pull request #176 from atlanhq/DX-289
Browse files Browse the repository at this point in the history
DX-289: Changes the logic for generating Google Data Studio asset qualifiedNames
  • Loading branch information
ErnestoLoma authored Nov 14, 2023
2 parents 47bdf26 + 20692e0 commit e925bc5
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
["name", "connection_qualified_name", "data_studio_asset_type"], [name, connection_qualified_name, data_studio_asset_type]
)
attributes = {{ entity_def.name }}.Attributes.create(
name=name, connection_qualified_name=connection_qualified_name, data_studio_asset_type=data_studio_asset_type
name=name, connection_qualified_name=connection_qualified_name, data_studio_asset_type=data_studio_asset_type, gdsid = str(uuid.uuid4())
)
return cls(attributes=attributes)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@classmethod
# @validate_arguments()
@init_guid
def create(cls, *, name: str, connection_qualified_name: str, data_studio_asset_type: GoogleDatastudioAssetType) -> {{ entity_def.name }}.Attributes:
def create(cls, *, name: str, connection_qualified_name: str, data_studio_asset_type: GoogleDatastudioAssetType, gdsid: str) -> {{ entity_def.name }}.Attributes:
validate_required_fields(
["name", "connection_qualified_name", "data_studio_asset_type"],
[name, connection_qualified_name, data_studio_asset_type]
Expand All @@ -20,7 +20,7 @@

return {{ entity_def.name }}.Attributes(
name=name,
qualified_name=f"{connection_qualified_name}/{name}",
qualified_name=f"{connection_qualified_name}/{gdsid}",
connection_qualified_name=connection_qualified_name,
connector_name=connector_type.value,
data_studio_asset_type=data_studio_asset_type,
Expand Down
27 changes: 27 additions & 0 deletions pyatlan/model/assets/asset02.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from __future__ import annotations

from datetime import datetime
from typing import ClassVar, Optional

from pydantic import Field, validator
Expand Down Expand Up @@ -196,6 +197,12 @@ def __setattr__(self, name, value):
)
"""
"""
VECTOR_EMBEDDINGS_UPDATED_AT: ClassVar[NumericField] = NumericField(
"vectorEmbeddingsUpdatedAt", "vectorEmbeddingsUpdatedAt"
)
"""
"""

_convenience_properties: ClassVar[list[str]] = [
Expand Down Expand Up @@ -225,6 +232,7 @@ def __setattr__(self, name, value):
"use_object_storage",
"object_storage_upload_threshold",
"vector_embeddings_enabled",
"vector_embeddings_updated_at",
]

@property
Expand Down Expand Up @@ -537,6 +545,22 @@ def vector_embeddings_enabled(self, vector_embeddings_enabled: Optional[bool]):
self.attributes = self.Attributes()
self.attributes.vector_embeddings_enabled = vector_embeddings_enabled

@property
def vector_embeddings_updated_at(self) -> Optional[datetime]:
return (
None
if self.attributes is None
else self.attributes.vector_embeddings_updated_at
)

@vector_embeddings_updated_at.setter
def vector_embeddings_updated_at(
self, vector_embeddings_updated_at: Optional[datetime]
):
if self.attributes is None:
self.attributes = self.Attributes()
self.attributes.vector_embeddings_updated_at = vector_embeddings_updated_at

class Attributes(Asset.Attributes):
category: Optional[str] = Field(None, description="", alias="category")
sub_category: Optional[str] = Field(None, description="", alias="subCategory")
Expand Down Expand Up @@ -598,6 +622,9 @@ class Attributes(Asset.Attributes):
vector_embeddings_enabled: Optional[bool] = Field(
None, description="", alias="vectorEmbeddingsEnabled"
)
vector_embeddings_updated_at: Optional[datetime] = Field(
None, description="", alias="vectorEmbeddingsUpdatedAt"
)

is_loaded: bool = Field(default=True)

Expand Down
5 changes: 4 additions & 1 deletion pyatlan/model/assets/asset58.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from __future__ import annotations

import uuid
from typing import ClassVar, Optional

from pydantic import Field, validator
Expand Down Expand Up @@ -43,6 +44,7 @@ def create(
name=name,
connection_qualified_name=connection_qualified_name,
data_studio_asset_type=data_studio_asset_type,
gdsid=str(uuid.uuid4()),
)
return cls(attributes=attributes)

Expand Down Expand Up @@ -331,6 +333,7 @@ def create(
name: str,
connection_qualified_name: str,
data_studio_asset_type: GoogleDatastudioAssetType,
gdsid: str,
) -> DataStudioAsset.Attributes:
validate_required_fields(
["name", "connection_qualified_name", "data_studio_asset_type"],
Expand All @@ -349,7 +352,7 @@ def create(

return DataStudioAsset.Attributes(
name=name,
qualified_name=f"{connection_qualified_name}/{name}",
qualified_name=f"{connection_qualified_name}/{gdsid}",
connection_qualified_name=connection_qualified_name,
connector_name=connector_type.value,
data_studio_asset_type=data_studio_asset_type,
Expand Down
70 changes: 35 additions & 35 deletions pyatlan/model/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class AwsCloudWatchMetric(AtlanObject):
aws_cloud_watch_metric_scope: str = Field(description="")


class Histogram(AtlanObject):
"""Description"""

boundaries: set[float] = Field(description="")
frequencies: set[float] = Field(description="")


class KafkaTopicConsumption(AtlanObject):
"""Description"""

Expand All @@ -40,13 +47,6 @@ class KafkaTopicConsumption(AtlanObject):
topic_current_offset: Optional[int] = Field(None, description="")


class Histogram(AtlanObject):
"""Description"""

boundaries: set[float] = Field(description="")
frequencies: set[float] = Field(description="")


class ColumnValueFrequencyMap(AtlanObject):
"""Description"""

Expand All @@ -61,6 +61,21 @@ class SourceTagAttachmentValue(AtlanObject):
tag_attachment_value: Optional[str] = Field(None, description="")


class SourceTagAttachment(AtlanObject):
"""Description"""

source_tag_name: Optional[str] = Field(None, description="")
source_tag_qualified_name: Optional[str] = Field(None, description="")
source_tag_guid: Optional[str] = Field(None, description="")
source_tag_connector_name: Optional[str] = Field(None, description="")
source_tag_value: Optional[list[SourceTagAttachmentValue]] = Field(
None, description=""
)
is_source_tag_synced: Optional[bool] = Field(None, description="")
source_tag_sync_timestamp: Optional[datetime] = Field(None, description="")
source_tag_sync_error: Optional[str] = Field(None, description="")


class BadgeCondition(AtlanObject):
"""Description"""

Expand Down Expand Up @@ -94,21 +109,6 @@ def create(
badge_condition_colorhex: Optional[str] = Field(None, description="")


class SourceTagAttachment(AtlanObject):
"""Description"""

source_tag_name: Optional[str] = Field(None, description="")
source_tag_qualified_name: Optional[str] = Field(None, description="")
source_tag_guid: Optional[str] = Field(None, description="")
source_tag_connector_name: Optional[str] = Field(None, description="")
source_tag_value: Optional[list[SourceTagAttachmentValue]] = Field(
None, description=""
)
is_source_tag_synced: Optional[bool] = Field(None, description="")
source_tag_sync_timestamp: Optional[datetime] = Field(None, description="")
source_tag_sync_error: Optional[str] = Field(None, description="")


class AzureTag(AtlanObject):
"""Description"""

Expand Down Expand Up @@ -137,13 +137,6 @@ class AwsTag(AtlanObject):
aws_tag_value: str = Field(description="")


class GoogleTag(AtlanObject):
"""Description"""

google_tag_key: str = Field(description="")
google_tag_value: str = Field(description="")


class DbtMetricFilter(AtlanObject):
"""Description"""

Expand All @@ -153,6 +146,13 @@ class DbtMetricFilter(AtlanObject):
dbt_metric_filter_value: Optional[str] = Field(None, description="")


class GoogleTag(AtlanObject):
"""Description"""

google_tag_key: str = Field(description="")
google_tag_value: str = Field(description="")


class AuthPolicyValiditySchedule(AtlanObject):
"""Description"""

Expand Down Expand Up @@ -208,18 +208,18 @@ class SourceTagAttribute(AtlanObject):

AwsCloudWatchMetric.update_forward_refs()

KafkaTopicConsumption.update_forward_refs()

Histogram.update_forward_refs()

KafkaTopicConsumption.update_forward_refs()

ColumnValueFrequencyMap.update_forward_refs()

SourceTagAttachmentValue.update_forward_refs()

BadgeCondition.update_forward_refs()

SourceTagAttachment.update_forward_refs()

BadgeCondition.update_forward_refs()

AzureTag.update_forward_refs()

StarredDetails.update_forward_refs()
Expand All @@ -228,10 +228,10 @@ class SourceTagAttribute(AtlanObject):

AwsTag.update_forward_refs()

GoogleTag.update_forward_refs()

DbtMetricFilter.update_forward_refs()

GoogleTag.update_forward_refs()

AuthPolicyValiditySchedule.update_forward_refs()

MCRuleComparison.update_forward_refs()
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/model/data_studio_asset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_create_report():

assert sut.name == REPORT_NAME
assert sut.connection_qualified_name == DATASTUDIO_CONNECTION_QUALIFIED_NAME
assert sut.qualified_name == QUALIFIED_NAME_REPORT
assert sut.qualified_name
assert sut.connector_name == CONNECTOR_NAME
assert sut.data_studio_asset_type == GoogleDatastudioAssetType.REPORT

Expand All @@ -74,7 +74,7 @@ def test_create_data_source():

assert sut.name == SOURCE_NAME
assert sut.connection_qualified_name == DATASTUDIO_CONNECTION_QUALIFIED_NAME
assert sut.qualified_name == QUALIFIED_NAME_SOURCE
assert sut.qualified_name
assert sut.connector_name == CONNECTOR_NAME
assert sut.data_studio_asset_type == GoogleDatastudioAssetType.DATA_SOURCE

Expand Down Expand Up @@ -121,7 +121,7 @@ def test_trim_to_required_report():
).trim_to_required()

assert sut.name == REPORT_NAME
assert sut.qualified_name == QUALIFIED_NAME_REPORT
assert sut.qualified_name


def test_trim_to_required_data_source():
Expand All @@ -132,4 +132,4 @@ def test_trim_to_required_data_source():
).trim_to_required()

assert sut.name == SOURCE_NAME
assert sut.qualified_name == QUALIFIED_NAME_SOURCE
assert sut.qualified_name

0 comments on commit e925bc5

Please sign in to comment.