Skip to content

Commit eff3d39

Browse files
committed
[generator] Moved creator() method to Asset class and re-ran the generator
1 parent 0423667 commit eff3d39

File tree

10 files changed

+157
-110
lines changed

10 files changed

+157
-110
lines changed

docs/asset/sourcetag.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _sourcetag:
2+
3+
sourceTag
4+
=========
5+
6+
.. module:: pyatlan.model.assets
7+
:no-index:
8+
9+
.. autoclass:: sourceTag
10+
:members:

docs/assets.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,4 @@ You can interact with all of the following different kinds of assets:
318318
asset/view
319319
asset/workflow
320320
asset/workflowrun
321+
asset/sourcetag
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11

22
@classmethod
33
@init_guid
4-
def creator(cls, *, name: str, connection_qualified_name: str) -> AnaplanSystemDimension:
4+
def creator(
5+
cls, *, name: str, connection_qualified_name: str
6+
) -> AnaplanSystemDimension:
57
validate_required_fields(
68
["name", "connection_qualified_name"], [name, connection_qualified_name]
79
)
8-
attributes = AnaplanSystemDimension.Attributes.create(
9-
name=name, connection_qualified_name=connection_qualified_name
10+
attributes = AnaplanSystemDimension.Attributes(
11+
name=name,
12+
qualified_name=f"{connection_qualified_name}/{name}",
13+
connection_qualified_name=connection_qualified_name,
14+
connector_name=AtlanConnectorType.get_connector_name(
15+
connection_qualified_name
16+
),
1017
)
1118
return cls(attributes=attributes)

pyatlan/generator/templates/methods/attribute/anaplan_system_dimension.jinja2

Lines changed: 0 additions & 17 deletions
This file was deleted.

pyatlan/model/assets/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"Column",
6868
"DatabricksUnityCatalogTag",
6969
"SnowflakeStream",
70-
"Database",
7170
"CalculationView",
71+
"Database",
7272
"Procedure",
7373
"SnowflakeTag",
7474
"CosmosMongoDB",
@@ -184,6 +184,7 @@
184184
"a_p_i_object": ["APIObject"],
185185
"a_p_i_path": ["APIPath"],
186186
"a_p_i_field": ["APIField"],
187+
"source_tag": ["sourceTag"],
187188
"data_studio_asset": ["DataStudioAsset"],
188189
"s3_bucket": ["S3Bucket"],
189190
"s3_object": ["S3Object"],

pyatlan/model/assets/__init__.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ __all__ = [
6464
"Column",
6565
"DatabricksUnityCatalogTag",
6666
"SnowflakeStream",
67-
"Database",
6867
"CalculationView",
68+
"Database",
6969
"Procedure",
7070
"SnowflakeTag",
7171
"CosmosMongoDB",
@@ -181,6 +181,7 @@ __all__ = [
181181
"APIObject",
182182
"APIPath",
183183
"APIField",
184+
"sourceTag",
184185
"DataStudioAsset",
185186
"S3Bucket",
186187
"S3Object",
@@ -597,6 +598,7 @@ from .sisense_datamodel import SisenseDatamodel
597598
from .sisense_datamodel_table import SisenseDatamodelTable
598599
from .sisense_folder import SisenseFolder
599600
from .sisense_widget import SisenseWidget
601+
from .source_tag import sourceTag
600602
from .superset import Superset
601603
from .superset_chart import SupersetChart
602604
from .superset_dashboard import SupersetDashboard

pyatlan/model/assets/anaplan_system_dimension.py

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ def creator(
2525
validate_required_fields(
2626
["name", "connection_qualified_name"], [name, connection_qualified_name]
2727
)
28-
attributes = AnaplanSystemDimension.Attributes.create(
29-
name=name, connection_qualified_name=connection_qualified_name
28+
attributes = AnaplanSystemDimension.Attributes(
29+
name=name,
30+
qualified_name=f"{connection_qualified_name}/{name}",
31+
connection_qualified_name=connection_qualified_name,
32+
connector_name=AtlanConnectorType.get_connector_name(
33+
connection_qualified_name
34+
),
3035
)
3136
return cls(attributes=attributes)
3237

@@ -45,33 +50,5 @@ def __setattr__(self, name, value):
4550

4651
_convenience_properties: ClassVar[List[str]] = []
4752

48-
class Attributes(Anaplan.Attributes):
49-
50-
@classmethod
51-
@init_guid
52-
def create(
53-
cls, *, name: str, connection_qualified_name: str
54-
) -> AnaplanSystemDimension.Attributes:
55-
validate_required_fields(
56-
["name", "connection_qualified_name"], [name, connection_qualified_name]
57-
)
58-
return AnaplanSystemDimension.Attributes(
59-
name=name,
60-
qualified_name=f"{connection_qualified_name}/{name}",
61-
connection_qualified_name=connection_qualified_name,
62-
connector_name=AtlanConnectorType.get_connector_name(
63-
connection_qualified_name
64-
),
65-
)
66-
67-
attributes: AnaplanSystemDimension.Attributes = Field(
68-
default_factory=lambda: AnaplanSystemDimension.Attributes(),
69-
description=(
70-
"Map of attributes in the instance and their values. "
71-
"The specific keys of this map will vary by type, "
72-
"so are described in the sub-types of this schema."
73-
),
74-
)
75-
7653

7754
AnaplanSystemDimension.Attributes.update_forward_refs()

pyatlan/model/assets/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@
176176
Column.Attributes.update_forward_refs(**localns)
177177
DatabricksUnityCatalogTag.Attributes.update_forward_refs(**localns)
178178
SnowflakeStream.Attributes.update_forward_refs(**localns)
179-
Database.Attributes.update_forward_refs(**localns)
180179
CalculationView.Attributes.update_forward_refs(**localns)
180+
Database.Attributes.update_forward_refs(**localns)
181181
Procedure.Attributes.update_forward_refs(**localns)
182182
SnowflakeTag.Attributes.update_forward_refs(**localns)
183183
CosmosMongoDB.Attributes.update_forward_refs(**localns)

pyatlan/model/assets/source_tag.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2022 Atlan Pte. Ltd.
3+
4+
5+
from __future__ import annotations
6+
7+
from typing import ClassVar, List, Optional
8+
9+
from pydantic.v1 import Field, validator
10+
11+
from pyatlan.model.fields.atlan_fields import KeywordField
12+
13+
from .core.tag import Tag
14+
15+
16+
class sourceTag(Tag):
17+
"""Description"""
18+
19+
type_name: str = Field(default="sourceTag", allow_mutation=False)
20+
21+
@validator("type_name")
22+
def validate_type_name(cls, v):
23+
if v != "sourceTag":
24+
raise ValueError("must be sourceTag")
25+
return v
26+
27+
def __setattr__(self, name, value):
28+
if name in sourceTag._convenience_properties:
29+
return object.__setattr__(self, name, value)
30+
super().__setattr__(name, value)
31+
32+
CUSTOM_CONFIGURATION: ClassVar[KeywordField] = KeywordField(
33+
"customConfiguration", "customConfiguration"
34+
)
35+
"""
36+
Specifies custom configuration elements based on the system the tag is being sourced from.
37+
"""
38+
39+
_convenience_properties: ClassVar[List[str]] = [
40+
"custom_configuration",
41+
]
42+
43+
@property
44+
def custom_configuration(self) -> Optional[str]:
45+
return None if self.attributes is None else self.attributes.custom_configuration
46+
47+
@custom_configuration.setter
48+
def custom_configuration(self, custom_configuration: Optional[str]):
49+
if self.attributes is None:
50+
self.attributes = self.Attributes()
51+
self.attributes.custom_configuration = custom_configuration
52+
53+
class Attributes(Tag.Attributes):
54+
custom_configuration: Optional[str] = Field(default=None, description="")
55+
56+
attributes: sourceTag.Attributes = Field(
57+
default_factory=lambda: sourceTag.Attributes(),
58+
description=(
59+
"Map of attributes in the instance and their values. "
60+
"The specific keys of this map will vary by type, "
61+
"so are described in the sub-types of this schema."
62+
),
63+
)
64+
65+
66+
sourceTag.Attributes.update_forward_refs()

0 commit comments

Comments
 (0)