File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
experimental/python/databricks/bundles/schemas Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 11__all__ = [
2+ "Lifecycle" ,
3+ "LifecycleDict" ,
4+ "LifecycleParam" ,
25 "Schema" ,
36 "SchemaDict" ,
47 "SchemaGrant" ,
1013]
1114
1215
16+ from databricks .bundles .schemas ._models .lifecycle import (
17+ Lifecycle ,
18+ LifecycleDict ,
19+ LifecycleParam ,
20+ )
1321from databricks .bundles .schemas ._models .schema import Schema , SchemaDict , SchemaParam
1422from databricks .bundles .schemas ._models .schema_grant import (
1523 SchemaGrant ,
Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
2+ from typing import TYPE_CHECKING , TypedDict
3+
4+ from databricks .bundles .core ._transform import _transform
5+ from databricks .bundles .core ._transform_to_json import _transform_to_json_value
6+ from databricks .bundles .core ._variable import VariableOrOptional
7+
8+ if TYPE_CHECKING :
9+ from typing_extensions import Self
10+
11+
12+ @dataclass (kw_only = True )
13+ class Lifecycle :
14+ """"""
15+
16+ prevent_destroy : VariableOrOptional [bool ] = None
17+
18+ @classmethod
19+ def from_dict (cls , value : "LifecycleDict" ) -> "Self" :
20+ return _transform (cls , value )
21+
22+ def as_dict (self ) -> "LifecycleDict" :
23+ return _transform_to_json_value (self ) # type:ignore
24+
25+
26+ class LifecycleDict (TypedDict , total = False ):
27+ """"""
28+
29+ prevent_destroy : VariableOrOptional [bool ]
30+
31+
32+ LifecycleParam = LifecycleDict | Lifecycle
Original file line number Diff line number Diff line change 1010 VariableOrList ,
1111 VariableOrOptional ,
1212)
13+ from databricks .bundles .schemas ._models .lifecycle import Lifecycle , LifecycleParam
1314from databricks .bundles .schemas ._models .schema_grant import (
1415 SchemaGrant ,
1516 SchemaGrantParam ,
@@ -40,6 +41,8 @@ class Schema(Resource):
4041
4142 grants : VariableOrList [SchemaGrant ] = field (default_factory = list )
4243
44+ lifecycle : VariableOrOptional [Lifecycle ] = None
45+
4346 properties : VariableOrDict [str ] = field (default_factory = dict )
4447
4548 storage_root : VariableOrOptional [str ] = None
@@ -75,6 +78,8 @@ class SchemaDict(TypedDict, total=False):
7578
7679 grants : VariableOrList [SchemaGrantParam ]
7780
81+ lifecycle : VariableOrOptional [LifecycleParam ]
82+
7883 properties : VariableOrDict [str ]
7984
8085 storage_root : VariableOrOptional [str ]
You can’t perform that action at this time.
0 commit comments