Skip to content

Commit 4cdcf91

Browse files
feat(model): add to_atlas_dict() method to Referenceable base class
Adds a convenience method that produces an Atlas-compatible dict from any pyatlan model object. This is the format expected by the application-sdk's JsonFileWriter and eliminates the json.loads(asset.json(...)) round-trip that every connector currently has to do manually. (BLDX-740)
1 parent 36b5900 commit 4cdcf91

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

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()

0 commit comments

Comments
 (0)