6
6
7
7
from datetime import datetime
8
8
from typing import ClassVar , Dict , List , Optional
9
+ from warnings import warn
9
10
10
11
from pydantic .v1 import Field , validator
11
12
12
- from pyatlan .model .enums import TableType
13
+ from pyatlan .model .enums import AtlanConnectorType , TableType
13
14
from pyatlan .model .fields .atlan_fields import (
14
15
BooleanField ,
15
16
KeywordField ,
18
19
RelationField ,
19
20
TextField ,
20
21
)
22
+ from pyatlan .utils import init_guid , validate_required_fields
21
23
22
24
from .table import Table
23
25
24
26
25
27
class DocumentDBCollection (Table ):
26
28
"""Description"""
27
29
30
+ @classmethod
31
+ @init_guid
32
+ def creator (
33
+ cls ,
34
+ * ,
35
+ name : str ,
36
+ database_qualified_name : str ,
37
+ database_name : Optional [str ] = None ,
38
+ connection_qualified_name : Optional [str ] = None ,
39
+ ) -> DocumentDBCollection : #
40
+ validate_required_fields (
41
+ ["name, database_qualified_name" ], [name , database_qualified_name ]
42
+ )
43
+ attributes = DocumentDBCollection .Attributes .create (
44
+ name = name ,
45
+ database_qualified_name = database_qualified_name ,
46
+ database_name = database_name ,
47
+ connection_qualified_name = connection_qualified_name ,
48
+ )
49
+ return cls (attributes = attributes )
50
+
51
+ @classmethod
52
+ @init_guid
53
+ def create (
54
+ cls , * , name : str , connection_qualified_name : str
55
+ ) -> DocumentDBCollection :
56
+ warn (
57
+ (
58
+ "This method is deprecated, please use 'creator' "
59
+ "instead, which offers identical functionality."
60
+ ),
61
+ DeprecationWarning ,
62
+ stacklevel = 2 ,
63
+ )
64
+ return cls .creator (
65
+ name = name , connection_qualified_name = connection_qualified_name
66
+ )
67
+
28
68
type_name : str = Field (default = "DocumentDBCollection" , allow_mutation = False )
29
69
30
70
@validator ("type_name" )
@@ -42,7 +82,7 @@ def __setattr__(self, name, value):
42
82
"documentDBCollectionSubtype" , "documentDBCollectionSubtype"
43
83
)
44
84
"""
45
- Subtype of a DocumentDB collection , for example: Capped, Time Series, etc.
85
+ Subtype of a DocumentDBCollection , for example: Capped, Time Series, etc.
46
86
"""
47
87
DOCUMENT_DB_COLLECTION_IS_CAPPED : ClassVar [BooleanField ] = BooleanField (
48
88
"documentDBCollectionIsCapped" , "documentDBCollectionIsCapped"
@@ -186,6 +226,12 @@ def __setattr__(self, name, value):
186
226
"""
187
227
List of partitions in this table.
188
228
"""
229
+ SYNTHETIC_DATA_URL : ClassVar [KeywordTextField ] = KeywordTextField (
230
+ "syntheticDataUrl" , "syntheticDataUrl" , "syntheticDataUrl.text"
231
+ )
232
+ """
233
+ TBC
234
+ """
189
235
IS_SHARDED : ClassVar [BooleanField ] = BooleanField ("isSharded" , "isSharded" )
190
236
"""
191
237
Whether this table is a sharded table (true) or not (false).
@@ -334,6 +380,12 @@ def __setattr__(self, name, value):
334
380
"""
335
381
Time (epoch) at which this asset was last profiled, in milliseconds.
336
382
"""
383
+ SQL_ASSET_COMMENT : ClassVar [TextField ] = TextField (
384
+ "sqlAssetComment" , "sqlAssetComment"
385
+ )
386
+ """
387
+ Comments added in SAP tables, columns and views to document their purpose and functionality.
388
+ """
337
389
NO_SQL_SCHEMA_DEFINITION : ClassVar [TextField ] = TextField (
338
390
"noSQLSchemaDefinition" , "noSQLSchemaDefinition"
339
391
)
@@ -373,6 +425,7 @@ def __setattr__(self, name, value):
373
425
"partition_strategy" ,
374
426
"partition_count" ,
375
427
"partition_list" ,
428
+ "synthetic_data_url" ,
376
429
"is_sharded" ,
377
430
"table_type" ,
378
431
"iceberg_catalog_name" ,
@@ -399,6 +452,7 @@ def __setattr__(self, name, value):
399
452
"calculation_view_qualified_name" ,
400
453
"is_profiled" ,
401
454
"last_profiled_at" ,
455
+ "sql_asset_comment" ,
402
456
"no_s_q_l_schema_definition" ,
403
457
"document_d_b_database" ,
404
458
]
@@ -767,6 +821,16 @@ def partition_list(self, partition_list: Optional[str]):
767
821
self .attributes = self .Attributes ()
768
822
self .attributes .partition_list = partition_list
769
823
824
+ @property
825
+ def synthetic_data_url (self ) -> Optional [str ]:
826
+ return None if self .attributes is None else self .attributes .synthetic_data_url
827
+
828
+ @synthetic_data_url .setter
829
+ def synthetic_data_url (self , synthetic_data_url : Optional [str ]):
830
+ if self .attributes is None :
831
+ self .attributes = self .Attributes ()
832
+ self .attributes .synthetic_data_url = synthetic_data_url
833
+
770
834
@property
771
835
def is_sharded (self ) -> Optional [bool ]:
772
836
return None if self .attributes is None else self .attributes .is_sharded
@@ -1065,6 +1129,16 @@ def last_profiled_at(self, last_profiled_at: Optional[datetime]):
1065
1129
self .attributes = self .Attributes ()
1066
1130
self .attributes .last_profiled_at = last_profiled_at
1067
1131
1132
+ @property
1133
+ def sql_asset_comment (self ) -> Optional [str ]:
1134
+ return None if self .attributes is None else self .attributes .sql_asset_comment
1135
+
1136
+ @sql_asset_comment .setter
1137
+ def sql_asset_comment (self , sql_asset_comment : Optional [str ]):
1138
+ if self .attributes is None :
1139
+ self .attributes = self .Attributes ()
1140
+ self .attributes .sql_asset_comment = sql_asset_comment
1141
+
1068
1142
@property
1069
1143
def no_s_q_l_schema_definition (self ) -> Optional [str ]:
1070
1144
return (
@@ -1146,6 +1220,7 @@ class Attributes(Table.Attributes):
1146
1220
partition_strategy : Optional [str ] = Field (default = None , description = "" )
1147
1221
partition_count : Optional [int ] = Field (default = None , description = "" )
1148
1222
partition_list : Optional [str ] = Field (default = None , description = "" )
1223
+ synthetic_data_url : Optional [str ] = Field (default = None , description = "" )
1149
1224
is_sharded : Optional [bool ] = Field (default = None , description = "" )
1150
1225
table_type : Optional [TableType ] = Field (default = None , description = "" )
1151
1226
iceberg_catalog_name : Optional [str ] = Field (default = None , description = "" )
@@ -1176,11 +1251,50 @@ class Attributes(Table.Attributes):
1176
1251
)
1177
1252
is_profiled : Optional [bool ] = Field (default = None , description = "" )
1178
1253
last_profiled_at : Optional [datetime ] = Field (default = None , description = "" )
1254
+ sql_asset_comment : Optional [str ] = Field (default = None , description = "" )
1179
1255
no_s_q_l_schema_definition : Optional [str ] = Field (default = None , description = "" )
1180
1256
document_d_b_database : Optional [DocumentDBDatabase ] = Field (
1181
1257
default = None , description = ""
1182
1258
) # relationship
1183
1259
1260
+ @classmethod
1261
+ @init_guid
1262
+ def create (
1263
+ cls ,
1264
+ * ,
1265
+ name : str ,
1266
+ database_qualified_name : str ,
1267
+ database_name : Optional [str ] = None ,
1268
+ connection_qualified_name : Optional [str ] = None ,
1269
+ ) -> DocumentDBCollection .Attributes :
1270
+ validate_required_fields (
1271
+ ["name, database_qualified_name" ], [name , database_qualified_name ]
1272
+ )
1273
+ if connection_qualified_name :
1274
+ connector_name = AtlanConnectorType .get_connector_name (
1275
+ connection_qualified_name
1276
+ )
1277
+ else :
1278
+ connection_qn , connector_name = AtlanConnectorType .get_connector_name (
1279
+ database_qualified_name , "database_qualified_name" , 4
1280
+ )
1281
+
1282
+ fields = database_qualified_name .split ("/" )
1283
+ database_name = database_name or fields [3 ]
1284
+ qualified_name = f"{ database_qualified_name } /{ name } "
1285
+ connection_qualified_name = connection_qualified_name or connection_qn
1286
+ database = DocumentDBDatabase .ref_by_qualified_name (database_qualified_name )
1287
+
1288
+ return DocumentDBCollection .Attributes (
1289
+ name = name ,
1290
+ qualified_name = qualified_name ,
1291
+ database = database ,
1292
+ database_name = database_name ,
1293
+ database_qualified_name = database_qualified_name ,
1294
+ connector_name = connector_name ,
1295
+ connection_qualified_name = connection_qualified_name ,
1296
+ )
1297
+
1184
1298
attributes : DocumentDBCollection .Attributes = Field (
1185
1299
default_factory = lambda : DocumentDBCollection .Attributes (),
1186
1300
description = (
0 commit comments