33# Based on original code from https://github.com/apache/atlas (under Apache-2.0 license)
44from __future__ import annotations
55
6- import sys
7- from io import StringIO
86import hashlib
7+ import sys
98from datetime import datetime
9+ from io import StringIO
1010from typing import Any, ClassVar, Dict, List, Optional, TypeVar
11+ from urllib.parse import quote, unquote
1112
1213from pydantic import Field, StrictStr, root_validator, validator
1314
1415from pyatlan.model.core import (
1516 Announcement,
1617 AtlanObject,
17- CustomMetadata,
1818 Classification,
19+ CustomMetadata,
1920 Meaning,
2021)
2122from pyatlan.model.enums import (
@@ -34,16 +35,17 @@ from pyatlan.model.enums import (
3435 AtlanConnectorType,
3536 CertificateStatus,
3637 EntityStatus,
38+ FileType,
39+ GoogleDatastudioAssetType,
3740 IconType,
3841 KafkaTopicCompressionType,
39- QuickSightFolderType ,
40- QuickSightDatasetFieldType ,
42+ PowerbiEndorsement ,
43+ QueryUsernameStrategy ,
4144 QuickSightAnalysisStatus,
45+ QuickSightDatasetFieldType,
4246 QuickSightDatasetImportMode,
43- QueryUsernameStrategy ,
47+ QuickSightFolderType ,
4448 SourceCostUnitType,
45- GoogleDatastudioAssetType,
46- PowerbiEndorsement,
4749)
4850from pyatlan.model.internal import AtlasServer, Internal
4951from pyatlan.model.structs import (
@@ -62,7 +64,7 @@ from pyatlan.model.structs import (
6264 SourceTagAttribute,
6365)
6466from pyatlan.utils import next_id, validate_required_fields
65- from urllib.parse import quote, unquote
67+
6668
6769
6870def validate_single_required_field(field_names: list[str], values: list[Any]):
@@ -87,26 +89,14 @@ class {{ entity_def.name }}({{super_classes[0]}} {%- if "Asset" in super_classes
8789{% if entity_def .name == "Referenceable" %}
8890 def __init__(__pydantic_self__, **data:Any)->None:
8991 super().__init__(**data)
90- __pydantic_self__.__fields_set__.add(' type_name' )
92+ __pydantic_self__.__fields_set__.update(["attributes", " type_name"] )
9193{% endif %}
9294 def __setattr__(self, name, value):
9395 if name in {{ entity_def.name }}._convience_properties:
9496 return object.__setattr__(self, name, value)
9597 super().__setattr__( name, value)
9698
97- {{ gen_properties(entity_def.attribute_defs, ["terms"] ) }}
98-
99- @property
100- def terms(self) -> list[AtlasGlossaryTerm]:
101- if self.attributes is None:
102- self.attributes = self.Attributes()
103- return [] if self.attributes.meanings is None else self.attributes.meanings
104-
105- @terms.setter
106- def terms(self, terms: list[AtlasGlossaryTerm]):
107- if self.attributes is None:
108- self.attributes = self.Attributes()
109- self.attributes.meanings = terms
99+ {{ gen_properties(entity_def.attribute_defs + entity_def.relationship_attribute_defs) }}
110100
111101{% - if entity_def .name == "Referenceable" %}
112102
@@ -125,7 +115,7 @@ class {{ entity_def.name }}({{super_classes[0]}} {%- if "Asset" in super_classes
125115 pass
126116
127117 attributes: '{{entity_def.name}}.Attributes' = Field(
128- None ,
118+ default_factory = lambda : {{entity_def.name}}.Attributes() ,
129119 description='Map of attributes in the instance and their values. The specific keys of this map will vary '
130120 'by type, so are described in the sub-types of this schema.\n',
131121 )
@@ -209,7 +199,7 @@ class {{ entity_def.name }}({{super_classes[0]}} {%- if "Asset" in super_classes
209199 description="Status of the relationship (when this is a related entity).\n",
210200 )
211201 meaning_names: Optional[list[str]] = Field(
212- None, description="Names of terms that have been linked to this asset."
202+ None, description="Names of assigned_terms that have been linked to this asset."
213203 )
214204 meanings: Optional[list[Meaning]] = Field(
215205 None, description="", alias="meanings"
@@ -814,7 +804,7 @@ class {{ entity_def.name }}({{super_classes[0]}} {%- if "Asset" in super_classes
814804 )
815805 {% - endif %}
816806 attributes: '{{entity_def.name}}.Attributes' = Field(
817- None ,
807+ default_factory = lambda: {{entity_def.name}}.Attributes() ,
818808 description='Map of attributes in the instance and their values. The specific keys of this map will vary by '
819809 'type, so are described in the sub-types of this schema.\n',
820810 )
0 commit comments