Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions experimental/python/codegen/codegen/jsonschema_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
from codegen.jsonschema import Schema

REMOVED_FIELDS = {
# TODO remove as a follow-up
"jobs.Task": {
"dashboard_task",
"power_bi_task",
},
"compute.ClusterSpec": {
# doesn't work, openapi schema needs to be updated to be enum
"kind",
Expand Down
57 changes: 57 additions & 0 deletions experimental/python/databricks/bundles/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"Adlsgen2Info",
"Adlsgen2InfoDict",
"Adlsgen2InfoParam",
"AuthenticationMethod",
"AuthenticationMethodParam",
"AutoScale",
"AutoScaleDict",
"AutoScaleParam",
Expand Down Expand Up @@ -43,6 +45,9 @@
"CronSchedule",
"CronScheduleDict",
"CronScheduleParam",
"DashboardTask",
"DashboardTaskDict",
"DashboardTaskParam",
"DataSecurityMode",
"DataSecurityModeParam",
"DbfsStorageInfo",
Expand Down Expand Up @@ -153,6 +158,15 @@
"PipelineTask",
"PipelineTaskDict",
"PipelineTaskParam",
"PowerBiModel",
"PowerBiModelDict",
"PowerBiModelParam",
"PowerBiTable",
"PowerBiTableDict",
"PowerBiTableParam",
"PowerBiTask",
"PowerBiTaskDict",
"PowerBiTaskParam",
"PythonPyPiLibrary",
"PythonPyPiLibraryDict",
"PythonPyPiLibraryParam",
Expand Down Expand Up @@ -204,6 +218,14 @@
"SqlTaskSubscription",
"SqlTaskSubscriptionDict",
"SqlTaskSubscriptionParam",
"StorageMode",
"StorageModeParam",
"Subscription",
"SubscriptionDict",
"SubscriptionParam",
"SubscriptionSubscriber",
"SubscriptionSubscriberDict",
"SubscriptionSubscriberParam",
"TableUpdateTriggerConfiguration",
"TableUpdateTriggerConfigurationDict",
"TableUpdateTriggerConfigurationParam",
Expand Down Expand Up @@ -384,6 +406,10 @@
WorkspaceStorageInfoDict,
WorkspaceStorageInfoParam,
)
from databricks.bundles.jobs._models.authentication_method import (
AuthenticationMethod,
AuthenticationMethodParam,
)
from databricks.bundles.jobs._models.clean_rooms_notebook_task import (
CleanRoomsNotebookTask,
CleanRoomsNotebookTaskDict,
Expand Down Expand Up @@ -414,6 +440,11 @@
CronScheduleDict,
CronScheduleParam,
)
from databricks.bundles.jobs._models.dashboard_task import (
DashboardTask,
DashboardTaskDict,
DashboardTaskParam,
)
from databricks.bundles.jobs._models.dbt_task import DbtTask, DbtTaskDict, DbtTaskParam
from databricks.bundles.jobs._models.file_arrival_trigger_configuration import (
FileArrivalTriggerConfiguration,
Expand Down Expand Up @@ -523,6 +554,21 @@
PipelineTaskDict,
PipelineTaskParam,
)
from databricks.bundles.jobs._models.power_bi_model import (
PowerBiModel,
PowerBiModelDict,
PowerBiModelParam,
)
from databricks.bundles.jobs._models.power_bi_table import (
PowerBiTable,
PowerBiTableDict,
PowerBiTableParam,
)
from databricks.bundles.jobs._models.power_bi_task import (
PowerBiTask,
PowerBiTaskDict,
PowerBiTaskParam,
)
from databricks.bundles.jobs._models.python_wheel_task import (
PythonWheelTask,
PythonWheelTaskDict,
Expand Down Expand Up @@ -581,6 +627,17 @@
SqlTaskSubscriptionDict,
SqlTaskSubscriptionParam,
)
from databricks.bundles.jobs._models.storage_mode import StorageMode, StorageModeParam
from databricks.bundles.jobs._models.subscription import (
Subscription,
SubscriptionDict,
SubscriptionParam,
)
from databricks.bundles.jobs._models.subscription_subscriber import (
SubscriptionSubscriber,
SubscriptionSubscriberDict,
SubscriptionSubscriberParam,
)
from databricks.bundles.jobs._models.table_update_trigger_configuration import (
TableUpdateTriggerConfiguration,
TableUpdateTriggerConfigurationDict,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from enum import Enum
from typing import Literal


class AuthenticationMethod(Enum):
"""
:meta private: [EXPERIMENTAL]
"""

OAUTH = "OAUTH"
PAT = "PAT"


AuthenticationMethodParam = Literal["OAUTH", "PAT"] | AuthenticationMethod
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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 VariableOrOptional
from databricks.bundles.jobs._models.subscription import (
Subscription,
SubscriptionParam,
)

if TYPE_CHECKING:
from typing_extensions import Self


@dataclass(kw_only=True)
class DashboardTask:
"""
Configures the Lakeview Dashboard job task type.
"""

dashboard_id: VariableOrOptional[str] = None

subscription: VariableOrOptional[Subscription] = None

warehouse_id: VariableOrOptional[str] = None
"""
Optional: The warehouse id to execute the dashboard with for the schedule.
If not specified, the default warehouse of the dashboard will be used.
"""

@classmethod
def from_dict(cls, value: "DashboardTaskDict") -> "Self":
return _transform(cls, value)

def as_dict(self) -> "DashboardTaskDict":
return _transform_to_json_value(self) # type:ignore


class DashboardTaskDict(TypedDict, total=False):
""""""

dashboard_id: VariableOrOptional[str]

subscription: VariableOrOptional[SubscriptionParam]

warehouse_id: VariableOrOptional[str]
"""
Optional: The warehouse id to execute the dashboard with for the schedule.
If not specified, the default warehouse of the dashboard will be used.
"""


DashboardTaskParam = DashboardTaskDict | DashboardTask
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
CronSchedule,
CronScheduleParam,
)
from databricks.bundles.jobs._models.git_source import GitSource, GitSourceParam
from databricks.bundles.jobs._models.git_source import (
GitSource,
GitSourceParam,
)
from databricks.bundles.jobs._models.job_cluster import JobCluster, JobClusterParam
from databricks.bundles.jobs._models.job_email_notifications import (
JobEmailNotifications,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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 VariableOrOptional
from databricks.bundles.jobs._models.authentication_method import (
AuthenticationMethod,
AuthenticationMethodParam,
)
from databricks.bundles.jobs._models.storage_mode import StorageMode, StorageModeParam

if TYPE_CHECKING:
from typing_extensions import Self


@dataclass(kw_only=True)
class PowerBiModel:
"""
:meta private: [EXPERIMENTAL]
"""

authentication_method: VariableOrOptional[AuthenticationMethod] = None
"""
How the published Power BI model authenticates to Databricks
"""

model_name: VariableOrOptional[str] = None
"""
The name of the Power BI model
"""

overwrite_existing: VariableOrOptional[bool] = None
"""
Whether to overwrite existing Power BI models
"""

storage_mode: VariableOrOptional[StorageMode] = None
"""
The default storage mode of the Power BI model
"""

workspace_name: VariableOrOptional[str] = None
"""
The name of the Power BI workspace of the model
"""

@classmethod
def from_dict(cls, value: "PowerBiModelDict") -> "Self":
return _transform(cls, value)

def as_dict(self) -> "PowerBiModelDict":
return _transform_to_json_value(self) # type:ignore


class PowerBiModelDict(TypedDict, total=False):
""""""

authentication_method: VariableOrOptional[AuthenticationMethodParam]
"""
How the published Power BI model authenticates to Databricks
"""

model_name: VariableOrOptional[str]
"""
The name of the Power BI model
"""

overwrite_existing: VariableOrOptional[bool]
"""
Whether to overwrite existing Power BI models
"""

storage_mode: VariableOrOptional[StorageModeParam]
"""
The default storage mode of the Power BI model
"""

workspace_name: VariableOrOptional[str]
"""
The name of the Power BI workspace of the model
"""


PowerBiModelParam = PowerBiModelDict | PowerBiModel
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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 VariableOrOptional
from databricks.bundles.jobs._models.storage_mode import StorageMode, StorageModeParam

if TYPE_CHECKING:
from typing_extensions import Self


@dataclass(kw_only=True)
class PowerBiTable:
"""
:meta private: [EXPERIMENTAL]
"""

catalog: VariableOrOptional[str] = None
"""
The catalog name in Databricks
"""

name: VariableOrOptional[str] = None
"""
The table name in Databricks
"""

schema: VariableOrOptional[str] = None
"""
The schema name in Databricks
"""

storage_mode: VariableOrOptional[StorageMode] = None
"""
The Power BI storage mode of the table
"""

@classmethod
def from_dict(cls, value: "PowerBiTableDict") -> "Self":
return _transform(cls, value)

def as_dict(self) -> "PowerBiTableDict":
return _transform_to_json_value(self) # type:ignore


class PowerBiTableDict(TypedDict, total=False):
""""""

catalog: VariableOrOptional[str]
"""
The catalog name in Databricks
"""

name: VariableOrOptional[str]
"""
The table name in Databricks
"""

schema: VariableOrOptional[str]
"""
The schema name in Databricks
"""

storage_mode: VariableOrOptional[StorageModeParam]
"""
The Power BI storage mode of the table
"""


PowerBiTableParam = PowerBiTableDict | PowerBiTable
Loading
Loading