Skip to content

Commit

Permalink
Merge pull request #475 from atlanhq/custom-typedef
Browse files Browse the repository at this point in the history
CXD-379 | Support for `Custom` typedefs
  • Loading branch information
Aryamanz29 authored Jan 13, 2025
2 parents dcba052 + b5a90a0 commit 3eb3fc7
Show file tree
Hide file tree
Showing 20 changed files with 764 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/asset/customentity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _customentity:

CustomEntity
============

.. module:: pyatlan.model.assets
:no-index:

.. autoclass:: CustomEntity
:members:
10 changes: 10 additions & 0 deletions docs/asset/powerbidataflowentitycolumn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _powerbidataflowentitycolumn:

PowerBIDataflowEntityColumn
===========================

.. module:: pyatlan.model.assets
:no-index:

.. autoclass:: PowerBIDataflowEntityColumn
:members:
3 changes: 3 additions & 0 deletions docs/assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ You can interact with all of the following different kinds of assets:
asset/cubedimension
asset/cubefield
asset/cubehierarchy
asset/custom
asset/customentity
asset/datacontract
asset/datadomain
asset/datamesh
Expand Down Expand Up @@ -204,6 +206,7 @@ You can interact with all of the following different kinds of assets:
asset/powerbicolumn
asset/powerbidashboard
asset/powerbidataflow
asset/powerbidataflowentitycolumn
asset/powerbidataset
asset/powerbidatasource
asset/powerbimeasure
Expand Down
11 changes: 11 additions & 0 deletions pyatlan/generator/templates/methods/asset/custom_entity.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

@classmethod
@init_guid
def creator(cls, *, name: str, connection_qualified_name: str) -> CustomEntity:
validate_required_fields(
["name", "connection_qualified_name"], [name, connection_qualified_name]
)
attributes = CustomEntity.Attributes.creator(
name=name, connection_qualified_name=connection_qualified_name
)
return cls(attributes=attributes)
17 changes: 17 additions & 0 deletions pyatlan/generator/templates/methods/attribute/custom_entity.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

