Skip to content

Commit 3aebb28

Browse files
authored
Merge pull request #862 from atlanhq/feat/add-to-atlas-dict-method
feat(model): add to_atlas_dict + mode_report on ModeChart
2 parents 36b5900 + f939f74 commit 3aebb28

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

pyatlan/generator/templates/referenceable_methods.jinja2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@
5858
self.business_attributes = business_attrs
5959
return super().json(**kwargs)
6060

61+
def to_atlas_dict(self) -> "Dict[str, Any]":
62+
"""Return an Atlas-compatible dict for use with application-sdk JsonFileWriter.
63+
64+
Produces the standard Atlas entity format with camelCase keys and no None values::
65+
66+
{"typeName": "...", "attributes": {"qualifiedName": "...", ...}}
67+
"""
68+
return loads(self.json(by_alias=True, exclude_none=True))
69+
6170
def validate_required(self):
6271
if not self.create_time or self.created_by:
6372
self.attributes.validate_required()

pyatlan/model/assets/core/referenceable.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ async def json_async(self, *args, **kwargs) -> str:
9292
self.business_attributes = business_attrs
9393
return super().json(**kwargs)
9494

95+
def to_atlas_dict(self) -> "Dict[str, Any]":
96+
"""Return an Atlas-compatible dict for use with application-sdk JsonFileWriter.
97+
98+
Produces the standard Atlas entity format with camelCase keys and no None values::
99+
100+
{"typeName": "...", "attributes": {"qualifiedName": "...", ...}}
101+
"""
102+
return loads(self.json(by_alias=True, exclude_none=True))
103+
95104
def validate_required(self):
96105
if not self.create_time or self.created_by:
97106
self.attributes.validate_required()

pyatlan/model/assets/mode_chart.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ def __setattr__(self, name, value):
4141
TBC
4242
"""
4343

44+
MODE_REPORT: ClassVar[RelationField] = RelationField("modeReport")
45+
"""
46+
Report to which this chart belongs.
47+
"""
48+
4449
_convenience_properties: ClassVar[List[str]] = [
4550
"mode_chart_type",
4651
"mode_query",
52+
"mode_report",
4753
]
4854

4955
@property
@@ -66,11 +72,24 @@ def mode_query(self, mode_query: Optional[ModeQuery]):
6672
self.attributes = self.Attributes()
6773
self.attributes.mode_query = mode_query
6874

75+
@property
76+
def mode_report(self) -> Optional[ModeReport]:
77+
return None if self.attributes is None else self.attributes.mode_report
78+
79+
@mode_report.setter
80+
def mode_report(self, mode_report: Optional[ModeReport]):
81+
if self.attributes is None:
82+
self.attributes = self.Attributes()
83+
self.attributes.mode_report = mode_report
84+
6985
class Attributes(Mode.Attributes):
7086
mode_chart_type: Optional[str] = Field(default=None, description="")
7187
mode_query: Optional[ModeQuery] = Field(
7288
default=None, description=""
7389
) # relationship
90+
mode_report: Optional[ModeReport] = Field(
91+
default=None, description=""
92+
) # relationship
7493

7594
attributes: ModeChart.Attributes = Field(
7695
default_factory=lambda: ModeChart.Attributes(),
@@ -83,5 +102,6 @@ class Attributes(Mode.Attributes):
83102

84103

85104
from .mode_query import ModeQuery # noqa: E402, F401
105+
from .mode_report import ModeReport # noqa: E402, F401
86106

87107
ModeChart.Attributes.update_forward_refs()

0 commit comments

Comments
 (0)