-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathschema.py
More file actions
97 lines (73 loc) · 2.41 KB
/
schema.py
File metadata and controls
97 lines (73 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, TypedDict
from databricks.bundles.core._resource import Resource
from databricks.bundles.core._transform import _transform
from databricks.bundles.core._transform_to_json import _transform_to_json_value
from databricks.bundles.core._variable import (
VariableOr,
VariableOrDict,
VariableOrList,
VariableOrOptional,
)
from databricks.bundles.schemas._models.lifecycle import Lifecycle, LifecycleParam
from databricks.bundles.schemas._models.schema_grant import (
SchemaGrant,
SchemaGrantParam,
)
if TYPE_CHECKING:
from typing_extensions import Self
@dataclass(kw_only=True)
class Schema(Resource):
""""""
catalog_name: VariableOr[str]
"""
Name of parent catalog.
"""
name: VariableOr[str]
"""
Name of schema, relative to parent catalog.
"""
comment: VariableOrOptional[str] = None
"""
User-provided free-form text description.
"""
grants: VariableOrList[SchemaGrant] = field(default_factory=list)
lifecycle: VariableOrOptional[Lifecycle] = None
"""
Lifecycle is a struct that contains the lifecycle settings for a resource. It controls the behavior of the resource when it is deployed or destroyed.
"""
properties: VariableOrDict[str] = field(default_factory=dict)
storage_root: VariableOrOptional[str] = None
"""
Storage root URL for managed tables within schema.
"""
@classmethod
def from_dict(cls, value: "SchemaDict") -> "Self":
return _transform(cls, value)
def as_dict(self) -> "SchemaDict":
return _transform_to_json_value(self) # type:ignore
class SchemaDict(TypedDict, total=False):
""""""
catalog_name: VariableOr[str]
"""
Name of parent catalog.
"""
name: VariableOr[str]
"""
Name of schema, relative to parent catalog.
"""
comment: VariableOrOptional[str]
"""
User-provided free-form text description.
"""
grants: VariableOrList[SchemaGrantParam]
lifecycle: VariableOrOptional[LifecycleParam]
"""
Lifecycle is a struct that contains the lifecycle settings for a resource. It controls the behavior of the resource when it is deployed or destroyed.
"""
properties: VariableOrDict[str]
storage_root: VariableOrOptional[str]
"""
Storage root URL for managed tables within schema.
"""
SchemaParam = SchemaDict | Schema