@classmethod
@init_guid
def creator(
cls, *, name: str, connection_qualified_name: str
) -> CustomEntity.Attributes:
validate_required_fields(
["name", "connection_qualified_name"], [name, connection_qualified_name]
)
return CustomEntity.Attributes(
name=name,
qualified_name=f"{connection_qualified_name}/{name}",
connection_qualified_name=connection_qualified_name,
connector_name=AtlanConnectorType.get_connector_name(
connection_qualified_name
),
)
3 changes: 3 additions & 0 deletions pyatlan/model/assets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"PowerBIDashboard",
"PowerBIDataflow",
"PowerBIPage",
"PowerBIDataflowEntityColumn",
"SnowflakeDynamicTable",
"MongoDBCollection",
"DynamoDBSecondaryIndex",
Expand Down Expand Up @@ -133,6 +134,7 @@
"object_store": ["ObjectStore"],
"saa_s": ["SaaS"],
"multi_dimensional_dataset": ["MultiDimensionalDataset"],
"custom": ["Custom"],
"event_store": ["EventStore"],
"insight": ["Insight"],
"a_p_i": ["API"],
Expand Down Expand Up @@ -169,6 +171,7 @@
"cube_hierarchy": ["CubeHierarchy"],
"cube_field": ["CubeField"],
"cube_dimension": ["CubeDimension"],
"custom_entity": ["CustomEntity"],
"bigquery_tag": ["BigqueryTag"],
"kafka": ["Kafka"],
"azure_service_bus": ["AzureServiceBus"],
Expand Down
6 changes: 6 additions & 0 deletions pyatlan/model/assets/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ __all__ = [
"PowerBIDashboard",
"PowerBIDataflow",
"PowerBIPage",
"PowerBIDataflowEntityColumn",
"SnowflakeDynamicTable",
"MongoDBCollection",
"DynamoDBSecondaryIndex",
Expand Down Expand Up @@ -129,6 +130,7 @@ __all__ = [
"ObjectStore",
"SaaS",
"MultiDimensionalDataset",
"Custom",
"EventStore",
"NoSQL",
"Insight",
Expand Down Expand Up @@ -166,6 +168,7 @@ __all__ = [
"CubeHierarchy",
"CubeField",
"CubeDimension",
"CustomEntity",
"BigqueryTag",
"Kafka",
"AzureServiceBus",
Expand Down Expand Up @@ -438,6 +441,7 @@ from .core.power_b_i import PowerBI
from .core.power_b_i_column import PowerBIColumn
from .core.power_b_i_dashboard import PowerBIDashboard
from .core.power_b_i_dataflow import PowerBIDataflow
from .core.power_b_i_dataflow_entity_column import PowerBIDataflowEntityColumn
from .core.power_b_i_dataset import PowerBIDataset
from .core.power_b_i_datasource import PowerBIDatasource
from .core.power_b_i_measure import PowerBIMeasure
Expand Down Expand Up @@ -474,6 +478,8 @@ from .cube import Cube
from .cube_dimension import CubeDimension
from .cube_field import CubeField
from .cube_hierarchy import CubeHierarchy
from .custom import Custom
from .custom_entity import CustomEntity
from .data_set import DataSet
from .data_studio import DataStudio
from .data_studio_asset import DataStudioAsset
Expand Down
2 changes: 2 additions & 0 deletions pyatlan/model/assets/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
from .power_b_i_column import PowerBIColumn
from .power_b_i_dashboard import PowerBIDashboard
from .power_b_i_dataflow import PowerBIDataflow
from .power_b_i_dataflow_entity_column import PowerBIDataflowEntityColumn
from .power_b_i_dataset import PowerBIDataset
from .power_b_i_datasource import PowerBIDatasource
from .power_b_i_measure import PowerBIMeasure
Expand Down Expand Up @@ -211,6 +212,7 @@
PowerBIDashboard.Attributes.update_forward_refs(**localns)
PowerBIDataflow.Attributes.update_forward_refs(**localns)
PowerBIPage.Attributes.update_forward_refs(**localns)
PowerBIDataflowEntityColumn.Attributes.update_forward_refs(**localns)
SnowflakeDynamicTable.Attributes.update_forward_refs(**localns)
MongoDBCollection.Attributes.update_forward_refs(**localns)
DynamoDBSecondaryIndex.Attributes.update_forward_refs(**localns)
Expand Down
57 changes: 57 additions & 0 deletions pyatlan/model/assets/core/power_b_i_dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,20 @@ def __setattr__(self, name, value):
"""
TBC
"""
POWER_BI_DATAFLOW_ENTITY_COLUMNS: ClassVar[RelationField] = RelationField(
"powerBIDataflowEntityColumns"
)
"""
TBC
"""
TABLES: ClassVar[RelationField] = RelationField("tables")
"""
TBC
"""
POWER_BI_DATASOURCES: ClassVar[RelationField] = RelationField("powerBIDatasources")
"""
TBC
"""
POWER_BI_DATAFLOW_CHILDREN: ClassVar[RelationField] = RelationField(
"powerBIDataflowChildren"
)
Expand All @@ -98,7 +108,9 @@ def __setattr__(self, name, value):
"workspace",
"power_b_i_processes",
"datasets",
"power_b_i_dataflow_entity_columns",
"tables",
"power_b_i_datasources",
"power_b_i_dataflow_children",
"power_b_i_dataflow_parents",
]
Expand Down Expand Up @@ -211,6 +223,27 @@ def datasets(self, datasets: Optional[List[PowerBIDataset]]):
self.attributes = self.Attributes()
self.attributes.datasets = datasets

@property
def power_b_i_dataflow_entity_columns(
self,
) -> Optional[List[PowerBIDataflowEntityColumn]]:
return (
None
if self.attributes is None
else self.attributes.power_b_i_dataflow_entity_columns
)

@power_b_i_dataflow_entity_columns.setter
def power_b_i_dataflow_entity_columns(
self,
power_b_i_dataflow_entity_columns: Optional[List[PowerBIDataflowEntityColumn]],
):
if self.attributes is None:
self.attributes = self.Attributes()
self.attributes.power_b_i_dataflow_entity_columns = (
power_b_i_dataflow_entity_columns
)

@property
def tables(self) -> Optional[List[PowerBITable]]:
return None if self.attributes is None else self.attributes.tables
Expand All @@ -221,6 +254,20 @@ def tables(self, tables: Optional[List[PowerBITable]]):
self.attributes = self.Attributes()
self.attributes.tables = tables

@property
def power_b_i_datasources(self) -> Optional[List[PowerBIDatasource]]:
return (
None if self.attributes is None else self.attributes.power_b_i_datasources
)

@power_b_i_datasources.setter
def power_b_i_datasources(
self, power_b_i_datasources: Optional[List[PowerBIDatasource]]
):
if self.attributes is None:
self.attributes = self.Attributes()
self.attributes.power_b_i_datasources = power_b_i_datasources

@property
def power_b_i_dataflow_children(self) -> Optional[List[PowerBIDataflow]]:
return (
Expand Down Expand Up @@ -274,9 +321,17 @@ class Attributes(PowerBI.Attributes):
datasets: Optional[List[PowerBIDataset]] = Field(
default=None, description=""
) # relationship
power_b_i_dataflow_entity_columns: Optional[
List[PowerBIDataflowEntityColumn]
] = Field(
default=None, description=""
) # relationship
tables: Optional[List[PowerBITable]] = Field(
default=None, description=""
) # relationship
power_b_i_datasources: Optional[List[PowerBIDatasource]] = Field(
default=None, description=""
) # relationship
power_b_i_dataflow_children: Optional[List[PowerBIDataflow]] = Field(
default=None, description=""
) # relationship
Expand All @@ -294,7 +349,9 @@ class Attributes(PowerBI.Attributes):
)


from .power_b_i_dataflow_entity_column import PowerBIDataflowEntityColumn # noqa
from .power_b_i_dataset import PowerBIDataset # noqa
from .power_b_i_datasource import PowerBIDatasource # noqa
from .power_b_i_table import PowerBITable # noqa
from .power_b_i_workspace import PowerBIWorkspace # noqa
from .process import Process # noqa
Loading

0 comments on commit 3eb3fc7

Please sign in to comment.