Skip to content

Commit f6a4ae5

Browse files
committed
[generator] Aligned generator templates with the latest SDK changes for IndistinctAsset fallback model
1 parent 4f99bc0 commit f6a4ae5

File tree

6 files changed

+37
-26
lines changed

6 files changed

+37
-26
lines changed

pyatlan/generator/class_generator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,9 @@ def filter_attributes_of_custom_entity_type():
938938
for file in (ASSETS_DIR).glob("*.py"):
939939
file.unlink()
940940
for file in (CORE_ASSETS_DIR).glob("*.py"):
941+
# Remove all files in the core assets directory except `indistinct.py`
942+
if file.name == "indistinct_asset.py":
943+
continue
941944
file.unlink()
942945
generator = Generator()
943946
EnumDefInfo.create(type_defs.enum_defs)

pyatlan/generator/templates/core/init.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{{ asset_import }}
77
{% endif %}
88
{% endfor %}
9+
from .indistinct_asset import IndistinctAsset # noqa: F401
910

1011
# Update asset forward references:
1112
localns = locals()

pyatlan/generator/templates/init.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ __PYATLAN_ASSETS__ = {
99
"{{ asset.name }}"{% if not loop.last %},{% endif %}
1010
{% endif %}
1111
{% endfor %}
12+
"IndistinctAsset"
1213
],
1314
{% for asset in assets -%}
1415
{% if not asset.is_core_asset and asset.name not in asset._CORE_ASSETS %}

pyatlan/generator/templates/methods/asset/asset.jinja2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104

105105
@classmethod
106106
def _convert_to_real_type_(cls, data):
107+
from .indistinct_asset import IndistinctAsset
108+
107109
"""Convert raw asset data into the appropriate asset type."""
108110
if isinstance(data, Asset):
109111
return data
@@ -123,7 +125,9 @@
123125
sys.modules.get("pyatlan.model.assets", {}), data_type, None
124126
)
125127

126-
return sub_type(**data) if sub_type else None # Gracefully handle missing types
128+
return (
129+
sub_type(**data) if sub_type else IndistinctAsset(**data)
130+
) # If no subtype found, return IndistinctAsset
127131

128132
if TYPE_CHECKING:
129133
from pyatlan.model.lineage import FluentLineage

pyatlan/generator/templates/mypy_init.jinja2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ __all__ = [
1010
{% if not asset.is_core_asset %}
1111
"{{ asset.name }}"{% if not loop.last %},{% endif %}
1212
{% endif %}
13-
{% endfor %}
13+
{% endfor %},
14+
"IndistinctAsset"
1415
]
1516

1617
{% for asset in assets -%}
@@ -20,3 +21,4 @@ from .core.{{ asset.module_name }} import {{ asset.name }}
2021
from .{{ asset.module_name }} import {{ asset.name }}
2122
{% endif %}
2223
{% endfor %}
24+
from .core.indistinct_asset import IndistinctAsset

pyatlan/model/structs.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ def flatten_structs_attributes(cls, values: Dict[str, Any]) -> Dict[str, Any]:
4545
return values
4646

4747

48+
class MCRuleSchedule(AtlanObject):
49+
"""Description"""
50+
51+
mc_rule_schedule_type: Optional[str] = Field(default=None, description="")
52+
mc_rule_schedule_interval_in_minutes: Optional[int] = Field(
53+
default=None, description=""
54+
)
55+
mc_rule_schedule_start_time: Optional[datetime] = Field(
56+
default=None, description=""
57+
)
58+
mc_rule_schedule_crontab: Optional[str] = Field(default=None, description="")
59+
60+
4861
class DbtJobRun(AtlanObject):
4962
"""Description"""
5063

@@ -61,19 +74,6 @@ class DbtJobRun(AtlanObject):
6174
dbt_compiled_code: Optional[str] = Field(default=None, description="")
6275

6376

64-
class MCRuleSchedule(AtlanObject):
65-
"""Description"""
66-
67-
mc_rule_schedule_type: Optional[str] = Field(default=None, description="")
68-
mc_rule_schedule_interval_in_minutes: Optional[int] = Field(
69-
default=None, description=""
70-
)
71-
mc_rule_schedule_start_time: Optional[datetime] = Field(
72-
default=None, description=""
73-
)
74-
mc_rule_schedule_crontab: Optional[str] = Field(default=None, description="")
75-
76-
7777
class AwsCloudWatchMetric(AtlanObject):
7878
"""Description"""
7979

@@ -104,13 +104,6 @@ class ColumnValueFrequencyMap(AtlanObject):
104104
column_value_frequency: Optional[int] = Field(default=None, description="")
105105

106106

107-
class SourceTagAttachmentValue(AtlanObject):
108-
"""Description"""
109-
110-
tag_attachment_key: Optional[str] = Field(default=None, description="")
111-
tag_attachment_value: Optional[str] = Field(default=None, description="")
112-
113-
114107
class BadgeCondition(AtlanObject):
115108
"""Description"""
116109

@@ -143,6 +136,13 @@ def create(
143136
badge_condition_colorhex: Optional[str] = Field(default=None, description="")
144137

145138

139+
class SourceTagAttachmentValue(AtlanObject):
140+
"""Description"""
141+
142+
tag_attachment_key: Optional[str] = Field(default=None, description="")
143+
tag_attachment_value: Optional[str] = Field(default=None, description="")
144+
145+
146146
class StarredDetails(AtlanObject):
147147
"""Description"""
148148

@@ -444,10 +444,10 @@ class SourceTagAttribute(AtlanObject):
444444
)
445445

446446

447-
DbtJobRun.update_forward_refs()
448-
449447
MCRuleSchedule.update_forward_refs()
450448

449+
DbtJobRun.update_forward_refs()
450+
451451
AwsCloudWatchMetric.update_forward_refs()
452452

453453
Histogram.update_forward_refs()
@@ -456,10 +456,10 @@ class SourceTagAttribute(AtlanObject):
456456

457457
ColumnValueFrequencyMap.update_forward_refs()
458458

459-
SourceTagAttachmentValue.update_forward_refs()
460-
461459
BadgeCondition.update_forward_refs()
462460

461+
SourceTagAttachmentValue.update_forward_refs()
462+
463463
StarredDetails.update_forward_refs()
464464

465465
AwsTag.update_forward_refs()

0 commit comments

Comments
 (0)