-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathsql_task_file.py
More file actions
59 lines (43 loc) · 2.14 KB
/
sql_task_file.py
File metadata and controls
59 lines (43 loc) · 2.14 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
from dataclasses import dataclass
from typing import TYPE_CHECKING, TypedDict
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, VariableOrOptional
from databricks.bundles.jobs._models.source import Source, SourceParam
if TYPE_CHECKING:
from typing_extensions import Self
@dataclass(kw_only=True)
class SqlTaskFile:
""""""
path: VariableOr[str]
"""
Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths.
"""
source: VariableOrOptional[Source] = None
"""
Optional location type of the SQL file. When set to `WORKSPACE`, the SQL file will be retrieved
from the local Databricks workspace. When set to `GIT`, the SQL file will be retrieved from a Git repository
defined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.
* `WORKSPACE`: SQL file is located in Databricks workspace.
* `GIT`: SQL file is located in cloud Git provider.
"""
@classmethod
def from_dict(cls, value: "SqlTaskFileDict") -> "Self":
return _transform(cls, value)
def as_dict(self) -> "SqlTaskFileDict":
return _transform_to_json_value(self) # type:ignore
class SqlTaskFileDict(TypedDict, total=False):
""""""
path: VariableOr[str]
"""
Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths.
"""
source: VariableOrOptional[SourceParam]
"""
Optional location type of the SQL file. When set to `WORKSPACE`, the SQL file will be retrieved
from the local Databricks workspace. When set to `GIT`, the SQL file will be retrieved from a Git repository
defined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.
* `WORKSPACE`: SQL file is located in Databricks workspace.
* `GIT`: SQL file is located in cloud Git provider.
"""
SqlTaskFileParam = SqlTaskFileDict | SqlTaskFile