diff --git a/.codegen/__init__.py.tmpl b/.codegen/__init__.py.tmpl index 3b432a479..0e3131829 100644 --- a/.codegen/__init__.py.tmpl +++ b/.codegen/__init__.py.tmpl @@ -35,6 +35,9 @@ def _make_dbutils(config: client.Config): class WorkspaceClient: + """ + The WorkspaceClient is a client for the workspace-level Databricks REST API. + """ def __init__(self, *{{range $args}}, {{.}}: str = None{{end}}, debug_truncate_bytes: int = None, debug_headers: bool = None, @@ -52,10 +55,17 @@ class WorkspaceClient: self.config = config.copy() self.dbutils = _make_dbutils(self.config) self.api_client = client.ApiClient(self.config) + {{- range .Services}}{{if not .IsAccounts}} - self.{{.SnakeName}} = {{template "api" .}}(self.api_client){{end -}}{{end}} + self.{{.SnakeName}}: {{template "api" .}} = {{template "api" .}}(self.api_client){{if .Description}} + """{{.Comment " " 100}}"""{{end}} + {{end -}}{{end}} class AccountClient: + """ + The AccountClient is a client for the account-level Databricks REST API. + """ + def __init__(self, *{{range $args}}, {{.}}: str = None{{end}}, debug_truncate_bytes: int = None, debug_headers: bool = None, @@ -72,5 +82,8 @@ class AccountClient: product_version=product_version) self.config = config.copy() self.api_client = client.ApiClient(self.config) + {{- range .Services}}{{if .IsAccounts}} - self.{{(.TrimPrefix "account").SnakeName}} = {{template "api" .}}(self.api_client){{end -}}{{end}} + self.{{.SnakeName}}: {{template "api" .}} = {{template "api" .}}(self.api_client){{if .Description}} + """{{.Comment " " 100}}"""{{end}} + {{end -}}{{end}} diff --git a/.codegen/service.py.tmpl b/.codegen/service.py.tmpl index 4e46f9674..025eba08c 100644 --- a/.codegen/service.py.tmpl +++ b/.codegen/service.py.tmpl @@ -9,6 +9,7 @@ import random import logging from ..errors import OperationTimeout, OperationFailed from ._internal import _enum, _from_dict, _repeated_dict, _repeated_enum, Wait +from __future__ import annotations _LOG = logging.getLogger('databricks.sdk') @@ -21,17 +22,24 @@ from databricks.sdk.service import {{.Package.Name}}{{end}} class {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}:{{if .Description}} """{{.Comment " " 100}}""" {{end}}{{- range .RequiredFields | alphanumOnly}} - {{template "safe-snake-name" .}}: {{template "type" .Entity}}{{end}}{{- range .NonRequiredFields | alphanumOnly}} - {{template "safe-snake-name" .}}: Optional[{{template "type" .Entity}}] = None{{end}} + {{template "safe-snake-name" .}}: {{template "type" .Entity}}{{if .Description}} + """{{.Comment " " 100 | trimSuffix "\""}}"""{{end}} + {{end}} + {{- range .NonRequiredFields | alphanumOnly}} + {{template "safe-snake-name" .}}: Optional[{{template "type" .Entity}}] = None{{if .Description}} + """{{.Comment " " 100 | trimSuffix "\""}}"""{{end}} + {{end}} {{if .HasJsonField -}} def as_dict(self) -> dict: + """Serializes the {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}} into a dictionary suitable for use as a JSON request body.""" body = {} {{range .Fields | alphanumOnly}}if self.{{template "safe-snake-name" .}}{{with .Entity.IsPrimitive}} is not None{{end}}: body['{{.Name}}'] = {{template "as_request_type" .}} {{end -}} return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> '{{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}': + def from_dict(cls, d: Dict[str, any]) -> {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}: + """Deserializes the {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}} from a dictionary.""" return cls({{range $i, $f := .Fields | alphanumOnly}}{{if $i}}, {{end}}{{template "safe-snake-name" $f}}={{template "from_dict_type" $f}}{{end}}) {{end}} {{end}} @@ -62,11 +70,11 @@ class {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}:{{if .Descriptio {{- end -}} {{- define "type" -}} {{- if not . }}any # ERROR: No Type - {{- else if .ArrayValue }}'List[{{template "type-nq" .ArrayValue}}]' - {{- else if .MapValue }}'Dict[str,{{template "type-nq" .MapValue}}]' - {{- else if .IsExternal }}'{{.Package.Name}}.{{.PascalName}}' - {{- else if .IsObject }}'{{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}' - {{- else if .Enum }}'{{.PascalName}}' + {{- else if .ArrayValue }}List[{{template "type-nq" .ArrayValue}}] + {{- else if .MapValue }}Dict[str,{{template "type-nq" .MapValue}}] + {{- else if .IsExternal }}{{.Package.Name}}.{{.PascalName}} + {{- else if .IsObject }}{{.PascalName}}{{if eq "List" .PascalName}}Request{{end}} + {{- else if .Enum }}{{.PascalName}} {{- else}}{{template "type-nq" .}}{{- end -}} {{- end -}} {{- define "type-nq" -}} diff --git a/databricks/sdk/__init__.py b/databricks/sdk/__init__.py index d3cefd4de..168ab9fbe 100755 --- a/databricks/sdk/__init__.py +++ b/databricks/sdk/__init__.py @@ -84,6 +84,9 @@ def _make_dbutils(config: client.Config): class WorkspaceClient: + """ + The WorkspaceClient is a client for the workspace-level Databricks REST API. + """ def __init__(self, *, @@ -138,72 +141,756 @@ def __init__(self, self.config = config.copy() self.dbutils = _make_dbutils(self.config) self.api_client = client.ApiClient(self.config) - self.account_access_control_proxy = AccountAccessControlProxyAPI(self.api_client) - self.alerts = AlertsAPI(self.api_client) - self.apps = AppsAPI(self.api_client) - self.artifact_allowlists = ArtifactAllowlistsAPI(self.api_client) - self.catalogs = CatalogsAPI(self.api_client) - self.clean_rooms = CleanRoomsAPI(self.api_client) - self.cluster_policies = ClusterPoliciesAPI(self.api_client) - self.clusters = ClustersExt(self.api_client) - self.command_execution = CommandExecutionAPI(self.api_client) - self.connections = ConnectionsAPI(self.api_client) - self.credentials_manager = CredentialsManagerAPI(self.api_client) - self.current_user = CurrentUserAPI(self.api_client) - self.dashboard_widgets = DashboardWidgetsAPI(self.api_client) - self.dashboards = DashboardsAPI(self.api_client) - self.data_sources = DataSourcesAPI(self.api_client) - self.dbfs = DbfsExt(self.api_client) - self.dbsql_permissions = DbsqlPermissionsAPI(self.api_client) - self.experiments = ExperimentsAPI(self.api_client) - self.external_locations = ExternalLocationsAPI(self.api_client) - self.files = FilesAPI(self.api_client) - self.functions = FunctionsAPI(self.api_client) - self.git_credentials = GitCredentialsAPI(self.api_client) - self.global_init_scripts = GlobalInitScriptsAPI(self.api_client) - self.grants = GrantsAPI(self.api_client) - self.groups = GroupsAPI(self.api_client) - self.instance_pools = InstancePoolsAPI(self.api_client) - self.instance_profiles = InstanceProfilesAPI(self.api_client) - self.ip_access_lists = IpAccessListsAPI(self.api_client) - self.jobs = JobsAPI(self.api_client) - self.libraries = LibrariesAPI(self.api_client) - self.metastores = MetastoresAPI(self.api_client) - self.model_registry = ModelRegistryAPI(self.api_client) - self.model_versions = ModelVersionsAPI(self.api_client) - self.permissions = PermissionsAPI(self.api_client) - self.pipelines = PipelinesAPI(self.api_client) - self.policy_families = PolicyFamiliesAPI(self.api_client) - self.providers = ProvidersAPI(self.api_client) - self.queries = QueriesAPI(self.api_client) - self.query_history = QueryHistoryAPI(self.api_client) - self.query_visualizations = QueryVisualizationsAPI(self.api_client) - self.recipient_activation = RecipientActivationAPI(self.api_client) - self.recipients = RecipientsAPI(self.api_client) - self.registered_models = RegisteredModelsAPI(self.api_client) - self.repos = ReposAPI(self.api_client) - self.schemas = SchemasAPI(self.api_client) - self.secrets = SecretsAPI(self.api_client) - self.service_principals = ServicePrincipalsAPI(self.api_client) - self.serving_endpoints = ServingEndpointsAPI(self.api_client) - self.settings = SettingsAPI(self.api_client) - self.shares = SharesAPI(self.api_client) - self.statement_execution = StatementExecutionAPI(self.api_client) - self.storage_credentials = StorageCredentialsAPI(self.api_client) - self.system_schemas = SystemSchemasAPI(self.api_client) - self.table_constraints = TableConstraintsAPI(self.api_client) - self.tables = TablesAPI(self.api_client) - self.token_management = TokenManagementAPI(self.api_client) - self.tokens = TokensAPI(self.api_client) - self.users = UsersAPI(self.api_client) - self.volumes = VolumesAPI(self.api_client) - self.warehouses = WarehousesAPI(self.api_client) - self.workspace = WorkspaceExt(self.api_client) - self.workspace_bindings = WorkspaceBindingsAPI(self.api_client) - self.workspace_conf = WorkspaceConfAPI(self.api_client) + self.account_access_control_proxy: AccountAccessControlProxyAPI = AccountAccessControlProxyAPI( + self.api_client) + """These APIs manage access rules on resources in an account. Currently, only grant rules are + supported. A grant rule specifies a role assigned to a set of principals. A list of rules + attached to a resource is called a rule set. A workspace must belong to an account for these + APIs to work.""" + + self.alerts: AlertsAPI = AlertsAPI(self.api_client) + """The alerts API can be used to perform CRUD operations on alerts. An alert is a Databricks + SQL object that periodically runs a query, evaluates a condition of its result, and notifies + one or more users and/or notification destinations if the condition was met. Alerts can be + scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create.""" + + self.apps: AppsAPI = AppsAPI(self.api_client) + """Lakehouse Apps run directly on a customer’s Databricks instance, integrate with their + data, use and extend Databricks services, and enable users to interact through single + sign-on.""" + + self.artifact_allowlists: ArtifactAllowlistsAPI = ArtifactAllowlistsAPI(self.api_client) + """In Databricks Runtime 13.3 and above, you can add libraries and init scripts to the + `allowlist` in UC so that users can leverage these artifacts on compute configured with + shared access mode.""" + + self.catalogs: CatalogsAPI = CatalogsAPI(self.api_client) + """A catalog is the first layer of Unity Catalog’s three-level namespace. It’s used to + organize your data assets. Users can see all catalogs on which they have been assigned the + USE_CATALOG data permission. + + In Unity Catalog, admins and data stewards manage users and their access to data centrally + across all of the workspaces in a Databricks account. Users in different workspaces can + share access to the same data, depending on privileges granted centrally in Unity Catalog.""" + + self.clean_rooms: CleanRoomsAPI = CleanRoomsAPI(self.api_client) + """A clean room is a secure, privacy-protecting environment where two or more parties can share + sensitive enterprise data, including customer data, for measurements, insights, activation + and other use cases. + + To create clean rooms, you must be a metastore admin or a user with the + **CREATE_CLEAN_ROOM** privilege.""" + + self.cluster_policies: ClusterPoliciesAPI = ClusterPoliciesAPI(self.api_client) + """You can use cluster policies to control users' ability to configure clusters based on a set + of rules. These rules specify which attributes or attribute values can be used during + cluster creation. Cluster policies have ACLs that limit their use to specific users and + groups. + + With cluster policies, you can: - Auto-install cluster libraries on the next restart by + listing them in the policy's "libraries" field. - Limit users to creating clusters with the + prescribed settings. - Simplify the user interface, enabling more users to create clusters, + by fixing and hiding some fields. - Manage costs by setting limits on attributes that impact + the hourly rate. + + Cluster policy permissions limit which policies a user can select in the Policy drop-down + when the user creates a cluster: - A user who has unrestricted cluster create permission can + select the Unrestricted policy and create fully-configurable clusters. - A user who has both + unrestricted cluster create permission and access to cluster policies can select the + Unrestricted policy and policies they have access to. - A user that has access to only + cluster policies, can select the policies they have access to. + + If no policies exist in the workspace, the Policy drop-down doesn't appear. Only admin users + can create, edit, and delete policies. Admin users also have access to all policies.""" + + self.clusters: ClustersExt = ClustersExt(self.api_client) + """The Clusters API allows you to create, start, edit, list, terminate, and delete clusters. + + Databricks maps cluster node instance types to compute units known as DBUs. See the instance + type pricing page for a list of the supported instance types and their corresponding DBUs. + + A Databricks cluster is a set of computation resources and configurations on which you run + data engineering, data science, and data analytics workloads, such as production ETL + pipelines, streaming analytics, ad-hoc analytics, and machine learning. + + You run these workloads as a set of commands in a notebook or as an automated job. + Databricks makes a distinction between all-purpose clusters and job clusters. You use + all-purpose clusters to analyze data collaboratively using interactive notebooks. You use + job clusters to run fast and robust automated jobs. + + You can create an all-purpose cluster using the UI, CLI, or REST API. You can manually + terminate and restart an all-purpose cluster. Multiple users can share such clusters to do + collaborative interactive analysis. + + IMPORTANT: Databricks retains cluster configuration information for up to 200 all-purpose + clusters terminated in the last 30 days and up to 30 job clusters recently terminated by the + job scheduler. To keep an all-purpose cluster configuration even after it has been + terminated for more than 30 days, an administrator can pin a cluster to the cluster list.""" + + self.command_execution: CommandExecutionAPI = CommandExecutionAPI(self.api_client) + """This API allows execution of Python, Scala, SQL, or R commands on running Databricks + Clusters.""" + + self.connections: ConnectionsAPI = ConnectionsAPI(self.api_client) + """Connections allow for creating a connection to an external data source. + + A connection is an abstraction of an external data source that can be connected from + Databricks Compute. Creating a connection object is the first step to managing external data + sources within Unity Catalog, with the second step being creating a data object (catalog, + schema, or table) using the connection. Data objects derived from a connection can be + written to or read from similar to other Unity Catalog data objects based on cloud storage. + Users may create different types of connections with each connection having a unique set of + configuration options to support credential management and other settings.""" + + self.credentials_manager: CredentialsManagerAPI = CredentialsManagerAPI(self.api_client) + """Credentials manager interacts with with Identity Providers to to perform token exchanges + using stored credentials and refresh tokens.""" + + self.current_user: CurrentUserAPI = CurrentUserAPI(self.api_client) + """This API allows retrieving information about currently authenticated user or service + principal.""" + + self.dashboard_widgets: DashboardWidgetsAPI = DashboardWidgetsAPI(self.api_client) + """This is an evolving API that facilitates the addition and removal of widgets from existing + dashboards within the Databricks Workspace. Data structures may change over time.""" + + self.dashboards: DashboardsAPI = DashboardsAPI(self.api_client) + """In general, there is little need to modify dashboards using the API. However, it can be + useful to use dashboard objects to look-up a collection of related query IDs. The API can + also be used to duplicate multiple dashboards at once since you can get a dashboard + definition with a GET request and then POST it to create a new one. Dashboards can be + scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create.""" + + self.data_sources: DataSourcesAPI = DataSourcesAPI(self.api_client) + """This API is provided to assist you in making new query objects. When creating a query + object, you may optionally specify a `data_source_id` for the SQL warehouse against which it + will run. If you don't already know the `data_source_id` for your desired SQL warehouse, + this API will help you find it. + + This API does not support searches. It returns the full list of SQL warehouses in your + workspace. We advise you to use any text editor, REST client, or `grep` to search the + response from this API for the name of your SQL warehouse as it appears in Databricks SQL.""" + + self.dbfs: DbfsExt = DbfsExt(self.api_client) + """DBFS API makes it simple to interact with various data sources without having to include a + users credentials every time to read a file.""" + + self.dbsql_permissions: DbsqlPermissionsAPI = DbsqlPermissionsAPI(self.api_client) + """The SQL Permissions API is similar to the endpoints of the :method:permissions/set. However, + this exposes only one endpoint, which gets the Access Control List for a given object. You + cannot modify any permissions using this API. + + There are three levels of permission: + + - `CAN_VIEW`: Allows read-only access + + - `CAN_RUN`: Allows read access and run access (superset of `CAN_VIEW`) + + - `CAN_MANAGE`: Allows all actions: read, run, edit, delete, modify permissions (superset of + `CAN_RUN`)""" + + self.experiments: ExperimentsAPI = ExperimentsAPI(self.api_client) + """Experiments are the primary unit of organization in MLflow; all MLflow runs belong to an + experiment. Each experiment lets you visualize, search, and compare runs, as well as + download run artifacts or metadata for analysis in other tools. Experiments are maintained + in a Databricks hosted MLflow tracking server. + + Experiments are located in the workspace file tree. You manage experiments using the same + tools you use to manage other workspace objects such as folders, notebooks, and libraries.""" + + self.external_locations: ExternalLocationsAPI = ExternalLocationsAPI(self.api_client) + """An external location is an object that combines a cloud storage path with a storage + credential that authorizes access to the cloud storage path. Each external location is + subject to Unity Catalog access-control policies that control which users and groups can + access the credential. If a user does not have access to an external location in Unity + Catalog, the request fails and Unity Catalog does not attempt to authenticate to your cloud + tenant on the user’s behalf. + + Databricks recommends using external locations rather than using storage credentials + directly. + + To create external locations, you must be a metastore admin or a user with the + **CREATE_EXTERNAL_LOCATION** privilege.""" + + self.files: FilesAPI = FilesAPI(self.api_client) + """The Files API allows you to read, write, and delete files and directories in Unity Catalog + volumes.""" + + self.functions: FunctionsAPI = FunctionsAPI(self.api_client) + """Functions implement User-Defined Functions (UDFs) in Unity Catalog. + + The function implementation can be any SQL expression or Query, and it can be invoked + wherever a table reference is allowed in a query. In Unity Catalog, a function resides at + the same level as a table, so it can be referenced with the form + __catalog_name__.__schema_name__.__function_name__.""" + + self.git_credentials: GitCredentialsAPI = GitCredentialsAPI(self.api_client) + """Registers personal access token for Databricks to do operations on behalf of the user. + + See [more info]. + + [more info]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html""" + + self.global_init_scripts: GlobalInitScriptsAPI = GlobalInitScriptsAPI(self.api_client) + """The Global Init Scripts API enables Workspace administrators to configure global + initialization scripts for their workspace. These scripts run on every node in every cluster + in the workspace. + + **Important:** Existing clusters must be restarted to pick up any changes made to global + init scripts. Global init scripts are run in order. If the init script returns with a bad + exit code, the Apache Spark container fails to launch and init scripts with later position + are skipped. If enough containers fail, the entire cluster fails with a + `GLOBAL_INIT_SCRIPT_FAILURE` error code.""" + + self.grants: GrantsAPI = GrantsAPI(self.api_client) + """In Unity Catalog, data is secure by default. Initially, users have no access to data in a + metastore. Access can be granted by either a metastore admin, the owner of an object, or the + owner of the catalog or schema that contains the object. Securable objects in Unity Catalog + are hierarchical and privileges are inherited downward. + + Securable objects in Unity Catalog are hierarchical and privileges are inherited downward. + This means that granting a privilege on the catalog automatically grants the privilege to + all current and future objects within the catalog. Similarly, privileges granted on a schema + are inherited by all current and future objects within that schema.""" + + self.groups: GroupsAPI = GroupsAPI(self.api_client) + """Groups simplify identity management, making it easier to assign access to Databricks + workspace, data, and other securable objects. + + It is best practice to assign access to workspaces and access-control policies in Unity + Catalog to groups, instead of to users individually. All Databricks workspace identities can + be assigned as members of groups, and members inherit permissions that are assigned to their + group.""" + + self.instance_pools: InstancePoolsAPI = InstancePoolsAPI(self.api_client) + """Instance Pools API are used to create, edit, delete and list instance pools by using + ready-to-use cloud instances which reduces a cluster start and auto-scaling times. + + Databricks pools reduce cluster start and auto-scaling times by maintaining a set of idle, + ready-to-use instances. When a cluster is attached to a pool, cluster nodes are created + using the pool’s idle instances. If the pool has no idle instances, the pool expands by + allocating a new instance from the instance provider in order to accommodate the cluster’s + request. When a cluster releases an instance, it returns to the pool and is free for another + cluster to use. Only clusters attached to a pool can use that pool’s idle instances. + + You can specify a different pool for the driver node and worker nodes, or use the same pool + for both. + + Databricks does not charge DBUs while instances are idle in the pool. Instance provider + billing does apply. See pricing.""" + + self.instance_profiles: InstanceProfilesAPI = InstanceProfilesAPI(self.api_client) + """The Instance Profiles API allows admins to add, list, and remove instance profiles that + users can launch clusters with. Regular users can list the instance profiles available to + them. See [Secure access to S3 buckets] using instance profiles for more information. + + [Secure access to S3 buckets]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/instance-profiles.html""" + + self.ip_access_lists: IpAccessListsAPI = IpAccessListsAPI(self.api_client) + """IP Access List enables admins to configure IP access lists. + + IP access lists affect web application access and REST API access to this workspace only. If + the feature is disabled for a workspace, all access is allowed for this workspace. There is + support for allow lists (inclusion) and block lists (exclusion). + + When a connection is attempted: 1. **First, all block lists are checked.** If the connection + IP address matches any block list, the connection is rejected. 2. **If the connection was + not rejected by block lists**, the IP address is compared with the allow lists. + + If there is at least one allow list for the workspace, the connection is allowed only if the + IP address matches an allow list. If there are no allow lists for the workspace, all IP + addresses are allowed. + + For all allow lists and block lists combined, the workspace supports a maximum of 1000 + IP/CIDR values, where one CIDR counts as a single value. + + After changes to the IP access list feature, it can take a few minutes for changes to take + effect.""" + + self.jobs: JobsAPI = JobsAPI(self.api_client) + """The Jobs API allows you to create, edit, and delete jobs. + + You can use a Databricks job to run a data processing or data analysis task in a Databricks + cluster with scalable resources. Your job can consist of a single task or can be a large, + multi-task workflow with complex dependencies. Databricks manages the task orchestration, + cluster management, monitoring, and error reporting for all of your jobs. You can run your + jobs immediately or periodically through an easy-to-use scheduling system. You can implement + job tasks using notebooks, JARS, Delta Live Tables pipelines, or Python, Scala, Spark + submit, and Java applications. + + You should never hard code secrets or store them in plain text. Use the [Secrets CLI] to + manage secrets in the [Databricks CLI]. Use the [Secrets utility] to reference secrets in + notebooks and jobs. + + [Databricks CLI]: https://docs.databricks.com/dev-tools/cli/index.html + [Secrets CLI]: https://docs.databricks.com/dev-tools/cli/secrets-cli.html + [Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets""" + + self.libraries: LibrariesAPI = LibrariesAPI(self.api_client) + """The Libraries API allows you to install and uninstall libraries and get the status of + libraries on a cluster. + + To make third-party or custom code available to notebooks and jobs running on your clusters, + you can install a library. Libraries can be written in Python, Java, Scala, and R. You can + upload Java, Scala, and Python libraries and point to external packages in PyPI, Maven, and + CRAN repositories. + + Cluster libraries can be used by all notebooks running on a cluster. You can install a + cluster library directly from a public repository such as PyPI or Maven, using a previously + installed workspace library, or using an init script. + + When you install a library on a cluster, a notebook already attached to that cluster will + not immediately see the new library. You must first detach and then reattach the notebook to + the cluster. + + When you uninstall a library from a cluster, the library is removed only when you restart + the cluster. Until you restart the cluster, the status of the uninstalled library appears as + Uninstall pending restart.""" + + self.metastores: MetastoresAPI = MetastoresAPI(self.api_client) + """A metastore is the top-level container of objects in Unity Catalog. It stores data assets + (tables and views) and the permissions that govern access to them. Databricks account admins + can create metastores and assign them to Databricks workspaces to control which workloads + use each metastore. For a workspace to use Unity Catalog, it must have a Unity Catalog + metastore attached. + + Each metastore is configured with a root storage location in a cloud storage account. This + storage location is used for metadata and managed tables data. + + NOTE: This metastore is distinct from the metastore included in Databricks workspaces + created before Unity Catalog was released. If your workspace includes a legacy Hive + metastore, the data in that metastore is available in a catalog named hive_metastore.""" + + self.model_registry: ModelRegistryAPI = ModelRegistryAPI(self.api_client) + """Note: This API reference documents APIs for the Workspace Model Registry. Databricks + recommends using [Models in Unity Catalog](/api/workspace/registeredmodels) instead. Models + in Unity Catalog provides centralized model governance, cross-workspace access, lineage, and + deployment. Workspace Model Registry will be deprecated in the future. + + The Workspace Model Registry is a centralized model repository and a UI and set of APIs that + enable you to manage the full lifecycle of MLflow Models.""" + + self.model_versions: ModelVersionsAPI = ModelVersionsAPI(self.api_client) + """Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. Models in + Unity Catalog provide centralized access control, auditing, lineage, and discovery of ML + models across Databricks workspaces. + + This API reference documents the REST endpoints for managing model versions in Unity + Catalog. For more details, see the [registered models API + docs](/api/workspace/registeredmodels).""" + + self.permissions: PermissionsAPI = PermissionsAPI(self.api_client) + """Permissions API are used to create read, write, edit, update and manage access for various + users on different objects and endpoints. + + * **[Cluster permissions](:service:clusters)** — Manage which users can manage, restart, + or attach to clusters. + + * **[Cluster policy permissions](:service:clusterpolicies)** — Manage which users can use + cluster policies. + + * **[Delta Live Tables pipeline permissions](:service:pipelines)** — Manage which users + can view, manage, run, cancel, or own a Delta Live Tables pipeline. + + * **[Job permissions](:service:jobs)** — Manage which users can view, manage, trigger, + cancel, or own a job. + + * **[MLflow experiment permissions](:service:experiments)** — Manage which users can read, + edit, or manage MLflow experiments. + + * **[MLflow registered model permissions](:service:modelregistry)** — Manage which users + can read, edit, or manage MLflow registered models. + + * **[Password permissions](:service:users)** — Manage which users can use password login + when SSO is enabled. + + * **[Instance Pool permissions](:service:instancepools)** — Manage which users can manage + or attach to pools. + + * **[Repo permissions](repos)** — Manage which users can read, run, edit, or manage a + repo. + + * **[Serving endpoint permissions](:service:servingendpoints)** — Manage which users can + view, query, or manage a serving endpoint. + + * **[SQL warehouse permissions](:service:warehouses)** — Manage which users can use or + manage SQL warehouses. + + * **[Token permissions](:service:tokenmanagement)** — Manage which users can create or use + tokens. + + * **[Workspace object permissions](:service:workspace)** — Manage which users can read, + run, edit, or manage directories, files, and notebooks. + + For the mapping of the required permissions for specific actions or abilities and other + important information, see [Access Control]. + + [Access Control]: https://docs.databricks.com/security/auth-authz/access-control/index.html""" + + self.pipelines: PipelinesAPI = PipelinesAPI(self.api_client) + """The Delta Live Tables API allows you to create, edit, delete, start, and view details about + pipelines. + + Delta Live Tables is a framework for building reliable, maintainable, and testable data + processing pipelines. You define the transformations to perform on your data, and Delta Live + Tables manages task orchestration, cluster management, monitoring, data quality, and error + handling. + + Instead of defining your data pipelines using a series of separate Apache Spark tasks, Delta + Live Tables manages how your data is transformed based on a target schema you define for + each processing step. You can also enforce data quality with Delta Live Tables expectations. + Expectations allow you to define expected data quality and specify how to handle records + that fail those expectations.""" + + self.policy_families: PolicyFamiliesAPI = PolicyFamiliesAPI(self.api_client) + """View available policy families. A policy family contains a policy definition providing best + practices for configuring clusters for a particular use case. + + Databricks manages and provides policy families for several common cluster use cases. You + cannot create, edit, or delete policy families. + + Policy families cannot be used directly to create clusters. Instead, you create cluster + policies using a policy family. Cluster policies created using a policy family inherit the + policy family's policy definition.""" + + self.providers: ProvidersAPI = ProvidersAPI(self.api_client) + """A data provider is an object representing the organization in the real world who shares the + data. A provider contains shares which further contain the shared data.""" + + self.queries: QueriesAPI = QueriesAPI(self.api_client) + """These endpoints are used for CRUD operations on query definitions. Query definitions include + the target SQL warehouse, query text, name, description, tags, parameters, and + visualizations. Queries can be scheduled using the `sql_task` type of the Jobs API, e.g. + :method:jobs/create.""" + + self.query_history: QueryHistoryAPI = QueryHistoryAPI(self.api_client) + """Access the history of queries through SQL warehouses.""" + + self.query_visualizations: QueryVisualizationsAPI = QueryVisualizationsAPI(self.api_client) + """This is an evolving API that facilitates the addition and removal of vizualisations from + existing queries within the Databricks Workspace. Data structures may change over time.""" + + self.recipient_activation: RecipientActivationAPI = RecipientActivationAPI(self.api_client) + """The Recipient Activation API is only applicable in the open sharing model where the + recipient object has the authentication type of `TOKEN`. The data recipient follows the + activation link shared by the data provider to download the credential file that includes + the access token. The recipient will then use the credential file to establish a secure + connection with the provider to receive the shared data. + + Note that you can download the credential file only once. Recipients should treat the + downloaded credential as a secret and must not share it outside of their organization.""" + + self.recipients: RecipientsAPI = RecipientsAPI(self.api_client) + """A recipient is an object you create using :method:recipients/create to represent an + organization which you want to allow access shares. The way how sharing works differs + depending on whether or not your recipient has access to a Databricks workspace that is + enabled for Unity Catalog: + + - For recipients with access to a Databricks workspace that is enabled for Unity Catalog, + you can create a recipient object along with a unique sharing identifier you get from the + recipient. The sharing identifier is the key identifier that enables the secure connection. + This sharing mode is called **Databricks-to-Databricks sharing**. + + - For recipients without access to a Databricks workspace that is enabled for Unity Catalog, + when you create a recipient object, Databricks generates an activation link you can send to + the recipient. The recipient follows the activation link to download the credential file, + and then uses the credential file to establish a secure connection to receive the shared + data. This sharing mode is called **open sharing**.""" + + self.registered_models: RegisteredModelsAPI = RegisteredModelsAPI(self.api_client) + """Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. Models in + Unity Catalog provide centralized access control, auditing, lineage, and discovery of ML + models across Databricks workspaces. + + An MLflow registered model resides in the third layer of Unity Catalog’s three-level + namespace. Registered models contain model versions, which correspond to actual ML models + (MLflow models). Creating new model versions currently requires use of the MLflow Python + client. Once model versions are created, you can load them for batch inference using MLflow + Python client APIs, or deploy them for real-time serving using Databricks Model Serving. + + All operations on registered models and model versions require USE_CATALOG permissions on + the enclosing catalog and USE_SCHEMA permissions on the enclosing schema. In addition, the + following additional privileges are required for various operations: + + * To create a registered model, users must additionally have the CREATE_MODEL permission on + the target schema. * To view registered model or model version metadata, model version data + files, or invoke a model version, users must additionally have the EXECUTE permission on the + registered model * To update registered model or model version tags, users must additionally + have APPLY TAG permissions on the registered model * To update other registered model or + model version metadata (comments, aliases) create a new model version, or update permissions + on the registered model, users must be owners of the registered model. + + Note: The securable type for models is "FUNCTION". When using REST APIs (e.g. tagging, + grants) that specify a securable type, use "FUNCTION" as the securable type.""" + + self.repos: ReposAPI = ReposAPI(self.api_client) + """The Repos API allows users to manage their git repos. Users can use the API to access all + repos that they have manage permissions on. + + Databricks Repos is a visual Git client in Databricks. It supports common Git operations + such a cloning a repository, committing and pushing, pulling, branch management, and visual + comparison of diffs when committing. + + Within Repos you can develop code in notebooks or other files and follow data science and + engineering code development best practices using Git for version control, collaboration, + and CI/CD.""" + + self.schemas: SchemasAPI = SchemasAPI(self.api_client) + """A schema (also called a database) is the second layer of Unity Catalog’s three-level + namespace. A schema organizes tables, views and functions. To access (or list) a table or + view in a schema, users must have the USE_SCHEMA data permission on the schema and its + parent catalog, and they must have the SELECT permission on the table or view.""" + + self.secrets: SecretsAPI = SecretsAPI(self.api_client) + """The Secrets API allows you to manage secrets, secret scopes, and access permissions. + + Sometimes accessing data requires that you authenticate to external data sources through + JDBC. Instead of directly entering your credentials into a notebook, use Databricks secrets + to store your credentials and reference them in notebooks and jobs. + + Administrators, secret creators, and users granted permission can read Databricks secrets. + While Databricks makes an effort to redact secret values that might be displayed in + notebooks, it is not possible to prevent such users from reading secrets.""" + + self.service_principals: ServicePrincipalsAPI = ServicePrincipalsAPI(self.api_client) + """Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD + platforms. Databricks recommends creating service principals to run production jobs or + modify production data. If all processes that act on production data run with service + principals, interactive users do not need any write, delete, or modify privileges in + production. This eliminates the risk of a user overwriting production data by accident.""" + + self.serving_endpoints: ServingEndpointsAPI = ServingEndpointsAPI(self.api_client) + """The Serving Endpoints API allows you to create, update, and delete model serving endpoints. + + You can use a serving endpoint to serve models from the Databricks Model Registry or from + Unity Catalog. Endpoints expose the underlying models as scalable REST API endpoints using + serverless compute. This means the endpoints and associated compute resources are fully + managed by Databricks and will not appear in your cloud account. A serving endpoint can + consist of one or more MLflow models from the Databricks Model Registry, called served + models. A serving endpoint can have at most ten served models. You can configure traffic + settings to define how requests should be routed to your served models behind an endpoint. + Additionally, you can configure the scale of resources that should be applied to each served + model.""" + + self.settings: SettingsAPI = SettingsAPI(self.api_client) + """The default namespace setting API allows users to configure the default namespace for a + Databricks workspace. + + Through this API, users can retrieve, set, or modify the default namespace used when queries + do not reference a fully qualified three-level name. For example, if you use the API to set + 'retail_prod' as the default catalog, then a query 'SELECT * FROM myTable' would reference + the object 'retail_prod.default.myTable' (the schema 'default' is always assumed). + + This setting requires a restart of clusters and SQL warehouses to take effect. Additionally, + the default namespace only applies when using Unity Catalog-enabled compute.""" + + self.shares: SharesAPI = SharesAPI(self.api_client) + """A share is a container instantiated with :method:shares/create. Once created you can + iteratively register a collection of existing data assets defined within the metastore using + :method:shares/update. You can register data assets under their original name, qualified by + their original schema, or provide alternate exposed names.""" + + self.statement_execution: StatementExecutionAPI = StatementExecutionAPI(self.api_client) + """The Databricks SQL Statement Execution API can be used to execute SQL statements on a SQL + warehouse and fetch the result. + + **Getting started** + + We suggest beginning with the [Databricks SQL Statement Execution API tutorial]. + + **Overview of statement execution and result fetching** + + Statement execution begins by issuing a :method:statementexecution/executeStatement request + with a valid SQL statement and warehouse ID, along with optional parameters such as the data + catalog and output format. If no other parameters are specified, the server will wait for up + to 10s before returning a response. If the statement has completed within this timespan, the + response will include the result data as a JSON array and metadata. Otherwise, if no result + is available after the 10s timeout expired, the response will provide the statement ID that + can be used to poll for results by using a :method:statementexecution/getStatement request. + + You can specify whether the call should behave synchronously, asynchronously or start + synchronously with a fallback to asynchronous execution. This is controlled with the + `wait_timeout` and `on_wait_timeout` settings. If `wait_timeout` is set between 5-50 seconds + (default: 10s), the call waits for results up to the specified timeout; when set to `0s`, + the call is asynchronous and responds immediately with a statement ID. The `on_wait_timeout` + setting specifies what should happen when the timeout is reached while the statement + execution has not yet finished. This can be set to either `CONTINUE`, to fallback to + asynchronous mode, or it can be set to `CANCEL`, which cancels the statement. + + In summary: - Synchronous mode - `wait_timeout=30s` and `on_wait_timeout=CANCEL` - The call + waits up to 30 seconds; if the statement execution finishes within this time, the result + data is returned directly in the response. If the execution takes longer than 30 seconds, + the execution is canceled and the call returns with a `CANCELED` state. - Asynchronous mode + - `wait_timeout=0s` (`on_wait_timeout` is ignored) - The call doesn't wait for the statement + to finish but returns directly with a statement ID. The status of the statement execution + can be polled by issuing :method:statementexecution/getStatement with the statement ID. Once + the execution has succeeded, this call also returns the result and metadata in the response. + - Hybrid mode (default) - `wait_timeout=10s` and `on_wait_timeout=CONTINUE` - The call waits + for up to 10 seconds; if the statement execution finishes within this time, the result data + is returned directly in the response. If the execution takes longer than 10 seconds, a + statement ID is returned. The statement ID can be used to fetch status and results in the + same way as in the asynchronous mode. + + Depending on the size, the result can be split into multiple chunks. If the statement + execution is successful, the statement response contains a manifest and the first chunk of + the result. The manifest contains schema information and provides metadata for each chunk in + the result. Result chunks can be retrieved by index with + :method:statementexecution/getStatementResultChunkN which may be called in any order and in + parallel. For sequential fetching, each chunk, apart from the last, also contains a + `next_chunk_index` and `next_chunk_internal_link` that point to the next chunk. + + A statement can be canceled with :method:statementexecution/cancelExecution. + + **Fetching result data: format and disposition** + + To specify the format of the result data, use the `format` field, which can be set to one of + the following options: `JSON_ARRAY` (JSON), `ARROW_STREAM` ([Apache Arrow Columnar]), or + `CSV`. + + There are two ways to receive statement results, controlled by the `disposition` setting, + which can be either `INLINE` or `EXTERNAL_LINKS`: + + - `INLINE`: In this mode, the result data is directly included in the response. It's best + suited for smaller results. This mode can only be used with the `JSON_ARRAY` format. + + - `EXTERNAL_LINKS`: In this mode, the response provides links that can be used to download + the result data in chunks separately. This approach is ideal for larger results and offers + higher throughput. This mode can be used with all the formats: `JSON_ARRAY`, `ARROW_STREAM`, + and `CSV`. + + By default, the API uses `format=JSON_ARRAY` and `disposition=INLINE`. + + **Limits and limitations** + + Note: The byte limit for INLINE disposition is based on internal storage metrics and will + not exactly match the byte count of the actual payload. + + - Statements with `disposition=INLINE` are limited to 25 MiB and will fail when this limit + is exceeded. - Statements with `disposition=EXTERNAL_LINKS` are limited to 100 GiB. Result + sets larger than this limit will be truncated. Truncation is indicated by the `truncated` + field in the result manifest. - The maximum query text size is 16 MiB. - Cancelation might + silently fail. A successful response from a cancel request indicates that the cancel request + was successfully received and sent to the processing engine. However, an outstanding + statement might have already completed execution when the cancel request arrives. Polling + for status until a terminal state is reached is a reliable way to determine the final state. + - Wait timeouts are approximate, occur server-side, and cannot account for things such as + caller delays and network latency from caller to service. - The system will auto-close a + statement after one hour if the client stops polling and thus you must poll at least once an + hour. - The results are only available for one hour after success; polling does not extend + this. + + [Apache Arrow Columnar]: https://arrow.apache.org/overview/ + [Databricks SQL Statement Execution API tutorial]: https://docs.databricks.com/sql/api/sql-execution-tutorial.html""" + + self.storage_credentials: StorageCredentialsAPI = StorageCredentialsAPI(self.api_client) + """A storage credential represents an authentication and authorization mechanism for accessing + data stored on your cloud tenant. Each storage credential is subject to Unity Catalog + access-control policies that control which users and groups can access the credential. If a + user does not have access to a storage credential in Unity Catalog, the request fails and + Unity Catalog does not attempt to authenticate to your cloud tenant on the user’s behalf. + + Databricks recommends using external locations rather than using storage credentials + directly. + + To create storage credentials, you must be a Databricks account admin. The account admin who + creates the storage credential can delegate ownership to another user or group to manage + permissions on it.""" + + self.system_schemas: SystemSchemasAPI = SystemSchemasAPI(self.api_client) + """A system schema is a schema that lives within the system catalog. A system schema may + contain information about customer usage of Unity Catalog such as audit-logs, billing-logs, + lineage information, etc.""" + + self.table_constraints: TableConstraintsAPI = TableConstraintsAPI(self.api_client) + """Primary key and foreign key constraints encode relationships between fields in tables. + + Primary and foreign keys are informational only and are not enforced. Foreign keys must + reference a primary key in another table. This primary key is the parent constraint of the + foreign key and the table this primary key is on is the parent table of the foreign key. + Similarly, the foreign key is the child constraint of its referenced primary key; the table + of the foreign key is the child table of the primary key. + + You can declare primary keys and foreign keys as part of the table specification during + table creation. You can also add or drop constraints on existing tables.""" + + self.tables: TablesAPI = TablesAPI(self.api_client) + """A table resides in the third layer of Unity Catalog’s three-level namespace. It contains + rows of data. To create a table, users must have CREATE_TABLE and USE_SCHEMA permissions on + the schema, and they must have the USE_CATALOG permission on its parent catalog. To query a + table, users must have the SELECT permission on the table, and they must have the + USE_CATALOG permission on its parent catalog and the USE_SCHEMA permission on its parent + schema. + + A table can be managed or external. From an API perspective, a __VIEW__ is a particular kind + of table (rather than a managed or external table).""" + + self.token_management: TokenManagementAPI = TokenManagementAPI(self.api_client) + """Enables administrators to get all tokens and delete tokens for other users. Admins can + either get every token, get a specific token by ID, or get all tokens for a particular user.""" + + self.tokens: TokensAPI = TokensAPI(self.api_client) + """The Token API allows you to create, list, and revoke tokens that can be used to authenticate + and access Databricks REST APIs.""" + + self.users: UsersAPI = UsersAPI(self.api_client) + """User identities recognized by Databricks and represented by email addresses. + + Databricks recommends using SCIM provisioning to sync users and groups automatically from + your identity provider to your Databricks workspace. SCIM streamlines onboarding a new + employee or team by using your identity provider to create users and groups in Databricks + workspace and give them the proper level of access. When a user leaves your organization or + no longer needs access to Databricks workspace, admins can terminate the user in your + identity provider and that user’s account will also be removed from Databricks workspace. + This ensures a consistent offboarding process and prevents unauthorized users from accessing + sensitive data.""" + + self.volumes: VolumesAPI = VolumesAPI(self.api_client) + """Volumes are a Unity Catalog (UC) capability for accessing, storing, governing, organizing + and processing files. Use cases include running machine learning on unstructured data such + as image, audio, video, or PDF files, organizing data sets during the data exploration + stages in data science, working with libraries that require access to the local file system + on cluster machines, storing library and config files of arbitrary formats such as .whl or + .txt centrally and providing secure access across workspaces to it, or transforming and + querying non-tabular data files in ETL.""" + + self.warehouses: WarehousesAPI = WarehousesAPI(self.api_client) + """A SQL warehouse is a compute resource that lets you run SQL commands on data objects within + Databricks SQL. Compute resources are infrastructure resources that provide processing + capabilities in the cloud.""" + + self.workspace: WorkspaceExt = WorkspaceExt(self.api_client) + """The Workspace API allows you to list, import, export, and delete notebooks and folders. + + A notebook is a web-based interface to a document that contains runnable code, + visualizations, and explanatory text.""" + + self.workspace_bindings: WorkspaceBindingsAPI = WorkspaceBindingsAPI(self.api_client) + """A securable in Databricks can be configured as __OPEN__ or __ISOLATED__. An __OPEN__ + securable can be accessed from any workspace, while an __ISOLATED__ securable can only be + accessed from a configured list of workspaces. This API allows you to configure (bind) + securables to workspaces. + + NOTE: The __isolation_mode__ is configured for the securable itself (using its Update + method) and the workspace bindings are only consulted when the securable's + __isolation_mode__ is set to __ISOLATED__. + + A securable's workspace bindings can be configured by a metastore admin or the owner of the + securable. + + The original path (/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}) is deprecated. + Please use the new path (/api/2.1/unity-catalog/bindings/{securable_type}/{securable_name}) + which introduces the ability to bind a securable in READ_ONLY mode (catalogs only). + + Securables that support binding: - catalog""" + + self.workspace_conf: WorkspaceConfAPI = WorkspaceConfAPI(self.api_client) + """This API allows updating known workspace settings for advanced users.""" class AccountClient: + """ + The AccountClient is a client for the account-level Databricks REST API. + """ def __init__(self, *, @@ -257,29 +944,244 @@ def __init__(self, product_version=product_version) self.config = config.copy() self.api_client = client.ApiClient(self.config) - self.access_control = AccountAccessControlAPI(self.api_client) - self.billable_usage = BillableUsageAPI(self.api_client) - self.budgets = BudgetsAPI(self.api_client) - self.credentials = CredentialsAPI(self.api_client) - self.custom_app_integration = CustomAppIntegrationAPI(self.api_client) - self.encryption_keys = EncryptionKeysAPI(self.api_client) - self.groups = AccountGroupsAPI(self.api_client) - self.ip_access_lists = AccountIpAccessListsAPI(self.api_client) - self.log_delivery = LogDeliveryAPI(self.api_client) - self.metastore_assignments = AccountMetastoreAssignmentsAPI(self.api_client) - self.metastores = AccountMetastoresAPI(self.api_client) - self.network_connectivity = NetworkConnectivityAPI(self.api_client) - self.network_policy = AccountNetworkPolicyAPI(self.api_client) - self.networks = NetworksAPI(self.api_client) - self.o_auth_published_apps = OAuthPublishedAppsAPI(self.api_client) - self.private_access = PrivateAccessAPI(self.api_client) - self.published_app_integration = PublishedAppIntegrationAPI(self.api_client) - self.service_principal_secrets = ServicePrincipalSecretsAPI(self.api_client) - self.service_principals = AccountServicePrincipalsAPI(self.api_client) - self.settings = AccountSettingsAPI(self.api_client) - self.storage = StorageAPI(self.api_client) - self.storage_credentials = AccountStorageCredentialsAPI(self.api_client) - self.users = AccountUsersAPI(self.api_client) - self.vpc_endpoints = VpcEndpointsAPI(self.api_client) - self.workspace_assignment = WorkspaceAssignmentAPI(self.api_client) - self.workspaces = WorkspacesAPI(self.api_client) + self.account_access_control: AccountAccessControlAPI = AccountAccessControlAPI(self.api_client) + """These APIs manage access rules on resources in an account. Currently, only grant rules are + supported. A grant rule specifies a role assigned to a set of principals. A list of rules + attached to a resource is called a rule set.""" + + self.billable_usage: BillableUsageAPI = BillableUsageAPI(self.api_client) + """This API allows you to download billable usage logs for the specified account and date + range. This feature works with all account types.""" + + self.budgets: BudgetsAPI = BudgetsAPI(self.api_client) + """These APIs manage budget configuration including notifications for exceeding a budget for a + period. They can also retrieve the status of each budget.""" + + self.credentials: CredentialsAPI = CredentialsAPI(self.api_client) + """These APIs manage credential configurations for this workspace. Databricks needs access to a + cross-account service IAM role in your AWS account so that Databricks can deploy clusters in + the appropriate VPC for the new workspace. A credential configuration encapsulates this role + information, and its ID is used when creating a new workspace.""" + + self.custom_app_integration: CustomAppIntegrationAPI = CustomAppIntegrationAPI(self.api_client) + """These APIs enable administrators to manage custom oauth app integrations, which is required + for adding/using Custom OAuth App Integration like Tableau Cloud for Databricks in AWS + cloud.""" + + self.encryption_keys: EncryptionKeysAPI = EncryptionKeysAPI(self.api_client) + """These APIs manage encryption key configurations for this workspace (optional). A key + configuration encapsulates the AWS KMS key information and some information about how the + key configuration can be used. There are two possible uses for key configurations: + + * Managed services: A key configuration can be used to encrypt a workspace's notebook and + secret data in the control plane, as well as Databricks SQL queries and query history. * + Storage: A key configuration can be used to encrypt a workspace's DBFS and EBS data in the + data plane. + + In both of these cases, the key configuration's ID is used when creating a new workspace. + This Preview feature is available if your account is on the E2 version of the platform. + Updating a running workspace with workspace storage encryption requires that the workspace + is on the E2 version of the platform. If you have an older workspace, it might not be on the + E2 version of the platform. If you are not sure, contact your Databricks representative.""" + + self.account_groups: AccountGroupsAPI = AccountGroupsAPI(self.api_client) + """Groups simplify identity management, making it easier to assign access to Databricks + account, data, and other securable objects. + + It is best practice to assign access to workspaces and access-control policies in Unity + Catalog to groups, instead of to users individually. All Databricks account identities can + be assigned as members of groups, and members inherit permissions that are assigned to their + group.""" + + self.account_ip_access_lists: AccountIpAccessListsAPI = AccountIpAccessListsAPI(self.api_client) + """The Accounts IP Access List API enables account admins to configure IP access lists for + access to the account console. + + Account IP Access Lists affect web application access and REST API access to the account + console and account APIs. If the feature is disabled for the account, all access is allowed + for this account. There is support for allow lists (inclusion) and block lists (exclusion). + + When a connection is attempted: 1. **First, all block lists are checked.** If the connection + IP address matches any block list, the connection is rejected. 2. **If the connection was + not rejected by block lists**, the IP address is compared with the allow lists. + + If there is at least one allow list for the account, the connection is allowed only if the + IP address matches an allow list. If there are no allow lists for the account, all IP + addresses are allowed. + + For all allow lists and block lists combined, the account supports a maximum of 1000 IP/CIDR + values, where one CIDR counts as a single value. + + After changes to the account-level IP access lists, it can take a few minutes for changes to + take effect.""" + + self.log_delivery: LogDeliveryAPI = LogDeliveryAPI(self.api_client) + """These APIs manage log delivery configurations for this account. The two supported log types + for this API are _billable usage logs_ and _audit logs_. This feature is in Public Preview. + This feature works with all account ID types. + + Log delivery works with all account types. However, if your account is on the E2 version of + the platform or on a select custom plan that allows multiple workspaces per account, you can + optionally configure different storage destinations for each workspace. Log delivery status + is also provided to know the latest status of log delivery attempts. The high-level flow of + billable usage delivery: + + 1. **Create storage**: In AWS, [create a new AWS S3 bucket] with a specific bucket policy. + Using Databricks APIs, call the Account API to create a [storage configuration + object](:method:Storage/Create) that uses the bucket name. 2. **Create credentials**: In + AWS, create the appropriate AWS IAM role. For full details, including the required IAM role + policies and trust relationship, see [Billable usage log delivery]. Using Databricks APIs, + call the Account API to create a [credential configuration + object](:method:Credentials/Create) that uses the IAM role"s ARN. 3. **Create log delivery + configuration**: Using Databricks APIs, call the Account API to [create a log delivery + configuration](:method:LogDelivery/Create) that uses the credential and storage + configuration objects from previous steps. You can specify if the logs should include all + events of that log type in your account (_Account level_ delivery) or only events for a + specific set of workspaces (_workspace level_ delivery). Account level log delivery applies + to all current and future workspaces plus account level logs, while workspace level log + delivery solely delivers logs related to the specified workspaces. You can create multiple + types of delivery configurations per account. + + For billable usage delivery: * For more information about billable usage logs, see [Billable + usage log delivery]. For the CSV schema, see the [Usage page]. * The delivery location is + `//billable-usage/csv/`, where `` is the name of the optional + delivery path prefix you set up during log delivery configuration. Files are named + `workspaceId=-usageMonth=.csv`. * All billable usage logs apply to + specific workspaces (_workspace level_ logs). You can aggregate usage for your entire + account by creating an _account level_ delivery configuration that delivers logs for all + current and future workspaces in your account. * The files are delivered daily by + overwriting the month's CSV file for each workspace. + + For audit log delivery: * For more information about about audit log delivery, see [Audit + log delivery], which includes information about the used JSON schema. * The delivery + location is + `//workspaceId=/date=/auditlogs_.json`. + Files may get overwritten with the same content multiple times to achieve exactly-once + delivery. * If the audit log delivery configuration included specific workspace IDs, only + _workspace-level_ audit logs for those workspaces are delivered. If the log delivery + configuration applies to the entire account (_account level_ delivery configuration), the + audit log delivery includes workspace-level audit logs for all workspaces in the account as + well as account-level audit logs. See [Audit log delivery] for details. * Auditable events + are typically available in logs within 15 minutes. + + [Audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [Billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html + [Usage page]: https://docs.databricks.com/administration-guide/account-settings/usage.html + [create a new AWS S3 bucket]: https://docs.databricks.com/administration-guide/account-api/aws-storage.html""" + + self.account_metastore_assignments: AccountMetastoreAssignmentsAPI = AccountMetastoreAssignmentsAPI( + self.api_client) + """These APIs manage metastore assignments to a workspace.""" + + self.account_metastores: AccountMetastoresAPI = AccountMetastoresAPI(self.api_client) + """These APIs manage Unity Catalog metastores for an account. A metastore contains catalogs + that can be associated with workspaces""" + + self.network_connectivity: NetworkConnectivityAPI = NetworkConnectivityAPI(self.api_client) + """These APIs provide configurations for the network connectivity of your workspaces for + serverless compute resources. This API provides stable subnets for your workspace so that + you can configure your firewalls on your Azure Storage accounts to allow access from + Databricks. You can also use the API to provision private endpoints for Databricks to + privately connect serverless compute resources to your Azure resources using Azure Private + Link. See [configure serverless secure connectivity]. + + [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security""" + + self.account_network_policy: AccountNetworkPolicyAPI = AccountNetworkPolicyAPI(self.api_client) + """Network policy is a set of rules that defines what can be accessed from your Databricks + network. E.g.: You can choose to block your SQL UDF to access internet from your Databricks + serverless clusters. + + There is only one instance of this setting per account. Since this setting has a default + value, this setting is present on all accounts even though it's never set on a given + account. Deletion reverts the value of the setting back to the default value.""" + + self.networks: NetworksAPI = NetworksAPI(self.api_client) + """These APIs manage network configurations for customer-managed VPCs (optional). Its ID is + used when creating a new workspace if you use customer-managed VPCs.""" + + self.o_auth_published_apps: OAuthPublishedAppsAPI = OAuthPublishedAppsAPI(self.api_client) + """These APIs enable administrators to view all the available published OAuth applications in + Databricks. Administrators can add the published OAuth applications to their account through + the OAuth Published App Integration APIs.""" + + self.private_access: PrivateAccessAPI = PrivateAccessAPI(self.api_client) + """These APIs manage private access settings for this account.""" + + self.published_app_integration: PublishedAppIntegrationAPI = PublishedAppIntegrationAPI( + self.api_client) + """These APIs enable administrators to manage published oauth app integrations, which is + required for adding/using Published OAuth App Integration like Tableau Desktop for + Databricks in AWS cloud.""" + + self.service_principal_secrets: ServicePrincipalSecretsAPI = ServicePrincipalSecretsAPI( + self.api_client) + """These APIs enable administrators to manage service principal secrets. + + You can use the generated secrets to obtain OAuth access tokens for a service principal, + which can then be used to access Databricks Accounts and Workspace APIs. For more + information, see [Authentication using OAuth tokens for service principals], + + In addition, the generated secrets can be used to configure the Databricks Terraform + Provider to authenticate with the service principal. For more information, see [Databricks + Terraform Provider]. + + [Authentication using OAuth tokens for service principals]: https://docs.databricks.com/dev-tools/authentication-oauth.html + [Databricks Terraform Provider]: https://github.com/databricks/terraform-provider-databricks/blob/master/docs/index.md#authenticating-with-service-principal""" + + self.account_service_principals: AccountServicePrincipalsAPI = AccountServicePrincipalsAPI( + self.api_client) + """Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD + platforms. Databricks recommends creating service principals to run production jobs or + modify production data. If all processes that act on production data run with service + principals, interactive users do not need any write, delete, or modify privileges in + production. This eliminates the risk of a user overwriting production data by accident.""" + + self.account_settings: AccountSettingsAPI = AccountSettingsAPI(self.api_client) + """The Personal Compute enablement setting lets you control which users can use the Personal + Compute default policy to create compute resources. By default all users in all workspaces + have access (ON), but you can change the setting to instead let individual workspaces + configure access control (DELEGATE). + + There is only one instance of this setting per account. Since this setting has a default + value, this setting is present on all accounts even though it's never set on a given + account. Deletion reverts the value of the setting back to the default value.""" + + self.storage: StorageAPI = StorageAPI(self.api_client) + """These APIs manage storage configurations for this workspace. A root storage S3 bucket in + your account is required to store objects like cluster logs, notebook revisions, and job + results. You can also use the root storage S3 bucket for storage of non-production DBFS + data. A storage configuration encapsulates this bucket information, and its ID is used when + creating a new workspace.""" + + self.account_storage_credentials: AccountStorageCredentialsAPI = AccountStorageCredentialsAPI( + self.api_client) + """These APIs manage storage credentials for a particular metastore.""" + + self.account_users: AccountUsersAPI = AccountUsersAPI(self.api_client) + """User identities recognized by Databricks and represented by email addresses. + + Databricks recommends using SCIM provisioning to sync users and groups automatically from + your identity provider to your Databricks account. SCIM streamlines onboarding a new + employee or team by using your identity provider to create users and groups in Databricks + account and give them the proper level of access. When a user leaves your organization or no + longer needs access to Databricks account, admins can terminate the user in your identity + provider and that user’s account will also be removed from Databricks account. This + ensures a consistent offboarding process and prevents unauthorized users from accessing + sensitive data.""" + + self.vpc_endpoints: VpcEndpointsAPI = VpcEndpointsAPI(self.api_client) + """These APIs manage VPC endpoint configurations for this account.""" + + self.workspace_assignment: WorkspaceAssignmentAPI = WorkspaceAssignmentAPI(self.api_client) + """The Workspace Permission Assignment API allows you to manage workspace permissions for + principals in your account.""" + + self.workspaces: WorkspacesAPI = WorkspacesAPI(self.api_client) + """These APIs manage workspaces for this account. A Databricks workspace is an environment for + accessing all of your Databricks assets. The workspace organizes objects (notebooks, + libraries, and experiments) into folders, and provides access to data and computational + resources such as clusters and jobs. + + These endpoints are available if your account is on the E2 version of the platform or on a + select custom plan that allows multiple workspaces per account.""" diff --git a/databricks/sdk/core.py b/databricks/sdk/core.py index 690e9cb45..e3d4f8cc9 100644 --- a/databricks/sdk/core.py +++ b/databricks/sdk/core.py @@ -652,28 +652,28 @@ def __repr__(self) -> str: class Config: - host = ConfigAttribute(env='DATABRICKS_HOST') - account_id = ConfigAttribute(env='DATABRICKS_ACCOUNT_ID') - token = ConfigAttribute(env='DATABRICKS_TOKEN', auth='pat', sensitive=True) - username = ConfigAttribute(env='DATABRICKS_USERNAME', auth='basic') - password = ConfigAttribute(env='DATABRICKS_PASSWORD', auth='basic', sensitive=True) - client_id = ConfigAttribute(env='DATABRICKS_CLIENT_ID', auth='oauth') - client_secret = ConfigAttribute(env='DATABRICKS_CLIENT_SECRET', auth='oauth', sensitive=True) - profile = ConfigAttribute(env='DATABRICKS_CONFIG_PROFILE') - config_file = ConfigAttribute(env='DATABRICKS_CONFIG_FILE') - google_service_account = ConfigAttribute(env='DATABRICKS_GOOGLE_SERVICE_ACCOUNT', auth='google') - google_credentials = ConfigAttribute(env='GOOGLE_CREDENTIALS', auth='google', sensitive=True) - azure_workspace_resource_id = ConfigAttribute(env='DATABRICKS_AZURE_RESOURCE_ID', auth='azure') + host: str = ConfigAttribute(env='DATABRICKS_HOST') + account_id: str = ConfigAttribute(env='DATABRICKS_ACCOUNT_ID') + token: str = ConfigAttribute(env='DATABRICKS_TOKEN', auth='pat', sensitive=True) + username: str = ConfigAttribute(env='DATABRICKS_USERNAME', auth='basic') + password: str = ConfigAttribute(env='DATABRICKS_PASSWORD', auth='basic', sensitive=True) + client_id: str = ConfigAttribute(env='DATABRICKS_CLIENT_ID', auth='oauth') + client_secret: str = ConfigAttribute(env='DATABRICKS_CLIENT_SECRET', auth='oauth', sensitive=True) + profile: str = ConfigAttribute(env='DATABRICKS_CONFIG_PROFILE') + config_file: str = ConfigAttribute(env='DATABRICKS_CONFIG_FILE') + google_service_account: str = ConfigAttribute(env='DATABRICKS_GOOGLE_SERVICE_ACCOUNT', auth='google') + google_credentials: str = ConfigAttribute(env='GOOGLE_CREDENTIALS', auth='google', sensitive=True) + azure_workspace_resource_id: str = ConfigAttribute(env='DATABRICKS_AZURE_RESOURCE_ID', auth='azure') azure_use_msi: bool = ConfigAttribute(env='ARM_USE_MSI', auth='azure') - azure_client_secret = ConfigAttribute(env='ARM_CLIENT_SECRET', auth='azure', sensitive=True) - azure_client_id = ConfigAttribute(env='ARM_CLIENT_ID', auth='azure') - azure_tenant_id = ConfigAttribute(env='ARM_TENANT_ID', auth='azure') - azure_environment = ConfigAttribute(env='ARM_ENVIRONMENT') - azure_login_app_id = ConfigAttribute(env='DATABRICKS_AZURE_LOGIN_APP_ID', auth='azure') - databricks_cli_path = ConfigAttribute(env='DATABRICKS_CLI_PATH') - auth_type = ConfigAttribute(env='DATABRICKS_AUTH_TYPE') - cluster_id = ConfigAttribute(env='DATABRICKS_CLUSTER_ID') - warehouse_id = ConfigAttribute(env='DATABRICKS_WAREHOUSE_ID') + azure_client_secret: str = ConfigAttribute(env='ARM_CLIENT_SECRET', auth='azure', sensitive=True) + azure_client_id: str = ConfigAttribute(env='ARM_CLIENT_ID', auth='azure') + azure_tenant_id: str = ConfigAttribute(env='ARM_TENANT_ID', auth='azure') + azure_environment: str = ConfigAttribute(env='ARM_ENVIRONMENT') + azure_login_app_id: str = ConfigAttribute(env='DATABRICKS_AZURE_LOGIN_APP_ID', auth='azure') + databricks_cli_path: str = ConfigAttribute(env='DATABRICKS_CLI_PATH') + auth_type: str = ConfigAttribute(env='DATABRICKS_AUTH_TYPE') + cluster_id: str = ConfigAttribute(env='DATABRICKS_CLUSTER_ID') + warehouse_id: str = ConfigAttribute(env='DATABRICKS_WAREHOUSE_ID') skip_verify: bool = ConfigAttribute() http_timeout_seconds: int = ConfigAttribute() debug_truncate_bytes: int = ConfigAttribute(env='DATABRICKS_DEBUG_TRUNCATE_BYTES') diff --git a/databricks/sdk/errors/mapping.py b/databricks/sdk/errors/mapping.py index 1769c0bb2..df25fad4b 100755 --- a/databricks/sdk/errors/mapping.py +++ b/databricks/sdk/errors/mapping.py @@ -51,6 +51,10 @@ class InvalidParameterValue(BadRequest): """supplied value for a parameter was invalid""" +class ResourceDoesNotExist(NotFound): + """operation was performed on a resource that does not exist""" + + class Aborted(ResourceConflict): """the operation was aborted, typically due to a concurrency issue such as a sequencer check failure""" @@ -96,6 +100,7 @@ class DataLoss(InternalError): ERROR_CODE_MAPPING = { 'INVALID_PARAMETER_VALUE': InvalidParameterValue, + 'RESOURCE_DOES_NOT_EXIST': ResourceDoesNotExist, 'ABORTED': Aborted, 'ALREADY_EXISTS': AlreadyExists, 'RESOURCE_ALREADY_EXISTS': ResourceAlreadyExists, diff --git a/databricks/sdk/service/billing.py b/databricks/sdk/service/billing.py index c500f443a..b91a55596 100755 --- a/databricks/sdk/service/billing.py +++ b/databricks/sdk/service/billing.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -17,14 +19,41 @@ class Budget: """Budget configuration to be created.""" name: str + """Human-readable name of the budget.""" + period: str + """Period length in years, months, weeks and/or days. Examples: `1 month`, `30 days`, `1 year, 2 + months, 1 week, 2 days`""" + start_date: str + """Start date of the budget period calculation.""" + target_amount: str + """Target amount of the budget per period in USD.""" + filter: str - alerts: Optional['List[BudgetAlert]'] = None + """SQL-like filter expression with workspaceId, SKU and tag. Usage in your account that matches + this expression will be counted in this budget. + + Supported properties on left-hand side of comparison: * `workspaceId` - the ID of the workspace + * `sku` - SKU of the cluster, e.g. `STANDARD_ALL_PURPOSE_COMPUTE` * `tag.tagName`, `tag.'tag + name'` - tag of the cluster + + Supported comparison operators: * `=` - equal * `!=` - not equal + + Supported logical operators: `AND`, `OR`. + + Examples: * `workspaceId=123 OR (sku='STANDARD_ALL_PURPOSE_COMPUTE' AND tag.'my tag'='my + value')` * `workspaceId!=456` * `sku='STANDARD_ALL_PURPOSE_COMPUTE' OR + sku='PREMIUM_ALL_PURPOSE_COMPUTE'` * `tag.name1='value1' AND tag.name2='value2'`""" + + alerts: Optional[List[BudgetAlert]] = None + end_date: Optional[str] = None + """Optional end date of the budget.""" def as_dict(self) -> dict: + """Serializes the Budget into a dictionary suitable for use as a JSON request body.""" body = {} if self.alerts: body['alerts'] = [v.as_dict() for v in self.alerts] if self.end_date is not None: body['end_date'] = self.end_date @@ -36,7 +65,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Budget': + def from_dict(cls, d: Dict[str, any]) -> Budget: + """Deserializes the Budget from a dictionary.""" return cls(alerts=_repeated_dict(d, 'alerts', BudgetAlert), end_date=d.get('end_date', None), filter=d.get('filter', None), @@ -48,17 +78,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'Budget': @dataclass class BudgetAlert: - email_notifications: Optional['List[str]'] = None + email_notifications: Optional[List[str]] = None + """List of email addresses to be notified when budget percentage is exceeded in the given period.""" + min_percentage: Optional[int] = None + """Percentage of the target amount used in the currect period that will trigger a notification.""" def as_dict(self) -> dict: + """Serializes the BudgetAlert into a dictionary suitable for use as a JSON request body.""" body = {} if self.email_notifications: body['email_notifications'] = [v for v in self.email_notifications] if self.min_percentage is not None: body['min_percentage'] = self.min_percentage return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BudgetAlert': + def from_dict(cls, d: Dict[str, any]) -> BudgetAlert: + """Deserializes the BudgetAlert from a dictionary.""" return cls(email_notifications=d.get('email_notifications', None), min_percentage=d.get('min_percentage', None)) @@ -67,15 +102,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'BudgetAlert': class BudgetList: """List of budgets.""" - budgets: Optional['List[BudgetWithStatus]'] = None + budgets: Optional[List[BudgetWithStatus]] = None def as_dict(self) -> dict: + """Serializes the BudgetList into a dictionary suitable for use as a JSON request body.""" body = {} if self.budgets: body['budgets'] = [v.as_dict() for v in self.budgets] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BudgetList': + def from_dict(cls, d: Dict[str, any]) -> BudgetList: + """Deserializes the BudgetList from a dictionary.""" return cls(budgets=_repeated_dict(d, 'budgets', BudgetWithStatus)) @@ -83,19 +120,51 @@ def from_dict(cls, d: Dict[str, any]) -> 'BudgetList': class BudgetWithStatus: """Budget configuration with daily status.""" - alerts: Optional['List[BudgetAlert]'] = None + alerts: Optional[List[BudgetAlert]] = None + budget_id: Optional[str] = None + creation_time: Optional[str] = None + end_date: Optional[str] = None + """Optional end date of the budget.""" + filter: Optional[str] = None + """SQL-like filter expression with workspaceId, SKU and tag. Usage in your account that matches + this expression will be counted in this budget. + + Supported properties on left-hand side of comparison: * `workspaceId` - the ID of the workspace + * `sku` - SKU of the cluster, e.g. `STANDARD_ALL_PURPOSE_COMPUTE` * `tag.tagName`, `tag.'tag + name'` - tag of the cluster + + Supported comparison operators: * `=` - equal * `!=` - not equal + + Supported logical operators: `AND`, `OR`. + + Examples: * `workspaceId=123 OR (sku='STANDARD_ALL_PURPOSE_COMPUTE' AND tag.'my tag'='my + value')` * `workspaceId!=456` * `sku='STANDARD_ALL_PURPOSE_COMPUTE' OR + sku='PREMIUM_ALL_PURPOSE_COMPUTE'` * `tag.name1='value1' AND tag.name2='value2'`""" + name: Optional[str] = None + """Human-readable name of the budget.""" + period: Optional[str] = None + """Period length in years, months, weeks and/or days. Examples: `1 month`, `30 days`, `1 year, 2 + months, 1 week, 2 days`""" + start_date: Optional[str] = None - status_daily: Optional['List[BudgetWithStatusStatusDailyItem]'] = None + """Start date of the budget period calculation.""" + + status_daily: Optional[List[BudgetWithStatusStatusDailyItem]] = None + """Amount used in the budget for each day (noncumulative).""" + target_amount: Optional[str] = None + """Target amount of the budget per period in USD.""" + update_time: Optional[str] = None def as_dict(self) -> dict: + """Serializes the BudgetWithStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.alerts: body['alerts'] = [v.as_dict() for v in self.alerts] if self.budget_id is not None: body['budget_id'] = self.budget_id @@ -111,7 +180,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BudgetWithStatus': + def from_dict(cls, d: Dict[str, any]) -> BudgetWithStatus: + """Deserializes the BudgetWithStatus from a dictionary.""" return cls(alerts=_repeated_dict(d, 'alerts', BudgetAlert), budget_id=d.get('budget_id', None), creation_time=d.get('creation_time', None), @@ -128,32 +198,96 @@ def from_dict(cls, d: Dict[str, any]) -> 'BudgetWithStatus': @dataclass class BudgetWithStatusStatusDailyItem: amount: Optional[str] = None + """Amount used in this day in USD.""" + date: Optional[str] = None def as_dict(self) -> dict: + """Serializes the BudgetWithStatusStatusDailyItem into a dictionary suitable for use as a JSON request body.""" body = {} if self.amount is not None: body['amount'] = self.amount if self.date is not None: body['date'] = self.date return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BudgetWithStatusStatusDailyItem': + def from_dict(cls, d: Dict[str, any]) -> BudgetWithStatusStatusDailyItem: + """Deserializes the BudgetWithStatusStatusDailyItem from a dictionary.""" return cls(amount=d.get('amount', None), date=d.get('date', None)) @dataclass class CreateLogDeliveryConfigurationParams: - log_type: 'LogType' - output_format: 'OutputFormat' + log_type: LogType + """Log delivery type. Supported values are: + + * `BILLABLE_USAGE` — Configure [billable usage log delivery]. For the CSV schema, see the + [View billable usage]. + + * `AUDIT_LOGS` — Configure [audit log delivery]. For the JSON schema, see [Configure audit + logging] + + [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html + [audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html""" + + output_format: OutputFormat + """The file type of log delivery. + + * If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the CSV (comma-separated + values) format is supported. For the schema, see the [View billable usage] * If `log_type` is + `AUDIT_LOGS`, this value must be `JSON`. Only the JSON (JavaScript Object Notation) format is + supported. For the schema, see the [Configuring audit logs]. + + [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html""" + credentials_id: str + """The ID for a method:credentials/create that represents the AWS IAM role with policy and trust + relationship as described in the main billable usage documentation page. See [Configure billable + usage delivery]. + + [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html""" + storage_configuration_id: str + """The ID for a method:storage/create that represents the S3 bucket with bucket policy as described + in the main billable usage documentation page. See [Configure billable usage delivery]. + + [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html""" + config_name: Optional[str] = None + """The optional human-readable name of the log delivery configuration. Defaults to empty.""" + delivery_path_prefix: Optional[str] = None + """The optional delivery path prefix within Amazon S3 storage. Defaults to empty, which means that + logs are delivered to the root of the bucket. This must be a valid S3 object key. This must not + start or end with a slash character.""" + delivery_start_time: Optional[str] = None - status: Optional['LogDeliveryConfigStatus'] = None - workspace_ids_filter: Optional['List[int]'] = None + """This field applies only if `log_type` is `BILLABLE_USAGE`. This is the optional start month and + year for delivery, specified in `YYYY-MM` format. Defaults to current year and month. + `BILLABLE_USAGE` logs are not available for usage before March 2019 (`2019-03`).""" + + status: Optional[LogDeliveryConfigStatus] = None + """Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). + Defaults to `ENABLED`. You can [enable or disable the + configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration + is not supported, so disable a log delivery configuration that is no longer needed.""" + + workspace_ids_filter: Optional[List[int]] = None + """Optional filter that specifies workspace IDs to deliver logs for. By default the workspace + filter is empty and log delivery applies at the account level, delivering workspace-level logs + for all workspaces in your account, plus account level logs. You can optionally set this field + to an array of workspace IDs (each one is an `int64`) to which log delivery should apply, in + which case only workspace-level logs relating to the specified workspaces are delivered. If you + plan to use different log delivery configurations for different workspaces, set this field + explicitly. Be aware that delivery configurations mentioning specific workspaces won't apply to + new workspaces created in the future, and delivery won't include account level logs. For some + types of Databricks deployments there is only one workspace per account ID, so this field is + unnecessary.""" def as_dict(self) -> dict: + """Serializes the CreateLogDeliveryConfigurationParams into a dictionary suitable for use as a JSON request body.""" body = {} if self.config_name is not None: body['config_name'] = self.config_name if self.credentials_id is not None: body['credentials_id'] = self.credentials_id @@ -168,7 +302,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateLogDeliveryConfigurationParams': + def from_dict(cls, d: Dict[str, any]) -> CreateLogDeliveryConfigurationParams: + """Deserializes the CreateLogDeliveryConfigurationParams from a dictionary.""" return cls(config_name=d.get('config_name', None), credentials_id=d.get('credentials_id', None), delivery_path_prefix=d.get('delivery_path_prefix', None), @@ -214,21 +349,91 @@ class LogDeliveryConfigStatus(Enum): @dataclass class LogDeliveryConfiguration: account_id: Optional[str] = None + """The Databricks account ID that hosts the log delivery configuration.""" + config_id: Optional[str] = None + """Databricks log delivery configuration ID.""" + config_name: Optional[str] = None + """The optional human-readable name of the log delivery configuration. Defaults to empty.""" + creation_time: Optional[int] = None + """Time in epoch milliseconds when the log delivery configuration was created.""" + credentials_id: Optional[str] = None + """The ID for a method:credentials/create that represents the AWS IAM role with policy and trust + relationship as described in the main billable usage documentation page. See [Configure billable + usage delivery]. + + [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html""" + delivery_path_prefix: Optional[str] = None + """The optional delivery path prefix within Amazon S3 storage. Defaults to empty, which means that + logs are delivered to the root of the bucket. This must be a valid S3 object key. This must not + start or end with a slash character.""" + delivery_start_time: Optional[str] = None - log_delivery_status: Optional['LogDeliveryStatus'] = None - log_type: Optional['LogType'] = None - output_format: Optional['OutputFormat'] = None - status: Optional['LogDeliveryConfigStatus'] = None + """This field applies only if `log_type` is `BILLABLE_USAGE`. This is the optional start month and + year for delivery, specified in `YYYY-MM` format. Defaults to current year and month. + `BILLABLE_USAGE` logs are not available for usage before March 2019 (`2019-03`).""" + + log_delivery_status: Optional[LogDeliveryStatus] = None + """Databricks log delivery status.""" + + log_type: Optional[LogType] = None + """Log delivery type. Supported values are: + + * `BILLABLE_USAGE` — Configure [billable usage log delivery]. For the CSV schema, see the + [View billable usage]. + + * `AUDIT_LOGS` — Configure [audit log delivery]. For the JSON schema, see [Configure audit + logging] + + [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html + [audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html""" + + output_format: Optional[OutputFormat] = None + """The file type of log delivery. + + * If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the CSV (comma-separated + values) format is supported. For the schema, see the [View billable usage] * If `log_type` is + `AUDIT_LOGS`, this value must be `JSON`. Only the JSON (JavaScript Object Notation) format is + supported. For the schema, see the [Configuring audit logs]. + + [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html""" + + status: Optional[LogDeliveryConfigStatus] = None + """Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). + Defaults to `ENABLED`. You can [enable or disable the + configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration + is not supported, so disable a log delivery configuration that is no longer needed.""" + storage_configuration_id: Optional[str] = None + """The ID for a method:storage/create that represents the S3 bucket with bucket policy as described + in the main billable usage documentation page. See [Configure billable usage delivery]. + + [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html""" + update_time: Optional[int] = None - workspace_ids_filter: Optional['List[int]'] = None + """Time in epoch milliseconds when the log delivery configuration was updated.""" + + workspace_ids_filter: Optional[List[int]] = None + """Optional filter that specifies workspace IDs to deliver logs for. By default the workspace + filter is empty and log delivery applies at the account level, delivering workspace-level logs + for all workspaces in your account, plus account level logs. You can optionally set this field + to an array of workspace IDs (each one is an `int64`) to which log delivery should apply, in + which case only workspace-level logs relating to the specified workspaces are delivered. If you + plan to use different log delivery configurations for different workspaces, set this field + explicitly. Be aware that delivery configurations mentioning specific workspaces won't apply to + new workspaces created in the future, and delivery won't include account level logs. For some + types of Databricks deployments there is only one workspace per account ID, so this field is + unnecessary.""" def as_dict(self) -> dict: + """Serializes the LogDeliveryConfiguration into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.config_id is not None: body['config_id'] = self.config_id @@ -248,7 +453,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogDeliveryConfiguration': + def from_dict(cls, d: Dict[str, any]) -> LogDeliveryConfiguration: + """Deserializes the LogDeliveryConfiguration from a dictionary.""" return cls(account_id=d.get('account_id', None), config_id=d.get('config_id', None), config_name=d.get('config_name', None), @@ -270,11 +476,26 @@ class LogDeliveryStatus: """Databricks log delivery status.""" last_attempt_time: Optional[str] = None + """The UTC time for the latest log delivery attempt.""" + last_successful_attempt_time: Optional[str] = None + """The UTC time for the latest successful log delivery.""" + message: Optional[str] = None - status: Optional['DeliveryStatus'] = None + """Informative message about the latest log delivery attempt. If the log delivery fails with + USER_FAILURE, error details will be provided for fixing misconfigurations in cloud permissions.""" + + status: Optional[DeliveryStatus] = None + """The status string for log delivery. Possible values are: * `CREATED`: There were no log delivery + attempts since the config was created. * `SUCCEEDED`: The latest attempt of log delivery has + succeeded completely. * `USER_FAILURE`: The latest attempt of log delivery failed because of + misconfiguration of customer provided permissions on role or storage. * `SYSTEM_FAILURE`: The + latest attempt of log delivery failed because of an Databricks internal error. Contact support + if it doesn't go away soon. * `NOT_FOUND`: The log delivery status as the configuration has been + disabled since the release of this feature or there are no workspaces in the account.""" def as_dict(self) -> dict: + """Serializes the LogDeliveryStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.last_attempt_time is not None: body['last_attempt_time'] = self.last_attempt_time if self.last_successful_attempt_time is not None: @@ -284,7 +505,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogDeliveryStatus': + def from_dict(cls, d: Dict[str, any]) -> LogDeliveryStatus: + """Deserializes the LogDeliveryStatus from a dictionary.""" return cls(last_attempt_time=d.get('last_attempt_time', None), last_successful_attempt_time=d.get('last_successful_attempt_time', None), message=d.get('message', None), @@ -326,10 +548,17 @@ class OutputFormat(Enum): @dataclass class UpdateLogDeliveryConfigurationStatusRequest: - status: 'LogDeliveryConfigStatus' + status: LogDeliveryConfigStatus + """Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). + Defaults to `ENABLED`. You can [enable or disable the + configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration + is not supported, so disable a log delivery configuration that is no longer needed.""" + log_delivery_configuration_id: Optional[str] = None + """Databricks log delivery configuration ID""" def as_dict(self) -> dict: + """Serializes the UpdateLogDeliveryConfigurationStatusRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.log_delivery_configuration_id is not None: body['log_delivery_configuration_id'] = self.log_delivery_configuration_id @@ -337,85 +566,100 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateLogDeliveryConfigurationStatusRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateLogDeliveryConfigurationStatusRequest: + """Deserializes the UpdateLogDeliveryConfigurationStatusRequest from a dictionary.""" return cls(log_delivery_configuration_id=d.get('log_delivery_configuration_id', None), status=_enum(d, 'status', LogDeliveryConfigStatus)) @dataclass class WrappedBudget: - budget: 'Budget' + budget: Budget + """Budget configuration to be created.""" + budget_id: Optional[str] = None + """Budget ID""" def as_dict(self) -> dict: + """Serializes the WrappedBudget into a dictionary suitable for use as a JSON request body.""" body = {} if self.budget: body['budget'] = self.budget.as_dict() if self.budget_id is not None: body['budget_id'] = self.budget_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WrappedBudget': + def from_dict(cls, d: Dict[str, any]) -> WrappedBudget: + """Deserializes the WrappedBudget from a dictionary.""" return cls(budget=_from_dict(d, 'budget', Budget), budget_id=d.get('budget_id', None)) @dataclass class WrappedBudgetWithStatus: - budget: 'BudgetWithStatus' + budget: BudgetWithStatus + """Budget configuration with daily status.""" def as_dict(self) -> dict: + """Serializes the WrappedBudgetWithStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.budget: body['budget'] = self.budget.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WrappedBudgetWithStatus': + def from_dict(cls, d: Dict[str, any]) -> WrappedBudgetWithStatus: + """Deserializes the WrappedBudgetWithStatus from a dictionary.""" return cls(budget=_from_dict(d, 'budget', BudgetWithStatus)) @dataclass class WrappedCreateLogDeliveryConfiguration: - log_delivery_configuration: Optional['CreateLogDeliveryConfigurationParams'] = None + log_delivery_configuration: Optional[CreateLogDeliveryConfigurationParams] = None def as_dict(self) -> dict: + """Serializes the WrappedCreateLogDeliveryConfiguration into a dictionary suitable for use as a JSON request body.""" body = {} if self.log_delivery_configuration: body['log_delivery_configuration'] = self.log_delivery_configuration.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WrappedCreateLogDeliveryConfiguration': + def from_dict(cls, d: Dict[str, any]) -> WrappedCreateLogDeliveryConfiguration: + """Deserializes the WrappedCreateLogDeliveryConfiguration from a dictionary.""" return cls(log_delivery_configuration=_from_dict(d, 'log_delivery_configuration', CreateLogDeliveryConfigurationParams)) @dataclass class WrappedLogDeliveryConfiguration: - log_delivery_configuration: Optional['LogDeliveryConfiguration'] = None + log_delivery_configuration: Optional[LogDeliveryConfiguration] = None def as_dict(self) -> dict: + """Serializes the WrappedLogDeliveryConfiguration into a dictionary suitable for use as a JSON request body.""" body = {} if self.log_delivery_configuration: body['log_delivery_configuration'] = self.log_delivery_configuration.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WrappedLogDeliveryConfiguration': + def from_dict(cls, d: Dict[str, any]) -> WrappedLogDeliveryConfiguration: + """Deserializes the WrappedLogDeliveryConfiguration from a dictionary.""" return cls( log_delivery_configuration=_from_dict(d, 'log_delivery_configuration', LogDeliveryConfiguration)) @dataclass class WrappedLogDeliveryConfigurations: - log_delivery_configurations: Optional['List[LogDeliveryConfiguration]'] = None + log_delivery_configurations: Optional[List[LogDeliveryConfiguration]] = None def as_dict(self) -> dict: + """Serializes the WrappedLogDeliveryConfigurations into a dictionary suitable for use as a JSON request body.""" body = {} if self.log_delivery_configurations: body['log_delivery_configurations'] = [v.as_dict() for v in self.log_delivery_configurations] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WrappedLogDeliveryConfigurations': + def from_dict(cls, d: Dict[str, any]) -> WrappedLogDeliveryConfigurations: + """Deserializes the WrappedLogDeliveryConfigurations from a dictionary.""" return cls(log_delivery_configurations=_repeated_dict(d, 'log_delivery_configurations', LogDeliveryConfiguration)) @@ -528,7 +772,7 @@ def get(self, budget_id: str) -> WrappedBudgetWithStatus: headers=headers) return WrappedBudgetWithStatus.from_dict(res) - def list(self) -> Iterator['BudgetWithStatus']: + def list(self) -> Iterator[BudgetWithStatus]: """Get all budgets. Gets all budgets associated with this account, including noncumulative status for each day that the @@ -678,7 +922,7 @@ def list(self, *, credentials_id: Optional[str] = None, status: Optional[LogDeliveryConfigStatus] = None, - storage_configuration_id: Optional[str] = None) -> Iterator['LogDeliveryConfiguration']: + storage_configuration_id: Optional[str] = None) -> Iterator[LogDeliveryConfiguration]: """Get all log delivery configurations. Gets all Databricks log delivery configurations associated with an account specified by ID. diff --git a/databricks/sdk/service/catalog.py b/databricks/sdk/service/catalog.py index 9ea545cdf..b6bb3000b 100755 --- a/databricks/sdk/service/catalog.py +++ b/databricks/sdk/service/catalog.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -14,25 +16,32 @@ @dataclass class AccountsCreateMetastore: - metastore_info: Optional['CreateMetastore'] = None + metastore_info: Optional[CreateMetastore] = None def as_dict(self) -> dict: + """Serializes the AccountsCreateMetastore into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastore_info: body['metastore_info'] = self.metastore_info.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsCreateMetastore': + def from_dict(cls, d: Dict[str, any]) -> AccountsCreateMetastore: + """Deserializes the AccountsCreateMetastore from a dictionary.""" return cls(metastore_info=_from_dict(d, 'metastore_info', CreateMetastore)) @dataclass class AccountsCreateMetastoreAssignment: - metastore_assignment: Optional['CreateMetastoreAssignment'] = None + metastore_assignment: Optional[CreateMetastoreAssignment] = None + metastore_id: Optional[str] = None + """Unity Catalog metastore ID""" + workspace_id: Optional[int] = None + """Workspace ID.""" def as_dict(self) -> dict: + """Serializes the AccountsCreateMetastoreAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastore_assignment: body['metastore_assignment'] = self.metastore_assignment.as_dict() if self.metastore_id is not None: body['metastore_id'] = self.metastore_id @@ -40,7 +49,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsCreateMetastoreAssignment': + def from_dict(cls, d: Dict[str, any]) -> AccountsCreateMetastoreAssignment: + """Deserializes the AccountsCreateMetastoreAssignment from a dictionary.""" return cls(metastore_assignment=_from_dict(d, 'metastore_assignment', CreateMetastoreAssignment), metastore_id=d.get('metastore_id', None), workspace_id=d.get('workspace_id', None)) @@ -48,87 +58,106 @@ def from_dict(cls, d: Dict[str, any]) -> 'AccountsCreateMetastoreAssignment': @dataclass class AccountsCreateStorageCredential: - credential_info: Optional['CreateStorageCredential'] = None + credential_info: Optional[CreateStorageCredential] = None + metastore_id: Optional[str] = None + """Unity Catalog metastore ID""" def as_dict(self) -> dict: + """Serializes the AccountsCreateStorageCredential into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_info: body['credential_info'] = self.credential_info.as_dict() if self.metastore_id is not None: body['metastore_id'] = self.metastore_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsCreateStorageCredential': + def from_dict(cls, d: Dict[str, any]) -> AccountsCreateStorageCredential: + """Deserializes the AccountsCreateStorageCredential from a dictionary.""" return cls(credential_info=_from_dict(d, 'credential_info', CreateStorageCredential), metastore_id=d.get('metastore_id', None)) @dataclass class AccountsMetastoreAssignment: - metastore_assignment: Optional['MetastoreAssignment'] = None + metastore_assignment: Optional[MetastoreAssignment] = None def as_dict(self) -> dict: + """Serializes the AccountsMetastoreAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastore_assignment: body['metastore_assignment'] = self.metastore_assignment.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsMetastoreAssignment': + def from_dict(cls, d: Dict[str, any]) -> AccountsMetastoreAssignment: + """Deserializes the AccountsMetastoreAssignment from a dictionary.""" return cls(metastore_assignment=_from_dict(d, 'metastore_assignment', MetastoreAssignment)) @dataclass class AccountsMetastoreInfo: - metastore_info: Optional['MetastoreInfo'] = None + metastore_info: Optional[MetastoreInfo] = None def as_dict(self) -> dict: + """Serializes the AccountsMetastoreInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastore_info: body['metastore_info'] = self.metastore_info.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsMetastoreInfo': + def from_dict(cls, d: Dict[str, any]) -> AccountsMetastoreInfo: + """Deserializes the AccountsMetastoreInfo from a dictionary.""" return cls(metastore_info=_from_dict(d, 'metastore_info', MetastoreInfo)) @dataclass class AccountsStorageCredentialInfo: - credential_info: Optional['StorageCredentialInfo'] = None + credential_info: Optional[StorageCredentialInfo] = None def as_dict(self) -> dict: + """Serializes the AccountsStorageCredentialInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_info: body['credential_info'] = self.credential_info.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsStorageCredentialInfo': + def from_dict(cls, d: Dict[str, any]) -> AccountsStorageCredentialInfo: + """Deserializes the AccountsStorageCredentialInfo from a dictionary.""" return cls(credential_info=_from_dict(d, 'credential_info', StorageCredentialInfo)) @dataclass class AccountsUpdateMetastore: metastore_id: Optional[str] = None - metastore_info: Optional['UpdateMetastore'] = None + """Unity Catalog metastore ID""" + + metastore_info: Optional[UpdateMetastore] = None def as_dict(self) -> dict: + """Serializes the AccountsUpdateMetastore into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastore_id is not None: body['metastore_id'] = self.metastore_id if self.metastore_info: body['metastore_info'] = self.metastore_info.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsUpdateMetastore': + def from_dict(cls, d: Dict[str, any]) -> AccountsUpdateMetastore: + """Deserializes the AccountsUpdateMetastore from a dictionary.""" return cls(metastore_id=d.get('metastore_id', None), metastore_info=_from_dict(d, 'metastore_info', UpdateMetastore)) @dataclass class AccountsUpdateMetastoreAssignment: - metastore_assignment: Optional['UpdateMetastoreAssignment'] = None + metastore_assignment: Optional[UpdateMetastoreAssignment] = None + metastore_id: Optional[str] = None + """Unity Catalog metastore ID""" + workspace_id: Optional[int] = None + """Workspace ID.""" def as_dict(self) -> dict: + """Serializes the AccountsUpdateMetastoreAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastore_assignment: body['metastore_assignment'] = self.metastore_assignment.as_dict() if self.metastore_id is not None: body['metastore_id'] = self.metastore_id @@ -136,7 +165,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsUpdateMetastoreAssignment': + def from_dict(cls, d: Dict[str, any]) -> AccountsUpdateMetastoreAssignment: + """Deserializes the AccountsUpdateMetastoreAssignment from a dictionary.""" return cls(metastore_assignment=_from_dict(d, 'metastore_assignment', UpdateMetastoreAssignment), metastore_id=d.get('metastore_id', None), workspace_id=d.get('workspace_id', None)) @@ -144,11 +174,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'AccountsUpdateMetastoreAssignment': @dataclass class AccountsUpdateStorageCredential: - credential_info: Optional['UpdateStorageCredential'] = None + credential_info: Optional[UpdateStorageCredential] = None + metastore_id: Optional[str] = None + """Unity Catalog metastore ID""" + storage_credential_name: Optional[str] = None + """Name of the storage credential.""" def as_dict(self) -> dict: + """Serializes the AccountsUpdateStorageCredential into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_info: body['credential_info'] = self.credential_info.as_dict() if self.metastore_id is not None: body['metastore_id'] = self.metastore_id @@ -157,7 +192,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountsUpdateStorageCredential': + def from_dict(cls, d: Dict[str, any]) -> AccountsUpdateStorageCredential: + """Deserializes the AccountsUpdateStorageCredential from a dictionary.""" return cls(credential_info=_from_dict(d, 'credential_info', UpdateStorageCredential), metastore_id=d.get('metastore_id', None), storage_credential_name=d.get('storage_credential_name', None)) @@ -165,12 +201,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'AccountsUpdateStorageCredential': @dataclass class ArtifactAllowlistInfo: - artifact_matchers: Optional['List[ArtifactMatcher]'] = None + artifact_matchers: Optional[List[ArtifactMatcher]] = None + """A list of allowed artifact match patterns.""" + created_at: Optional[int] = None + """Time at which this artifact allowlist was set, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of the user who set the artifact allowlist.""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" def as_dict(self) -> dict: + """Serializes the ArtifactAllowlistInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact_matchers: body['artifact_matchers'] = [v.as_dict() for v in self.artifact_matchers] if self.created_at is not None: body['created_at'] = self.created_at @@ -179,7 +223,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ArtifactAllowlistInfo': + def from_dict(cls, d: Dict[str, any]) -> ArtifactAllowlistInfo: + """Deserializes the ArtifactAllowlistInfo from a dictionary.""" return cls(artifact_matchers=_repeated_dict(d, 'artifact_matchers', ArtifactMatcher), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -189,16 +234,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'ArtifactAllowlistInfo': @dataclass class ArtifactMatcher: artifact: str - match_type: 'MatchType' + """The artifact path or maven coordinate""" + + match_type: MatchType + """The pattern matching type of the artifact""" def as_dict(self) -> dict: + """Serializes the ArtifactMatcher into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact is not None: body['artifact'] = self.artifact if self.match_type is not None: body['match_type'] = self.match_type.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ArtifactMatcher': + def from_dict(cls, d: Dict[str, any]) -> ArtifactMatcher: + """Deserializes the ArtifactMatcher from a dictionary.""" return cls(artifact=d.get('artifact', None), match_type=_enum(d, 'match_type', MatchType)) @@ -213,10 +263,17 @@ class ArtifactType(Enum): @dataclass class AwsIamRole: role_arn: str + """The Amazon Resource Name (ARN) of the AWS IAM role for S3 data access.""" + external_id: Optional[str] = None + """The external ID used in role assumption to prevent confused deputy problem..""" + unity_catalog_iam_arn: Optional[str] = None + """The Amazon Resource Name (ARN) of the AWS IAM user managed by Databricks. This is the identity + that is going to assume the AWS IAM role.""" def as_dict(self) -> dict: + """Serializes the AwsIamRole into a dictionary suitable for use as a JSON request body.""" body = {} if self.external_id is not None: body['external_id'] = self.external_id if self.role_arn is not None: body['role_arn'] = self.role_arn @@ -224,7 +281,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AwsIamRole': + def from_dict(cls, d: Dict[str, any]) -> AwsIamRole: + """Deserializes the AwsIamRole from a dictionary.""" return cls(external_id=d.get('external_id', None), role_arn=d.get('role_arn', None), unity_catalog_iam_arn=d.get('unity_catalog_iam_arn', None)) @@ -233,10 +291,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'AwsIamRole': @dataclass class AzureManagedIdentity: access_connector_id: str + """The Azure resource ID of the Azure Databricks Access Connector. Use the format + /subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.Databricks/accessConnectors/{connector-name}.""" + credential_id: Optional[str] = None + """The Databricks internal ID that represents this managed identity.""" + managed_identity_id: Optional[str] = None + """The Azure resource ID of the managed identity. Use the format + /subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity-name}. + This is only available for user-assgined identities. For system-assigned identities, the + access_connector_id is used to identify the identity. If this field is not provided, then we + assume the AzureManagedIdentity is for a system-assigned identity.""" def as_dict(self) -> dict: + """Serializes the AzureManagedIdentity into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_connector_id is not None: body['access_connector_id'] = self.access_connector_id if self.credential_id is not None: body['credential_id'] = self.credential_id @@ -244,7 +313,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AzureManagedIdentity': + def from_dict(cls, d: Dict[str, any]) -> AzureManagedIdentity: + """Deserializes the AzureManagedIdentity from a dictionary.""" return cls(access_connector_id=d.get('access_connector_id', None), credential_id=d.get('credential_id', None), managed_identity_id=d.get('managed_identity_id', None)) @@ -253,10 +323,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'AzureManagedIdentity': @dataclass class AzureServicePrincipal: directory_id: str + """The directory ID corresponding to the Azure Active Directory (AAD) tenant of the application.""" + application_id: str + """The application ID of the application registration within the referenced AAD tenant.""" + client_secret: str + """The client secret generated for the above app ID in AAD.""" def as_dict(self) -> dict: + """Serializes the AzureServicePrincipal into a dictionary suitable for use as a JSON request body.""" body = {} if self.application_id is not None: body['application_id'] = self.application_id if self.client_secret is not None: body['client_secret'] = self.client_secret @@ -264,7 +340,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AzureServicePrincipal': + def from_dict(cls, d: Dict[str, any]) -> AzureServicePrincipal: + """Deserializes the AzureServicePrincipal from a dictionary.""" return cls(application_id=d.get('application_id', None), client_secret=d.get('client_secret', None), directory_id=d.get('directory_id', None)) @@ -273,31 +350,79 @@ def from_dict(cls, d: Dict[str, any]) -> 'AzureServicePrincipal': @dataclass class CatalogInfo: browse_only: Optional[bool] = None - catalog_type: Optional['CatalogType'] = None + """Indicate whether or not the catalog info contains only browsable metadata.""" + + catalog_type: Optional[CatalogType] = None + """The type of the catalog.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + connection_name: Optional[str] = None + """The name of the connection to an external data source.""" + created_at: Optional[int] = None + """Time at which this catalog was created, in epoch milliseconds.""" + created_by: Optional[str] = None - effective_predictive_optimization_flag: Optional['EffectivePredictiveOptimizationFlag'] = None - enable_predictive_optimization: Optional['EnablePredictiveOptimization'] = None + """Username of catalog creator.""" + + effective_predictive_optimization_flag: Optional[EffectivePredictiveOptimizationFlag] = None + + enable_predictive_optimization: Optional[EnablePredictiveOptimization] = None + """Whether predictive optimization should be enabled for this object and objects under it.""" + full_name: Optional[str] = None - isolation_mode: Optional['IsolationMode'] = None + """The full name of the catalog. Corresponds with the name field.""" + + isolation_mode: Optional[IsolationMode] = None + """Whether the current securable is accessible from all workspaces or a specific set of workspaces.""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" + name: Optional[str] = None - options: Optional['Dict[str,str]'] = None + """Name of catalog.""" + + options: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + owner: Optional[str] = None - properties: Optional['Dict[str,str]'] = None + """Username of current owner of catalog.""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + provider_name: Optional[str] = None - provisioning_info: Optional['ProvisioningInfo'] = None - securable_kind: Optional['CatalogInfoSecurableKind'] = None + """The name of delta sharing provider. + + A Delta Sharing catalog is a catalog that is based on a Delta share on a remote sharing server.""" + + provisioning_info: Optional[ProvisioningInfo] = None + """Status of an asynchronously provisioned resource.""" + + securable_kind: Optional[CatalogInfoSecurableKind] = None + """Kind of catalog securable.""" + securable_type: Optional[str] = None + share_name: Optional[str] = None + """The name of the share under the share provider.""" + storage_location: Optional[str] = None + """Storage Location URL (full path) for managed tables within catalog.""" + storage_root: Optional[str] = None + """Storage root URL for managed tables within catalog.""" + updated_at: Optional[int] = None + """Time at which this catalog was last modified, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified catalog.""" def as_dict(self) -> dict: + """Serializes the CatalogInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.browse_only is not None: body['browse_only'] = self.browse_only if self.catalog_type is not None: body['catalog_type'] = self.catalog_type.value @@ -330,7 +455,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CatalogInfo': + def from_dict(cls, d: Dict[str, any]) -> CatalogInfo: + """Deserializes the CatalogInfo from a dictionary.""" return cls(browse_only=d.get('browse_only', None), catalog_type=_enum(d, 'catalog_type', CatalogType), comment=d.get('comment', None), @@ -390,19 +516,42 @@ class CatalogType(Enum): @dataclass class ColumnInfo: comment: Optional[str] = None - mask: Optional['ColumnMask'] = None + """User-provided free-form text description.""" + + mask: Optional[ColumnMask] = None + name: Optional[str] = None + """Name of Column.""" + nullable: Optional[bool] = None + """Whether field may be Null (default: true).""" + partition_index: Optional[int] = None + """Partition index for column.""" + position: Optional[int] = None + """Ordinal position of column (starting at position 0).""" + type_interval_type: Optional[str] = None + """Format of IntervalType.""" + type_json: Optional[str] = None - type_name: Optional['ColumnTypeName'] = None + """Full data type specification, JSON-serialized.""" + + type_name: Optional[ColumnTypeName] = None + """Name of type (INT, STRUCT, MAP, etc.).""" + type_precision: Optional[int] = None + """Digits of precision; required for DecimalTypes.""" + type_scale: Optional[int] = None + """Digits to right of decimal; Required for DecimalTypes.""" + type_text: Optional[str] = None + """Full data type specification as SQL/catalogString text.""" def as_dict(self) -> dict: + """Serializes the ColumnInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.mask: body['mask'] = self.mask.as_dict() @@ -419,7 +568,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ColumnInfo': + def from_dict(cls, d: Dict[str, any]) -> ColumnInfo: + """Deserializes the ColumnInfo from a dictionary.""" return cls(comment=d.get('comment', None), mask=_from_dict(d, 'mask', ColumnMask), name=d.get('name', None), @@ -437,16 +587,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ColumnInfo': @dataclass class ColumnMask: function_name: Optional[str] = None - using_column_names: Optional['List[str]'] = None + """The full name of the column mask SQL UDF.""" + + using_column_names: Optional[List[str]] = None + """The list of additional table columns to be passed as input to the column mask function. The + first arg of the mask function should be of the type of the column being masked and the types of + the rest of the args should match the types of columns in 'using_column_names'.""" def as_dict(self) -> dict: + """Serializes the ColumnMask into a dictionary suitable for use as a JSON request body.""" body = {} if self.function_name is not None: body['function_name'] = self.function_name if self.using_column_names: body['using_column_names'] = [v for v in self.using_column_names] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ColumnMask': + def from_dict(cls, d: Dict[str, any]) -> ColumnMask: + """Deserializes the ColumnMask from a dictionary.""" return cls(function_name=d.get('function_name', None), using_column_names=d.get('using_column_names', None)) @@ -480,26 +637,63 @@ class ColumnTypeName(Enum): @dataclass class ConnectionInfo: comment: Optional[str] = None + """User-provided free-form text description.""" + connection_id: Optional[str] = None - connection_type: Optional['ConnectionType'] = None + """Unique identifier of the Connection.""" + + connection_type: Optional[ConnectionType] = None + """The type of connection.""" + created_at: Optional[int] = None + """Time at which this connection was created, in epoch milliseconds.""" + created_by: Optional[str] = None - credential_type: Optional['CredentialType'] = None + """Username of connection creator.""" + + credential_type: Optional[CredentialType] = None + """The type of credential.""" + full_name: Optional[str] = None + """Full name of connection.""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" + name: Optional[str] = None - options: Optional['Dict[str,str]'] = None + """Name of the connection.""" + + options: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + owner: Optional[str] = None - properties: Optional['Dict[str,str]'] = None - provisioning_info: Optional['ProvisioningInfo'] = None + """Username of current owner of the connection.""" + + properties: Optional[Dict[str, str]] = None + """An object containing map of key-value properties attached to the connection.""" + + provisioning_info: Optional[ProvisioningInfo] = None + """Status of an asynchronously provisioned resource.""" + read_only: Optional[bool] = None - securable_kind: Optional['ConnectionInfoSecurableKind'] = None + """If the connection is read only.""" + + securable_kind: Optional[ConnectionInfoSecurableKind] = None + """Kind of connection securable.""" + securable_type: Optional[str] = None + updated_at: Optional[int] = None + """Time at which this connection was updated, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified connection.""" + url: Optional[str] = None + """URL of the remote data source, extracted from options.""" def as_dict(self) -> dict: + """Serializes the ConnectionInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.connection_id is not None: body['connection_id'] = self.connection_id @@ -523,7 +717,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ConnectionInfo': + def from_dict(cls, d: Dict[str, any]) -> ConnectionInfo: + """Deserializes the ConnectionInfo from a dictionary.""" return cls(comment=d.get('comment', None), connection_id=d.get('connection_id', None), connection_type=_enum(d, 'connection_type', ConnectionType), @@ -574,15 +769,33 @@ class ConnectionType(Enum): @dataclass class CreateCatalog: name: str + """Name of catalog.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + connection_name: Optional[str] = None - options: Optional['Dict[str,str]'] = None - properties: Optional['Dict[str,str]'] = None + """The name of the connection to an external data source.""" + + options: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + provider_name: Optional[str] = None + """The name of delta sharing provider. + + A Delta Sharing catalog is a catalog that is based on a Delta share on a remote sharing server.""" + share_name: Optional[str] = None + """The name of the share under the share provider.""" + storage_root: Optional[str] = None + """Storage root URL for managed tables within catalog.""" def as_dict(self) -> dict: + """Serializes the CreateCatalog into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.connection_name is not None: body['connection_name'] = self.connection_name @@ -595,7 +808,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCatalog': + def from_dict(cls, d: Dict[str, any]) -> CreateCatalog: + """Deserializes the CreateCatalog from a dictionary.""" return cls(comment=d.get('comment', None), connection_name=d.get('connection_name', None), name=d.get('name', None), @@ -609,13 +823,25 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCatalog': @dataclass class CreateConnection: name: str - connection_type: 'ConnectionType' - options: 'Dict[str,str]' + """Name of the connection.""" + + connection_type: ConnectionType + """The type of connection.""" + + options: Dict[str, str] + """A map of key-value properties attached to the securable.""" + comment: Optional[str] = None - properties: Optional['Dict[str,str]'] = None + """User-provided free-form text description.""" + + properties: Optional[Dict[str, str]] = None + """An object containing map of key-value properties attached to the connection.""" + read_only: Optional[bool] = None + """If the connection is read only.""" def as_dict(self) -> dict: + """Serializes the CreateConnection into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.connection_type is not None: body['connection_type'] = self.connection_type.value @@ -626,7 +852,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateConnection': + def from_dict(cls, d: Dict[str, any]) -> CreateConnection: + """Deserializes the CreateConnection from a dictionary.""" return cls(comment=d.get('comment', None), connection_type=_enum(d, 'connection_type', ConnectionType), name=d.get('name', None), @@ -638,15 +865,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateConnection': @dataclass class CreateExternalLocation: name: str + """Name of the external location.""" + url: str + """Path URL of the external location.""" + credential_name: str + """Name of the storage credential used with this location.""" + access_point: Optional[str] = None + """The AWS access point to use when accesing s3 for this external location.""" + comment: Optional[str] = None - encryption_details: Optional['EncryptionDetails'] = None + """User-provided free-form text description.""" + + encryption_details: Optional[EncryptionDetails] = None + """Encryption options that apply to clients connecting to cloud storage.""" + read_only: Optional[bool] = None + """Indicates whether the external location is read-only.""" + skip_validation: Optional[bool] = None + """Skips validation of the storage credential associated with the external location.""" def as_dict(self) -> dict: + """Serializes the CreateExternalLocation into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_point is not None: body['access_point'] = self.access_point if self.comment is not None: body['comment'] = self.comment @@ -659,7 +902,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateExternalLocation': + def from_dict(cls, d: Dict[str, any]) -> CreateExternalLocation: + """Deserializes the CreateExternalLocation from a dictionary.""" return cls(access_point=d.get('access_point', None), comment=d.get('comment', None), credential_name=d.get('credential_name', None), @@ -673,28 +917,72 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateExternalLocation': @dataclass class CreateFunction: name: str + """Name of function, relative to parent schema.""" + catalog_name: str + """Name of parent catalog.""" + schema_name: str - input_params: 'FunctionParameterInfos' - data_type: 'ColumnTypeName' + """Name of parent schema relative to its parent catalog.""" + + input_params: FunctionParameterInfos + + data_type: ColumnTypeName + """Scalar function return data type.""" + full_data_type: str - return_params: 'FunctionParameterInfos' - routine_body: 'CreateFunctionRoutineBody' + """Pretty printed function data type.""" + + return_params: FunctionParameterInfos + """Table function return parameters.""" + + routine_body: CreateFunctionRoutineBody + """Function language. When **EXTERNAL** is used, the language of the routine function should be + specified in the __external_language__ field, and the __return_params__ of the function cannot + be used (as **TABLE** return type is not supported), and the __sql_data_access__ field must be + **NO_SQL**.""" + routine_definition: str - routine_dependencies: 'DependencyList' - parameter_style: 'CreateFunctionParameterStyle' + """Function body.""" + + routine_dependencies: DependencyList + """Function dependencies.""" + + parameter_style: CreateFunctionParameterStyle + """Function parameter style. **S** is the value for SQL.""" + is_deterministic: bool - sql_data_access: 'CreateFunctionSqlDataAccess' + """Whether the function is deterministic.""" + + sql_data_access: CreateFunctionSqlDataAccess + """Function SQL data access.""" + is_null_call: bool - security_type: 'CreateFunctionSecurityType' + """Function null call.""" + + security_type: CreateFunctionSecurityType + """Function security type.""" + specific_name: str + """Specific name of the function; Reserved for future use.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + external_language: Optional[str] = None + """External function language.""" + external_name: Optional[str] = None + """External function name.""" + properties: Optional[str] = None + """JSON-serialized key-value pair map, encoded (escaped) as a string.""" + sql_path: Optional[str] = None + """List of schemes whose objects can be referenced without qualification.""" def as_dict(self) -> dict: + """Serializes the CreateFunction into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.comment is not None: body['comment'] = self.comment @@ -720,7 +1008,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateFunction': + def from_dict(cls, d: Dict[str, any]) -> CreateFunction: + """Deserializes the CreateFunction from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), data_type=_enum(d, 'data_type', ColumnTypeName), @@ -752,15 +1041,18 @@ class CreateFunctionParameterStyle(Enum): @dataclass class CreateFunctionRequest: - function_info: 'CreateFunction' + function_info: CreateFunction + """Partial __FunctionInfo__ specifying the function to be created.""" def as_dict(self) -> dict: + """Serializes the CreateFunctionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.function_info: body['function_info'] = self.function_info.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateFunctionRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateFunctionRequest: + """Deserializes the CreateFunctionRequest from a dictionary.""" return cls(function_info=_from_dict(d, 'function_info', CreateFunction)) @@ -791,10 +1083,17 @@ class CreateFunctionSqlDataAccess(Enum): @dataclass class CreateMetastore: name: str + """The user-specified name of the metastore.""" + region: Optional[str] = None + """Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). If this field is omitted, + the region of the workspace receiving the request will be used.""" + storage_root: Optional[str] = None + """The storage root URL for metastore""" def as_dict(self) -> dict: + """Serializes the CreateMetastore into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.region is not None: body['region'] = self.region @@ -802,7 +1101,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateMetastore': + def from_dict(cls, d: Dict[str, any]) -> CreateMetastore: + """Deserializes the CreateMetastore from a dictionary.""" return cls(name=d.get('name', None), region=d.get('region', None), storage_root=d.get('storage_root', None)) @@ -811,10 +1111,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateMetastore': @dataclass class CreateMetastoreAssignment: metastore_id: str + """The unique ID of the metastore.""" + default_catalog_name: str + """The name of the default catalog in the metastore.""" + workspace_id: Optional[int] = None + """A workspace ID.""" def as_dict(self) -> dict: + """Serializes the CreateMetastoreAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.default_catalog_name is not None: body['default_catalog_name'] = self.default_catalog_name if self.metastore_id is not None: body['metastore_id'] = self.metastore_id @@ -822,7 +1128,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateMetastoreAssignment': + def from_dict(cls, d: Dict[str, any]) -> CreateMetastoreAssignment: + """Deserializes the CreateMetastoreAssignment from a dictionary.""" return cls(default_catalog_name=d.get('default_catalog_name', None), metastore_id=d.get('metastore_id', None), workspace_id=d.get('workspace_id', None)) @@ -831,12 +1138,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateMetastoreAssignment': @dataclass class CreateRegisteredModelRequest: catalog_name: str + """The name of the catalog where the schema and the registered model reside""" + schema_name: str + """The name of the schema where the registered model resides""" + name: str + """The name of the registered model""" + comment: Optional[str] = None + """The comment attached to the registered model""" + storage_location: Optional[str] = None + """The storage location on the cloud under which model version data files are stored""" def as_dict(self) -> dict: + """Serializes the CreateRegisteredModelRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.comment is not None: body['comment'] = self.comment @@ -846,7 +1163,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateRegisteredModelRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateRegisteredModelRequest: + """Deserializes the CreateRegisteredModelRequest from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), name=d.get('name', None), @@ -857,12 +1175,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateRegisteredModelRequest': @dataclass class CreateSchema: name: str + """Name of schema, relative to parent catalog.""" + catalog_name: str + """Name of parent catalog.""" + comment: Optional[str] = None - properties: Optional['Dict[str,str]'] = None + """User-provided free-form text description.""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + storage_root: Optional[str] = None + """Storage root URL for managed tables within schema.""" def as_dict(self) -> dict: + """Serializes the CreateSchema into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.comment is not None: body['comment'] = self.comment @@ -872,7 +1200,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateSchema': + def from_dict(cls, d: Dict[str, any]) -> CreateSchema: + """Deserializes the CreateSchema from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), name=d.get('name', None), @@ -883,15 +1212,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateSchema': @dataclass class CreateStorageCredential: name: str - aws_iam_role: Optional['AwsIamRole'] = None - azure_managed_identity: Optional['AzureManagedIdentity'] = None - azure_service_principal: Optional['AzureServicePrincipal'] = None + """The credential name. The name must be unique within the metastore.""" + + aws_iam_role: Optional[AwsIamRole] = None + """The AWS IAM role configuration.""" + + azure_managed_identity: Optional[AzureManagedIdentity] = None + """The Azure managed identity configuration.""" + + azure_service_principal: Optional[AzureServicePrincipal] = None + """The Azure service principal configuration.""" + comment: Optional[str] = None + """Comment associated with the credential.""" + databricks_gcp_service_account: Optional[Any] = None + """The managed GCP service account configuration.""" + read_only: Optional[bool] = None + """Whether the storage credential is only usable for read operations.""" + skip_validation: Optional[bool] = None + """Supplying true to this argument skips validation of the created credential.""" def as_dict(self) -> dict: + """Serializes the CreateStorageCredential into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_iam_role: body['aws_iam_role'] = self.aws_iam_role.as_dict() if self.azure_managed_identity: body['azure_managed_identity'] = self.azure_managed_identity.as_dict() @@ -906,7 +1251,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateStorageCredential': + def from_dict(cls, d: Dict[str, any]) -> CreateStorageCredential: + """Deserializes the CreateStorageCredential from a dictionary.""" return cls(aws_iam_role=_from_dict(d, 'aws_iam_role', AwsIamRole), azure_managed_identity=_from_dict(d, 'azure_managed_identity', AzureManagedIdentity), azure_service_principal=_from_dict(d, 'azure_service_principal', AzureServicePrincipal), @@ -920,16 +1266,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateStorageCredential': @dataclass class CreateTableConstraint: full_name_arg: str - constraint: 'TableConstraint' + """The full name of the table referenced by the constraint.""" + + constraint: TableConstraint + """A table constraint, as defined by *one* of the following fields being set: + __primary_key_constraint__, __foreign_key_constraint__, __named_table_constraint__.""" def as_dict(self) -> dict: + """Serializes the CreateTableConstraint into a dictionary suitable for use as a JSON request body.""" body = {} if self.constraint: body['constraint'] = self.constraint.as_dict() if self.full_name_arg is not None: body['full_name_arg'] = self.full_name_arg return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateTableConstraint': + def from_dict(cls, d: Dict[str, any]) -> CreateTableConstraint: + """Deserializes the CreateTableConstraint from a dictionary.""" return cls(constraint=_from_dict(d, 'constraint', TableConstraint), full_name_arg=d.get('full_name_arg', None)) @@ -937,13 +1289,24 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateTableConstraint': @dataclass class CreateVolumeRequestContent: catalog_name: str + """The name of the catalog where the schema and the volume are""" + schema_name: str + """The name of the schema where the volume is""" + name: str - volume_type: 'VolumeType' + """The name of the volume""" + + volume_type: VolumeType + comment: Optional[str] = None + """The comment attached to the volume""" + storage_location: Optional[str] = None + """The storage location on the cloud""" def as_dict(self) -> dict: + """Serializes the CreateVolumeRequestContent into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.comment is not None: body['comment'] = self.comment @@ -954,7 +1317,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateVolumeRequestContent': + def from_dict(cls, d: Dict[str, any]) -> CreateVolumeRequestContent: + """Deserializes the CreateVolumeRequestContent from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), name=d.get('name', None), @@ -973,15 +1337,18 @@ class CredentialType(Enum): class CurrentWorkspaceBindings: """Currently assigned workspaces""" - workspaces: Optional['List[int]'] = None + workspaces: Optional[List[int]] = None + """A list of workspace IDs.""" def as_dict(self) -> dict: + """Serializes the CurrentWorkspaceBindings into a dictionary suitable for use as a JSON request body.""" body = {} if self.workspaces: body['workspaces'] = [v for v in self.workspaces] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CurrentWorkspaceBindings': + def from_dict(cls, d: Dict[str, any]) -> CurrentWorkspaceBindings: + """Deserializes the CurrentWorkspaceBindings from a dictionary.""" return cls(workspaces=d.get('workspaces', None)) @@ -1002,16 +1369,21 @@ class DataSourceFormat(Enum): @dataclass class DatabricksGcpServiceAccountResponse: credential_id: Optional[str] = None + """The Databricks internal ID that represents this service account. This is an output-only field.""" + email: Optional[str] = None + """The email of the service account. This is an output-only field.""" def as_dict(self) -> dict: + """Serializes the DatabricksGcpServiceAccountResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_id is not None: body['credential_id'] = self.credential_id if self.email is not None: body['email'] = self.email return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DatabricksGcpServiceAccountResponse': + def from_dict(cls, d: Dict[str, any]) -> DatabricksGcpServiceAccountResponse: + """Deserializes the DatabricksGcpServiceAccountResponse from a dictionary.""" return cls(credential_id=d.get('credential_id', None), email=d.get('email', None)) @@ -1020,15 +1392,18 @@ class DeltaRuntimePropertiesKvPairs: """Properties pertaining to the current state of the delta table as given by the commit server. This does not contain **delta.*** (input) properties in __TableInfo.properties__.""" - delta_runtime_properties: 'Dict[str,str]' + delta_runtime_properties: Dict[str, str] + """A map of key-value properties attached to the securable.""" def as_dict(self) -> dict: + """Serializes the DeltaRuntimePropertiesKvPairs into a dictionary suitable for use as a JSON request body.""" body = {} if self.delta_runtime_properties: body['delta_runtime_properties'] = self.delta_runtime_properties return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeltaRuntimePropertiesKvPairs': + def from_dict(cls, d: Dict[str, any]) -> DeltaRuntimePropertiesKvPairs: + """Deserializes the DeltaRuntimePropertiesKvPairs from a dictionary.""" return cls(delta_runtime_properties=d.get('delta_runtime_properties', None)) @@ -1037,17 +1412,22 @@ class Dependency: """A dependency of a SQL object. Either the __table__ field or the __function__ field must be defined.""" - function: Optional['FunctionDependency'] = None - table: Optional['TableDependency'] = None + function: Optional[FunctionDependency] = None + """A function that is dependent on a SQL object.""" + + table: Optional[TableDependency] = None + """A table that is dependent on a SQL object.""" def as_dict(self) -> dict: + """Serializes the Dependency into a dictionary suitable for use as a JSON request body.""" body = {} if self.function: body['function'] = self.function.as_dict() if self.table: body['table'] = self.table.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Dependency': + def from_dict(cls, d: Dict[str, any]) -> Dependency: + """Deserializes the Dependency from a dictionary.""" return cls(function=_from_dict(d, 'function', FunctionDependency), table=_from_dict(d, 'table', TableDependency)) @@ -1056,15 +1436,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'Dependency': class DependencyList: """A list of dependencies.""" - dependencies: Optional['List[Dependency]'] = None + dependencies: Optional[List[Dependency]] = None + """Array of dependencies.""" def as_dict(self) -> dict: + """Serializes the DependencyList into a dictionary suitable for use as a JSON request body.""" body = {} if self.dependencies: body['dependencies'] = [v.as_dict() for v in self.dependencies] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DependencyList': + def from_dict(cls, d: Dict[str, any]) -> DependencyList: + """Deserializes the DependencyList from a dictionary.""" return cls(dependencies=_repeated_dict(d, 'dependencies', Dependency)) @@ -1078,27 +1461,38 @@ class DisableSchemaName(Enum): @dataclass class EffectivePermissionsList: - privilege_assignments: Optional['List[EffectivePrivilegeAssignment]'] = None + privilege_assignments: Optional[List[EffectivePrivilegeAssignment]] = None + """The privileges conveyed to each principal (either directly or via inheritance)""" def as_dict(self) -> dict: + """Serializes the EffectivePermissionsList into a dictionary suitable for use as a JSON request body.""" body = {} if self.privilege_assignments: body['privilege_assignments'] = [v.as_dict() for v in self.privilege_assignments] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EffectivePermissionsList': + def from_dict(cls, d: Dict[str, any]) -> EffectivePermissionsList: + """Deserializes the EffectivePermissionsList from a dictionary.""" return cls( privilege_assignments=_repeated_dict(d, 'privilege_assignments', EffectivePrivilegeAssignment)) @dataclass class EffectivePredictiveOptimizationFlag: - value: 'EnablePredictiveOptimization' + value: EnablePredictiveOptimization + """Whether predictive optimization should be enabled for this object and objects under it.""" + inherited_from_name: Optional[str] = None - inherited_from_type: Optional['EffectivePredictiveOptimizationFlagInheritedFromType'] = None + """The name of the object from which the flag was inherited. If there was no inheritance, this + field is left blank.""" + + inherited_from_type: Optional[EffectivePredictiveOptimizationFlagInheritedFromType] = None + """The type of the object from which the flag was inherited. If there was no inheritance, this + field is left blank.""" def as_dict(self) -> dict: + """Serializes the EffectivePredictiveOptimizationFlag into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited_from_name is not None: body['inherited_from_name'] = self.inherited_from_name if self.inherited_from_type is not None: body['inherited_from_type'] = self.inherited_from_type.value @@ -1106,7 +1500,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EffectivePredictiveOptimizationFlag': + def from_dict(cls, d: Dict[str, any]) -> EffectivePredictiveOptimizationFlag: + """Deserializes the EffectivePredictiveOptimizationFlag from a dictionary.""" return cls(inherited_from_name=d.get('inherited_from_name', None), inherited_from_type=_enum(d, 'inherited_from_type', EffectivePredictiveOptimizationFlagInheritedFromType), @@ -1124,10 +1519,18 @@ class EffectivePredictiveOptimizationFlagInheritedFromType(Enum): @dataclass class EffectivePrivilege: inherited_from_name: Optional[str] = None - inherited_from_type: Optional['SecurableType'] = None - privilege: Optional['Privilege'] = None + """The full name of the object that conveys this privilege via inheritance. This field is omitted + when privilege is not inherited (it's assigned to the securable itself).""" + + inherited_from_type: Optional[SecurableType] = None + """The type of the object that conveys this privilege via inheritance. This field is omitted when + privilege is not inherited (it's assigned to the securable itself).""" + + privilege: Optional[Privilege] = None + """The privilege assigned to the principal.""" def as_dict(self) -> dict: + """Serializes the EffectivePrivilege into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited_from_name is not None: body['inherited_from_name'] = self.inherited_from_name if self.inherited_from_type is not None: body['inherited_from_type'] = self.inherited_from_type.value @@ -1135,7 +1538,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EffectivePrivilege': + def from_dict(cls, d: Dict[str, any]) -> EffectivePrivilege: + """Deserializes the EffectivePrivilege from a dictionary.""" return cls(inherited_from_name=d.get('inherited_from_name', None), inherited_from_type=_enum(d, 'inherited_from_type', SecurableType), privilege=_enum(d, 'privilege', Privilege)) @@ -1144,16 +1548,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'EffectivePrivilege': @dataclass class EffectivePrivilegeAssignment: principal: Optional[str] = None - privileges: Optional['List[EffectivePrivilege]'] = None + """The principal (user email address or group name).""" + + privileges: Optional[List[EffectivePrivilege]] = None + """The privileges conveyed to the principal (either directly or via inheritance).""" def as_dict(self) -> dict: + """Serializes the EffectivePrivilegeAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.principal is not None: body['principal'] = self.principal if self.privileges: body['privileges'] = [v.as_dict() for v in self.privileges] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EffectivePrivilegeAssignment': + def from_dict(cls, d: Dict[str, any]) -> EffectivePrivilegeAssignment: + """Deserializes the EffectivePrivilegeAssignment from a dictionary.""" return cls(principal=d.get('principal', None), privileges=_repeated_dict(d, 'privileges', EffectivePrivilege)) @@ -1178,36 +1587,67 @@ class EnableSchemaName(Enum): class EncryptionDetails: """Encryption options that apply to clients connecting to cloud storage.""" - sse_encryption_details: Optional['SseEncryptionDetails'] = None + sse_encryption_details: Optional[SseEncryptionDetails] = None + """Server-Side Encryption properties for clients communicating with AWS s3.""" def as_dict(self) -> dict: + """Serializes the EncryptionDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.sse_encryption_details: body['sse_encryption_details'] = self.sse_encryption_details.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EncryptionDetails': + def from_dict(cls, d: Dict[str, any]) -> EncryptionDetails: + """Deserializes the EncryptionDetails from a dictionary.""" return cls(sse_encryption_details=_from_dict(d, 'sse_encryption_details', SseEncryptionDetails)) @dataclass class ExternalLocationInfo: access_point: Optional[str] = None + """The AWS access point to use when accesing s3 for this external location.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + created_at: Optional[int] = None + """Time at which this external location was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of external location creator.""" + credential_id: Optional[str] = None + """Unique ID of the location's storage credential.""" + credential_name: Optional[str] = None - encryption_details: Optional['EncryptionDetails'] = None + """Name of the storage credential used with this location.""" + + encryption_details: Optional[EncryptionDetails] = None + """Encryption options that apply to clients connecting to cloud storage.""" + metastore_id: Optional[str] = None + """Unique identifier of metastore hosting the external location.""" + name: Optional[str] = None + """Name of the external location.""" + owner: Optional[str] = None + """The owner of the external location.""" + read_only: Optional[bool] = None + """Indicates whether the external location is read-only.""" + updated_at: Optional[int] = None + """Time at which external location this was last modified, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified the external location.""" + url: Optional[str] = None + """Path URL of the external location.""" def as_dict(self) -> dict: + """Serializes the ExternalLocationInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_point is not None: body['access_point'] = self.access_point if self.comment is not None: body['comment'] = self.comment @@ -1226,7 +1666,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExternalLocationInfo': + def from_dict(cls, d: Dict[str, any]) -> ExternalLocationInfo: + """Deserializes the ExternalLocationInfo from a dictionary.""" return cls(access_point=d.get('access_point', None), comment=d.get('comment', None), created_at=d.get('created_at', None), @@ -1246,11 +1687,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExternalLocationInfo': @dataclass class ForeignKeyConstraint: name: str - child_columns: 'List[str]' + """The name of the constraint.""" + + child_columns: List[str] + """Column names for this constraint.""" + parent_table: str - parent_columns: 'List[str]' + """The full name of the parent constraint.""" + + parent_columns: List[str] + """Column names for this constraint.""" def as_dict(self) -> dict: + """Serializes the ForeignKeyConstraint into a dictionary suitable for use as a JSON request body.""" body = {} if self.child_columns: body['child_columns'] = [v for v in self.child_columns] if self.name is not None: body['name'] = self.name @@ -1259,7 +1708,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ForeignKeyConstraint': + def from_dict(cls, d: Dict[str, any]) -> ForeignKeyConstraint: + """Deserializes the ForeignKeyConstraint from a dictionary.""" return cls(child_columns=d.get('child_columns', None), name=d.get('name', None), parent_columns=d.get('parent_columns', None), @@ -1271,50 +1721,114 @@ class FunctionDependency: """A function that is dependent on a SQL object.""" function_full_name: str + """Full name of the dependent function, in the form of + __catalog_name__.__schema_name__.__function_name__.""" def as_dict(self) -> dict: + """Serializes the FunctionDependency into a dictionary suitable for use as a JSON request body.""" body = {} if self.function_full_name is not None: body['function_full_name'] = self.function_full_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FunctionDependency': + def from_dict(cls, d: Dict[str, any]) -> FunctionDependency: + """Deserializes the FunctionDependency from a dictionary.""" return cls(function_full_name=d.get('function_full_name', None)) @dataclass class FunctionInfo: catalog_name: Optional[str] = None + """Name of parent catalog.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + created_at: Optional[int] = None + """Time at which this function was created, in epoch milliseconds.""" + created_by: Optional[str] = None - data_type: Optional['ColumnTypeName'] = None + """Username of function creator.""" + + data_type: Optional[ColumnTypeName] = None + """Scalar function return data type.""" + external_language: Optional[str] = None + """External function language.""" + external_name: Optional[str] = None + """External function name.""" + full_data_type: Optional[str] = None + """Pretty printed function data type.""" + full_name: Optional[str] = None + """Full name of function, in form of __catalog_name__.__schema_name__.__function__name__""" + function_id: Optional[str] = None - input_params: Optional['FunctionParameterInfos'] = None + """Id of Function, relative to parent schema.""" + + input_params: Optional[FunctionParameterInfos] = None + is_deterministic: Optional[bool] = None + """Whether the function is deterministic.""" + is_null_call: Optional[bool] = None + """Function null call.""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" + name: Optional[str] = None + """Name of function, relative to parent schema.""" + owner: Optional[str] = None - parameter_style: Optional['FunctionInfoParameterStyle'] = None + """Username of current owner of function.""" + + parameter_style: Optional[FunctionInfoParameterStyle] = None + """Function parameter style. **S** is the value for SQL.""" + properties: Optional[str] = None - return_params: Optional['FunctionParameterInfos'] = None - routine_body: Optional['FunctionInfoRoutineBody'] = None + """JSON-serialized key-value pair map, encoded (escaped) as a string.""" + + return_params: Optional[FunctionParameterInfos] = None + """Table function return parameters.""" + + routine_body: Optional[FunctionInfoRoutineBody] = None + """Function language. When **EXTERNAL** is used, the language of the routine function should be + specified in the __external_language__ field, and the __return_params__ of the function cannot + be used (as **TABLE** return type is not supported), and the __sql_data_access__ field must be + **NO_SQL**.""" + routine_definition: Optional[str] = None - routine_dependencies: Optional['DependencyList'] = None + """Function body.""" + + routine_dependencies: Optional[DependencyList] = None + """Function dependencies.""" + schema_name: Optional[str] = None - security_type: Optional['FunctionInfoSecurityType'] = None + """Name of parent schema relative to its parent catalog.""" + + security_type: Optional[FunctionInfoSecurityType] = None + """Function security type.""" + specific_name: Optional[str] = None - sql_data_access: Optional['FunctionInfoSqlDataAccess'] = None + """Specific name of the function; Reserved for future use.""" + + sql_data_access: Optional[FunctionInfoSqlDataAccess] = None + """Function SQL data access.""" + sql_path: Optional[str] = None + """List of schemes whose objects can be referenced without qualification.""" + updated_at: Optional[int] = None + """Time at which this function was created, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified function.""" def as_dict(self) -> dict: + """Serializes the FunctionInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.comment is not None: body['comment'] = self.comment @@ -1348,7 +1862,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FunctionInfo': + def from_dict(cls, d: Dict[str, any]) -> FunctionInfo: + """Deserializes the FunctionInfo from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), created_at=d.get('created_at', None), @@ -1413,19 +1928,43 @@ class FunctionInfoSqlDataAccess(Enum): @dataclass class FunctionParameterInfo: name: str + """Name of parameter.""" + type_text: str - type_name: 'ColumnTypeName' + """Full data type spec, SQL/catalogString text.""" + + type_name: ColumnTypeName + """Name of type (INT, STRUCT, MAP, etc.).""" + position: int + """Ordinal position of column (starting at position 0).""" + comment: Optional[str] = None + """User-provided free-form text description.""" + parameter_default: Optional[str] = None - parameter_mode: Optional['FunctionParameterMode'] = None - parameter_type: Optional['FunctionParameterType'] = None + """Default value of the parameter.""" + + parameter_mode: Optional[FunctionParameterMode] = None + """The mode of the function parameter.""" + + parameter_type: Optional[FunctionParameterType] = None + """The type of function parameter.""" + type_interval_type: Optional[str] = None + """Format of IntervalType.""" + type_json: Optional[str] = None + """Full data type spec, JSON-serialized.""" + type_precision: Optional[int] = None + """Digits of precision; required on Create for DecimalTypes.""" + type_scale: Optional[int] = None + """Digits to right of decimal; Required on Create for DecimalTypes.""" def as_dict(self) -> dict: + """Serializes the FunctionParameterInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -1442,7 +1981,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FunctionParameterInfo': + def from_dict(cls, d: Dict[str, any]) -> FunctionParameterInfo: + """Deserializes the FunctionParameterInfo from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), parameter_default=d.get('parameter_default', None), @@ -1459,15 +1999,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'FunctionParameterInfo': @dataclass class FunctionParameterInfos: - parameters: Optional['List[FunctionParameterInfo]'] = None + parameters: Optional[List[FunctionParameterInfo]] = None + """The array of __FunctionParameterInfo__ definitions of the function's parameters.""" def as_dict(self) -> dict: + """Serializes the FunctionParameterInfos into a dictionary suitable for use as a JSON request body.""" body = {} if self.parameters: body['parameters'] = [v.as_dict() for v in self.parameters] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FunctionParameterInfos': + def from_dict(cls, d: Dict[str, any]) -> FunctionParameterInfos: + """Deserializes the FunctionParameterInfos from a dictionary.""" return cls(parameters=_repeated_dict(d, 'parameters', FunctionParameterInfo)) @@ -1487,25 +2030,62 @@ class FunctionParameterType(Enum): @dataclass class GetMetastoreSummaryResponse: cloud: Optional[str] = None + """Cloud vendor of the metastore home shard (e.g., `aws`, `azure`, `gcp`).""" + created_at: Optional[int] = None + """Time at which this metastore was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of metastore creator.""" + default_data_access_config_id: Optional[str] = None + """Unique identifier of the metastore's (Default) Data Access Configuration.""" + delta_sharing_organization_name: Optional[str] = None + """The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta + Sharing as the official name.""" + delta_sharing_recipient_token_lifetime_in_seconds: Optional[int] = None - delta_sharing_scope: Optional['GetMetastoreSummaryResponseDeltaSharingScope'] = None + """The lifetime of delta sharing recipient token in seconds.""" + + delta_sharing_scope: Optional[GetMetastoreSummaryResponseDeltaSharingScope] = None + """The scope of Delta Sharing enabled for the metastore.""" + global_metastore_id: Optional[str] = None + """Globally unique metastore ID across clouds and regions, of the form `cloud:region:metastore_id`.""" + metastore_id: Optional[str] = None + """Unique identifier of metastore.""" + name: Optional[str] = None + """The user-specified name of the metastore.""" + owner: Optional[str] = None + """The owner of the metastore.""" + privilege_model_version: Optional[str] = None + """Privilege model version of the metastore, of the form `major.minor` (e.g., `1.0`).""" + region: Optional[str] = None + """Cloud region which the metastore serves (e.g., `us-west-2`, `westus`).""" + storage_root: Optional[str] = None + """The storage root URL for metastore""" + storage_root_credential_id: Optional[str] = None + """UUID of storage credential to access the metastore storage_root.""" + storage_root_credential_name: Optional[str] = None + """Name of the storage credential to access the metastore storage_root.""" + updated_at: Optional[int] = None + """Time at which the metastore was last modified, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified the metastore.""" def as_dict(self) -> dict: + """Serializes the GetMetastoreSummaryResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.cloud is not None: body['cloud'] = self.cloud if self.created_at is not None: body['created_at'] = self.created_at @@ -1535,7 +2115,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetMetastoreSummaryResponse': + def from_dict(cls, d: Dict[str, any]) -> GetMetastoreSummaryResponse: + """Deserializes the GetMetastoreSummaryResponse from a dictionary.""" return cls(cloud=d.get('cloud', None), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -1576,102 +2157,123 @@ class IsolationMode(Enum): class ListAccountMetastoreAssignmentsResponse: """The list of workspaces to which the given metastore is assigned.""" - workspace_ids: Optional['List[int]'] = None + workspace_ids: Optional[List[int]] = None def as_dict(self) -> dict: + """Serializes the ListAccountMetastoreAssignmentsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.workspace_ids: body['workspace_ids'] = [v for v in self.workspace_ids] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListAccountMetastoreAssignmentsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListAccountMetastoreAssignmentsResponse: + """Deserializes the ListAccountMetastoreAssignmentsResponse from a dictionary.""" return cls(workspace_ids=d.get('workspace_ids', None)) @dataclass class ListCatalogsResponse: - catalogs: Optional['List[CatalogInfo]'] = None + catalogs: Optional[List[CatalogInfo]] = None + """An array of catalog information objects.""" def as_dict(self) -> dict: + """Serializes the ListCatalogsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalogs: body['catalogs'] = [v.as_dict() for v in self.catalogs] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListCatalogsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListCatalogsResponse: + """Deserializes the ListCatalogsResponse from a dictionary.""" return cls(catalogs=_repeated_dict(d, 'catalogs', CatalogInfo)) @dataclass class ListConnectionsResponse: - connections: Optional['List[ConnectionInfo]'] = None + connections: Optional[List[ConnectionInfo]] = None + """An array of connection information objects.""" def as_dict(self) -> dict: + """Serializes the ListConnectionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.connections: body['connections'] = [v.as_dict() for v in self.connections] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListConnectionsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListConnectionsResponse: + """Deserializes the ListConnectionsResponse from a dictionary.""" return cls(connections=_repeated_dict(d, 'connections', ConnectionInfo)) @dataclass class ListExternalLocationsResponse: - external_locations: Optional['List[ExternalLocationInfo]'] = None + external_locations: Optional[List[ExternalLocationInfo]] = None + """An array of external locations.""" def as_dict(self) -> dict: + """Serializes the ListExternalLocationsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.external_locations: body['external_locations'] = [v.as_dict() for v in self.external_locations] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListExternalLocationsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListExternalLocationsResponse: + """Deserializes the ListExternalLocationsResponse from a dictionary.""" return cls(external_locations=_repeated_dict(d, 'external_locations', ExternalLocationInfo)) @dataclass class ListFunctionsResponse: - functions: Optional['List[FunctionInfo]'] = None + functions: Optional[List[FunctionInfo]] = None + """An array of function information objects.""" def as_dict(self) -> dict: + """Serializes the ListFunctionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.functions: body['functions'] = [v.as_dict() for v in self.functions] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListFunctionsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListFunctionsResponse: + """Deserializes the ListFunctionsResponse from a dictionary.""" return cls(functions=_repeated_dict(d, 'functions', FunctionInfo)) @dataclass class ListMetastoresResponse: - metastores: Optional['List[MetastoreInfo]'] = None + metastores: Optional[List[MetastoreInfo]] = None + """An array of metastore information objects.""" def as_dict(self) -> dict: + """Serializes the ListMetastoresResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.metastores: body['metastores'] = [v.as_dict() for v in self.metastores] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListMetastoresResponse': + def from_dict(cls, d: Dict[str, any]) -> ListMetastoresResponse: + """Deserializes the ListMetastoresResponse from a dictionary.""" return cls(metastores=_repeated_dict(d, 'metastores', MetastoreInfo)) @dataclass class ListModelVersionsResponse: - model_versions: Optional['List[ModelVersionInfo]'] = None + model_versions: Optional[List[ModelVersionInfo]] = None + next_page_token: Optional[str] = None + """Token to retrieve the next page of results""" def as_dict(self) -> dict: + """Serializes the ListModelVersionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_versions: body['model_versions'] = [v.as_dict() for v in self.model_versions] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListModelVersionsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListModelVersionsResponse: + """Deserializes the ListModelVersionsResponse from a dictionary.""" return cls(model_versions=_repeated_dict(d, 'model_versions', ModelVersionInfo), next_page_token=d.get('next_page_token', None)) @@ -1679,76 +2281,94 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListModelVersionsResponse': @dataclass class ListRegisteredModelsResponse: next_page_token: Optional[str] = None - registered_models: Optional['List[RegisteredModelInfo]'] = None + """Opaque token for pagination. Omitted if there are no more results. page_token should be set to + this value for fetching the next page.""" + + registered_models: Optional[List[RegisteredModelInfo]] = None def as_dict(self) -> dict: + """Serializes the ListRegisteredModelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.registered_models: body['registered_models'] = [v.as_dict() for v in self.registered_models] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListRegisteredModelsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListRegisteredModelsResponse: + """Deserializes the ListRegisteredModelsResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), registered_models=_repeated_dict(d, 'registered_models', RegisteredModelInfo)) @dataclass class ListSchemasResponse: - schemas: Optional['List[SchemaInfo]'] = None + schemas: Optional[List[SchemaInfo]] = None + """An array of schema information objects.""" def as_dict(self) -> dict: + """Serializes the ListSchemasResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.schemas: body['schemas'] = [v.as_dict() for v in self.schemas] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListSchemasResponse': + def from_dict(cls, d: Dict[str, any]) -> ListSchemasResponse: + """Deserializes the ListSchemasResponse from a dictionary.""" return cls(schemas=_repeated_dict(d, 'schemas', SchemaInfo)) @dataclass class ListStorageCredentialsResponse: - storage_credentials: Optional['List[StorageCredentialInfo]'] = None + storage_credentials: Optional[List[StorageCredentialInfo]] = None def as_dict(self) -> dict: + """Serializes the ListStorageCredentialsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.storage_credentials: body['storage_credentials'] = [v.as_dict() for v in self.storage_credentials] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListStorageCredentialsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListStorageCredentialsResponse: + """Deserializes the ListStorageCredentialsResponse from a dictionary.""" return cls(storage_credentials=_repeated_dict(d, 'storage_credentials', StorageCredentialInfo)) @dataclass class ListSystemSchemasResponse: - schemas: Optional['List[SystemSchemaInfo]'] = None + schemas: Optional[List[SystemSchemaInfo]] = None + """An array of system schema information objects.""" def as_dict(self) -> dict: + """Serializes the ListSystemSchemasResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.schemas: body['schemas'] = [v.as_dict() for v in self.schemas] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListSystemSchemasResponse': + def from_dict(cls, d: Dict[str, any]) -> ListSystemSchemasResponse: + """Deserializes the ListSystemSchemasResponse from a dictionary.""" return cls(schemas=_repeated_dict(d, 'schemas', SystemSchemaInfo)) @dataclass class ListTableSummariesResponse: next_page_token: Optional[str] = None - tables: Optional['List[TableSummary]'] = None + """Opaque token for pagination. Omitted if there are no more results.""" + + tables: Optional[List[TableSummary]] = None + """List of table summaries.""" def as_dict(self) -> dict: + """Serializes the ListTableSummariesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.tables: body['tables'] = [v.as_dict() for v in self.tables] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListTableSummariesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListTableSummariesResponse: + """Deserializes the ListTableSummariesResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), tables=_repeated_dict(d, 'tables', TableSummary)) @@ -1756,31 +2376,39 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListTableSummariesResponse': @dataclass class ListTablesResponse: next_page_token: Optional[str] = None - tables: Optional['List[TableInfo]'] = None + """Opaque token for pagination. Omitted if there are no more results. page_token should be set to + this value for fetching the next page.""" + + tables: Optional[List[TableInfo]] = None + """An array of table information objects.""" def as_dict(self) -> dict: + """Serializes the ListTablesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.tables: body['tables'] = [v.as_dict() for v in self.tables] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListTablesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListTablesResponse: + """Deserializes the ListTablesResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), tables=_repeated_dict(d, 'tables', TableInfo)) @dataclass class ListVolumesResponseContent: - volumes: Optional['List[VolumeInfo]'] = None + volumes: Optional[List[VolumeInfo]] = None def as_dict(self) -> dict: + """Serializes the ListVolumesResponseContent into a dictionary suitable for use as a JSON request body.""" body = {} if self.volumes: body['volumes'] = [v.as_dict() for v in self.volumes] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListVolumesResponseContent': + def from_dict(cls, d: Dict[str, any]) -> ListVolumesResponseContent: + """Deserializes the ListVolumesResponseContent from a dictionary.""" return cls(volumes=_repeated_dict(d, 'volumes', VolumeInfo)) @@ -1793,10 +2421,16 @@ class MatchType(Enum): @dataclass class MetastoreAssignment: metastore_id: str + """The unique ID of the metastore.""" + workspace_id: int + """The unique ID of the Databricks workspace.""" + default_catalog_name: Optional[str] = None + """The name of the default catalog in the metastore.""" def as_dict(self) -> dict: + """Serializes the MetastoreAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.default_catalog_name is not None: body['default_catalog_name'] = self.default_catalog_name if self.metastore_id is not None: body['metastore_id'] = self.metastore_id @@ -1804,7 +2438,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'MetastoreAssignment': + def from_dict(cls, d: Dict[str, any]) -> MetastoreAssignment: + """Deserializes the MetastoreAssignment from a dictionary.""" return cls(default_catalog_name=d.get('default_catalog_name', None), metastore_id=d.get('metastore_id', None), workspace_id=d.get('workspace_id', None)) @@ -1813,25 +2448,62 @@ def from_dict(cls, d: Dict[str, any]) -> 'MetastoreAssignment': @dataclass class MetastoreInfo: cloud: Optional[str] = None + """Cloud vendor of the metastore home shard (e.g., `aws`, `azure`, `gcp`).""" + created_at: Optional[int] = None + """Time at which this metastore was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of metastore creator.""" + default_data_access_config_id: Optional[str] = None + """Unique identifier of the metastore's (Default) Data Access Configuration.""" + delta_sharing_organization_name: Optional[str] = None + """The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta + Sharing as the official name.""" + delta_sharing_recipient_token_lifetime_in_seconds: Optional[int] = None - delta_sharing_scope: Optional['MetastoreInfoDeltaSharingScope'] = None + """The lifetime of delta sharing recipient token in seconds.""" + + delta_sharing_scope: Optional[MetastoreInfoDeltaSharingScope] = None + """The scope of Delta Sharing enabled for the metastore.""" + global_metastore_id: Optional[str] = None + """Globally unique metastore ID across clouds and regions, of the form `cloud:region:metastore_id`.""" + metastore_id: Optional[str] = None + """Unique identifier of metastore.""" + name: Optional[str] = None + """The user-specified name of the metastore.""" + owner: Optional[str] = None + """The owner of the metastore.""" + privilege_model_version: Optional[str] = None + """Privilege model version of the metastore, of the form `major.minor` (e.g., `1.0`).""" + region: Optional[str] = None + """Cloud region which the metastore serves (e.g., `us-west-2`, `westus`).""" + storage_root: Optional[str] = None + """The storage root URL for metastore""" + storage_root_credential_id: Optional[str] = None + """UUID of storage credential to access the metastore storage_root.""" + storage_root_credential_name: Optional[str] = None + """Name of the storage credential to access the metastore storage_root.""" + updated_at: Optional[int] = None + """Time at which the metastore was last modified, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified the metastore.""" def as_dict(self) -> dict: + """Serializes the MetastoreInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.cloud is not None: body['cloud'] = self.cloud if self.created_at is not None: body['created_at'] = self.created_at @@ -1861,7 +2533,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'MetastoreInfo': + def from_dict(cls, d: Dict[str, any]) -> MetastoreInfo: + """Deserializes the MetastoreInfo from a dictionary.""" return cls(cloud=d.get('cloud', None), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -1893,24 +2566,60 @@ class MetastoreInfoDeltaSharingScope(Enum): @dataclass class ModelVersionInfo: catalog_name: Optional[str] = None + """The name of the catalog containing the model version""" + comment: Optional[str] = None + """The comment attached to the model version""" + created_at: Optional[int] = None + created_by: Optional[str] = None + """The identifier of the user who created the model version""" + id: Optional[str] = None + """The unique identifier of the model version""" + metastore_id: Optional[str] = None + """The unique identifier of the metastore containing the model version""" + model_name: Optional[str] = None - model_version_dependencies: Optional['DependencyList'] = None + """The name of the parent registered model of the model version, relative to parent schema""" + + model_version_dependencies: Optional[DependencyList] = None + """Model version dependencies, for feature-store packaged models""" + run_id: Optional[str] = None + """MLflow run ID used when creating the model version, if ``source`` was generated by an experiment + run stored in an MLflow tracking server""" + run_workspace_id: Optional[int] = None + """ID of the Databricks workspace containing the MLflow run that generated this model version, if + applicable""" + schema_name: Optional[str] = None + """The name of the schema containing the model version, relative to parent catalog""" + source: Optional[str] = None - status: Optional['ModelVersionInfoStatus'] = None + """URI indicating the location of the source artifacts (files) for the model version""" + + status: Optional[ModelVersionInfoStatus] = None + """Current status of the model version. Newly created model versions start in PENDING_REGISTRATION + status, then move to READY status once the model version files are uploaded and the model + version is finalized. Only model versions in READY status can be loaded for inference or served.""" + storage_location: Optional[str] = None + """The storage location on the cloud under which model version data files are stored""" + updated_at: Optional[int] = None + updated_by: Optional[str] = None + """The identifier of the user who updated the model version last time""" + version: Optional[int] = None + """Integer model version number, used to reference the model version in API requests.""" def as_dict(self) -> dict: + """Serializes the ModelVersionInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.comment is not None: body['comment'] = self.comment @@ -1933,7 +2642,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ModelVersionInfo': + def from_dict(cls, d: Dict[str, any]) -> ModelVersionInfo: + """Deserializes the ModelVersionInfo from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), created_at=d.get('created_at', None), @@ -1966,24 +2676,33 @@ class ModelVersionInfoStatus(Enum): @dataclass class NamedTableConstraint: name: str + """The name of the constraint.""" def as_dict(self) -> dict: + """Serializes the NamedTableConstraint into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NamedTableConstraint': + def from_dict(cls, d: Dict[str, any]) -> NamedTableConstraint: + """Deserializes the NamedTableConstraint from a dictionary.""" return cls(name=d.get('name', None)) @dataclass class PermissionsChange: - add: Optional['List[Privilege]'] = None + add: Optional[List[Privilege]] = None + """The set of privileges to add.""" + principal: Optional[str] = None - remove: Optional['List[Privilege]'] = None + """The principal whose privileges we are changing.""" + + remove: Optional[List[Privilege]] = None + """The set of privileges to remove.""" def as_dict(self) -> dict: + """Serializes the PermissionsChange into a dictionary suitable for use as a JSON request body.""" body = {} if self.add: body['add'] = [v.value for v in self.add] if self.principal is not None: body['principal'] = self.principal @@ -1991,7 +2710,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionsChange': + def from_dict(cls, d: Dict[str, any]) -> PermissionsChange: + """Deserializes the PermissionsChange from a dictionary.""" return cls(add=_repeated_enum(d, 'add', Privilege), principal=d.get('principal', None), remove=_repeated_enum(d, 'remove', Privilege)) @@ -1999,32 +2719,40 @@ def from_dict(cls, d: Dict[str, any]) -> 'PermissionsChange': @dataclass class PermissionsList: - privilege_assignments: Optional['List[PrivilegeAssignment]'] = None + privilege_assignments: Optional[List[PrivilegeAssignment]] = None + """The privileges assigned to each principal""" def as_dict(self) -> dict: + """Serializes the PermissionsList into a dictionary suitable for use as a JSON request body.""" body = {} if self.privilege_assignments: body['privilege_assignments'] = [v.as_dict() for v in self.privilege_assignments] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionsList': + def from_dict(cls, d: Dict[str, any]) -> PermissionsList: + """Deserializes the PermissionsList from a dictionary.""" return cls(privilege_assignments=_repeated_dict(d, 'privilege_assignments', PrivilegeAssignment)) @dataclass class PrimaryKeyConstraint: name: str - child_columns: 'List[str]' + """The name of the constraint.""" + + child_columns: List[str] + """Column names for this constraint.""" def as_dict(self) -> dict: + """Serializes the PrimaryKeyConstraint into a dictionary suitable for use as a JSON request body.""" body = {} if self.child_columns: body['child_columns'] = [v for v in self.child_columns] if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PrimaryKeyConstraint': + def from_dict(cls, d: Dict[str, any]) -> PrimaryKeyConstraint: + """Deserializes the PrimaryKeyConstraint from a dictionary.""" return cls(child_columns=d.get('child_columns', None), name=d.get('name', None)) @@ -2076,16 +2804,21 @@ class Privilege(Enum): @dataclass class PrivilegeAssignment: principal: Optional[str] = None - privileges: Optional['List[Privilege]'] = None + """The principal (user email address or group name).""" + + privileges: Optional[List[Privilege]] = None + """The privileges assigned to the principal.""" def as_dict(self) -> dict: + """Serializes the PrivilegeAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.principal is not None: body['principal'] = self.principal if self.privileges: body['privileges'] = [v.value for v in self.privileges] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PrivilegeAssignment': + def from_dict(cls, d: Dict[str, any]) -> PrivilegeAssignment: + """Deserializes the PrivilegeAssignment from a dictionary.""" return cls(principal=d.get('principal', None), privileges=_repeated_enum(d, 'privileges', Privilege)) @@ -2096,15 +2829,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'PrivilegeAssignment': class ProvisioningInfo: """Status of an asynchronously provisioned resource.""" - state: Optional['ProvisioningInfoState'] = None + state: Optional[ProvisioningInfoState] = None def as_dict(self) -> dict: + """Serializes the ProvisioningInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.state is not None: body['state'] = self.state.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ProvisioningInfo': + def from_dict(cls, d: Dict[str, any]) -> ProvisioningInfo: + """Deserializes the ProvisioningInfo from a dictionary.""" return cls(state=_enum(d, 'state', ProvisioningInfoState)) @@ -2122,36 +2857,67 @@ class RegisteredModelAlias: """Registered model alias.""" alias_name: Optional[str] = None + """Name of the alias, e.g. 'champion' or 'latest_stable'""" + version_num: Optional[int] = None + """Integer version number of the model version to which this alias points.""" def as_dict(self) -> dict: + """Serializes the RegisteredModelAlias into a dictionary suitable for use as a JSON request body.""" body = {} if self.alias_name is not None: body['alias_name'] = self.alias_name if self.version_num is not None: body['version_num'] = self.version_num return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelAlias': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelAlias: + """Deserializes the RegisteredModelAlias from a dictionary.""" return cls(alias_name=d.get('alias_name', None), version_num=d.get('version_num', None)) @dataclass class RegisteredModelInfo: - aliases: Optional['List[RegisteredModelAlias]'] = None + aliases: Optional[List[RegisteredModelAlias]] = None + """List of aliases associated with the registered model""" + catalog_name: Optional[str] = None + """The name of the catalog where the schema and the registered model reside""" + comment: Optional[str] = None + """The comment attached to the registered model""" + created_at: Optional[int] = None + """Creation timestamp of the registered model in milliseconds since the Unix epoch""" + created_by: Optional[str] = None + """The identifier of the user who created the registered model""" + full_name: Optional[str] = None + """The three-level (fully qualified) name of the registered model""" + metastore_id: Optional[str] = None + """The unique identifier of the metastore""" + name: Optional[str] = None + """The name of the registered model""" + owner: Optional[str] = None + """The identifier of the user who owns the registered model""" + schema_name: Optional[str] = None + """The name of the schema where the registered model resides""" + storage_location: Optional[str] = None + """The storage location on the cloud under which model version data files are stored""" + updated_at: Optional[int] = None + """Last-update timestamp of the registered model in milliseconds since the Unix epoch""" + updated_by: Optional[str] = None + """The identifier of the user who updated the registered model last time""" def as_dict(self) -> dict: + """Serializes the RegisteredModelInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.aliases: body['aliases'] = [v.as_dict() for v in self.aliases] if self.catalog_name is not None: body['catalog_name'] = self.catalog_name @@ -2169,7 +2935,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelInfo': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelInfo: + """Deserializes the RegisteredModelInfo from a dictionary.""" return cls(aliases=_repeated_dict(d, 'aliases', RegisteredModelAlias), catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), @@ -2188,23 +2955,54 @@ def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelInfo': @dataclass class SchemaInfo: catalog_name: Optional[str] = None + """Name of parent catalog.""" + catalog_type: Optional[str] = None + """The type of the parent catalog.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + created_at: Optional[int] = None + """Time at which this schema was created, in epoch milliseconds.""" + created_by: Optional[str] = None - effective_predictive_optimization_flag: Optional['EffectivePredictiveOptimizationFlag'] = None - enable_predictive_optimization: Optional['EnablePredictiveOptimization'] = None + """Username of schema creator.""" + + effective_predictive_optimization_flag: Optional[EffectivePredictiveOptimizationFlag] = None + + enable_predictive_optimization: Optional[EnablePredictiveOptimization] = None + """Whether predictive optimization should be enabled for this object and objects under it.""" + full_name: Optional[str] = None + """Full name of schema, in form of __catalog_name__.__schema_name__.""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" + name: Optional[str] = None + """Name of schema, relative to parent catalog.""" + owner: Optional[str] = None - properties: Optional['Dict[str,str]'] = None + """Username of current owner of schema.""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + storage_location: Optional[str] = None + """Storage location for managed tables within schema.""" + storage_root: Optional[str] = None + """Storage root URL for managed tables within schema.""" + updated_at: Optional[int] = None + """Time at which this schema was created, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified schema.""" def as_dict(self) -> dict: + """Serializes the SchemaInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.catalog_type is not None: body['catalog_type'] = self.catalog_type @@ -2229,7 +3027,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SchemaInfo': + def from_dict(cls, d: Dict[str, any]) -> SchemaInfo: + """Deserializes the SchemaInfo from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), catalog_type=d.get('catalog_type', None), comment=d.get('comment', None), @@ -2275,17 +3074,22 @@ class SecurableType(Enum): @dataclass class SetArtifactAllowlist: - artifact_matchers: 'List[ArtifactMatcher]' - artifact_type: Optional['ArtifactType'] = None + artifact_matchers: List[ArtifactMatcher] + """A list of allowed artifact match patterns.""" + + artifact_type: Optional[ArtifactType] = None + """The artifact type of the allowlist.""" def as_dict(self) -> dict: + """Serializes the SetArtifactAllowlist into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact_matchers: body['artifact_matchers'] = [v.as_dict() for v in self.artifact_matchers] if self.artifact_type is not None: body['artifact_type'] = self.artifact_type.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetArtifactAllowlist': + def from_dict(cls, d: Dict[str, any]) -> SetArtifactAllowlist: + """Deserializes the SetArtifactAllowlist from a dictionary.""" return cls(artifact_matchers=_repeated_dict(d, 'artifact_matchers', ArtifactMatcher), artifact_type=_enum(d, 'artifact_type', ArtifactType)) @@ -2293,10 +3097,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'SetArtifactAllowlist': @dataclass class SetRegisteredModelAliasRequest: full_name: str + """Full name of the registered model""" + alias: str + """The name of the alias""" + version_num: int + """The version number of the model version to which the alias points""" def as_dict(self) -> dict: + """Serializes the SetRegisteredModelAliasRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.alias is not None: body['alias'] = self.alias if self.full_name is not None: body['full_name'] = self.full_name @@ -2304,7 +3114,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetRegisteredModelAliasRequest': + def from_dict(cls, d: Dict[str, any]) -> SetRegisteredModelAliasRequest: + """Deserializes the SetRegisteredModelAliasRequest from a dictionary.""" return cls(alias=d.get('alias', None), full_name=d.get('full_name', None), version_num=d.get('version_num', None)) @@ -2314,17 +3125,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'SetRegisteredModelAliasRequest': class SseEncryptionDetails: """Server-Side Encryption properties for clients communicating with AWS s3.""" - algorithm: Optional['SseEncryptionDetailsAlgorithm'] = None + algorithm: Optional[SseEncryptionDetailsAlgorithm] = None + """The type of key encryption to use (affects headers from s3 client).""" + aws_kms_key_arn: Optional[str] = None + """When algorithm is **AWS_SSE_KMS** this field specifies the ARN of the SSE key to use.""" def as_dict(self) -> dict: + """Serializes the SseEncryptionDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.algorithm is not None: body['algorithm'] = self.algorithm.value if self.aws_kms_key_arn is not None: body['aws_kms_key_arn'] = self.aws_kms_key_arn return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SseEncryptionDetails': + def from_dict(cls, d: Dict[str, any]) -> SseEncryptionDetails: + """Deserializes the SseEncryptionDetails from a dictionary.""" return cls(algorithm=_enum(d, 'algorithm', SseEncryptionDetailsAlgorithm), aws_kms_key_arn=d.get('aws_kms_key_arn', None)) @@ -2338,23 +3154,53 @@ class SseEncryptionDetailsAlgorithm(Enum): @dataclass class StorageCredentialInfo: - aws_iam_role: Optional['AwsIamRole'] = None - azure_managed_identity: Optional['AzureManagedIdentity'] = None - azure_service_principal: Optional['AzureServicePrincipal'] = None + aws_iam_role: Optional[AwsIamRole] = None + """The AWS IAM role configuration.""" + + azure_managed_identity: Optional[AzureManagedIdentity] = None + """The Azure managed identity configuration.""" + + azure_service_principal: Optional[AzureServicePrincipal] = None + """The Azure service principal configuration.""" + comment: Optional[str] = None + """Comment associated with the credential.""" + created_at: Optional[int] = None + """Time at which this Credential was created, in epoch milliseconds.""" + created_by: Optional[str] = None - databricks_gcp_service_account: Optional['DatabricksGcpServiceAccountResponse'] = None + """Username of credential creator.""" + + databricks_gcp_service_account: Optional[DatabricksGcpServiceAccountResponse] = None + """The managed GCP service account configuration.""" + id: Optional[str] = None + """The unique identifier of the credential.""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" + name: Optional[str] = None + """The credential name. The name must be unique within the metastore.""" + owner: Optional[str] = None + """Username of current owner of credential.""" + read_only: Optional[bool] = None + """Whether the storage credential is only usable for read operations.""" + updated_at: Optional[int] = None + """Time at which this credential was last modified, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified the credential.""" + used_for_managed_storage: Optional[bool] = None + """Whether this credential is the current metastore's root storage credential.""" def as_dict(self) -> dict: + """Serializes the StorageCredentialInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_iam_role: body['aws_iam_role'] = self.aws_iam_role.as_dict() if self.azure_managed_identity: body['azure_managed_identity'] = self.azure_managed_identity.as_dict() @@ -2377,7 +3223,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StorageCredentialInfo': + def from_dict(cls, d: Dict[str, any]) -> StorageCredentialInfo: + """Deserializes the StorageCredentialInfo from a dictionary.""" return cls(aws_iam_role=_from_dict(d, 'aws_iam_role', AwsIamRole), azure_managed_identity=_from_dict(d, 'azure_managed_identity', AzureManagedIdentity), azure_service_principal=_from_dict(d, 'azure_service_principal', AzureServicePrincipal), @@ -2399,16 +3246,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'StorageCredentialInfo': @dataclass class SystemSchemaInfo: schema: Optional[str] = None - state: Optional['SystemSchemaInfoState'] = None + """Name of the system schema.""" + + state: Optional[SystemSchemaInfoState] = None + """The current state of enablement for the system schema. An empty string means the system schema + is available and ready for opt-in.""" def as_dict(self) -> dict: + """Serializes the SystemSchemaInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.schema is not None: body['schema'] = self.schema if self.state is not None: body['state'] = self.state.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SystemSchemaInfo': + def from_dict(cls, d: Dict[str, any]) -> SystemSchemaInfo: + """Deserializes the SystemSchemaInfo from a dictionary.""" return cls(schema=d.get('schema', None), state=_enum(d, 'state', SystemSchemaInfoState)) @@ -2428,11 +3281,14 @@ class TableConstraint: """A table constraint, as defined by *one* of the following fields being set: __primary_key_constraint__, __foreign_key_constraint__, __named_table_constraint__.""" - foreign_key_constraint: Optional['ForeignKeyConstraint'] = None - named_table_constraint: Optional['NamedTableConstraint'] = None - primary_key_constraint: Optional['PrimaryKeyConstraint'] = None + foreign_key_constraint: Optional[ForeignKeyConstraint] = None + + named_table_constraint: Optional[NamedTableConstraint] = None + + primary_key_constraint: Optional[PrimaryKeyConstraint] = None def as_dict(self) -> dict: + """Serializes the TableConstraint into a dictionary suitable for use as a JSON request body.""" body = {} if self.foreign_key_constraint: body['foreign_key_constraint'] = self.foreign_key_constraint.as_dict() if self.named_table_constraint: body['named_table_constraint'] = self.named_table_constraint.as_dict() @@ -2440,7 +3296,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TableConstraint': + def from_dict(cls, d: Dict[str, any]) -> TableConstraint: + """Deserializes the TableConstraint from a dictionary.""" return cls(foreign_key_constraint=_from_dict(d, 'foreign_key_constraint', ForeignKeyConstraint), named_table_constraint=_from_dict(d, 'named_table_constraint', NamedTableConstraint), primary_key_constraint=_from_dict(d, 'primary_key_constraint', PrimaryKeyConstraint)) @@ -2448,15 +3305,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'TableConstraint': @dataclass class TableConstraintList: - table_constraints: Optional['List[TableConstraint]'] = None + table_constraints: Optional[List[TableConstraint]] = None + """List of table constraints. Note: this field is not set in the output of the __listTables__ API.""" def as_dict(self) -> dict: + """Serializes the TableConstraintList into a dictionary suitable for use as a JSON request body.""" body = {} if self.table_constraints: body['table_constraints'] = [v.as_dict() for v in self.table_constraints] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TableConstraintList': + def from_dict(cls, d: Dict[str, any]) -> TableConstraintList: + """Deserializes the TableConstraintList from a dictionary.""" return cls(table_constraints=_repeated_dict(d, 'table_constraints', TableConstraint)) @@ -2465,52 +3325,120 @@ class TableDependency: """A table that is dependent on a SQL object.""" table_full_name: str + """Full name of the dependent table, in the form of + __catalog_name__.__schema_name__.__table_name__.""" def as_dict(self) -> dict: + """Serializes the TableDependency into a dictionary suitable for use as a JSON request body.""" body = {} if self.table_full_name is not None: body['table_full_name'] = self.table_full_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TableDependency': + def from_dict(cls, d: Dict[str, any]) -> TableDependency: + """Deserializes the TableDependency from a dictionary.""" return cls(table_full_name=d.get('table_full_name', None)) @dataclass class TableInfo: access_point: Optional[str] = None + """The AWS access point to use when accesing s3 for this external location.""" + catalog_name: Optional[str] = None - columns: Optional['List[ColumnInfo]'] = None + """Name of parent catalog.""" + + columns: Optional[List[ColumnInfo]] = None + """The array of __ColumnInfo__ definitions of the table's columns.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + created_at: Optional[int] = None + """Time at which this table was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of table creator.""" + data_access_configuration_id: Optional[str] = None - data_source_format: Optional['DataSourceFormat'] = None + """Unique ID of the Data Access Configuration to use with the table data.""" + + data_source_format: Optional[DataSourceFormat] = None + """Data source format""" + deleted_at: Optional[int] = None - delta_runtime_properties_kvpairs: Optional['DeltaRuntimePropertiesKvPairs'] = None - effective_predictive_optimization_flag: Optional['EffectivePredictiveOptimizationFlag'] = None - enable_predictive_optimization: Optional['EnablePredictiveOptimization'] = None - encryption_details: Optional['EncryptionDetails'] = None + """Time at which this table was deleted, in epoch milliseconds. Field is omitted if table is not + deleted.""" + + delta_runtime_properties_kvpairs: Optional[DeltaRuntimePropertiesKvPairs] = None + """Information pertaining to current state of the delta table.""" + + effective_predictive_optimization_flag: Optional[EffectivePredictiveOptimizationFlag] = None + + enable_predictive_optimization: Optional[EnablePredictiveOptimization] = None + """Whether predictive optimization should be enabled for this object and objects under it.""" + + encryption_details: Optional[EncryptionDetails] = None + """Encryption options that apply to clients connecting to cloud storage.""" + full_name: Optional[str] = None + """Full name of table, in form of __catalog_name__.__schema_name__.__table_name__""" + metastore_id: Optional[str] = None + """Unique identifier of parent metastore.""" + name: Optional[str] = None + """Name of table, relative to parent schema.""" + owner: Optional[str] = None + """Username of current owner of table.""" + pipeline_id: Optional[str] = None - properties: Optional['Dict[str,str]'] = None - row_filter: Optional['TableRowFilter'] = None + """The pipeline ID of the table. Applicable for tables created by pipelines (Materialized View, + Streaming Table, etc.).""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" + + row_filter: Optional[TableRowFilter] = None + schema_name: Optional[str] = None + """Name of parent schema relative to its parent catalog.""" + sql_path: Optional[str] = None + """List of schemes whose objects can be referenced without qualification.""" + storage_credential_name: Optional[str] = None + """Name of the storage credential, when a storage credential is configured for use with this table.""" + storage_location: Optional[str] = None - table_constraints: Optional['TableConstraintList'] = None + """Storage root URL for table (for **MANAGED**, **EXTERNAL** tables)""" + + table_constraints: Optional[TableConstraintList] = None + table_id: Optional[str] = None - table_type: Optional['TableType'] = None + """Name of table, relative to parent schema.""" + + table_type: Optional[TableType] = None + updated_at: Optional[int] = None + """Time at which this table was last modified, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified the table.""" + view_definition: Optional[str] = None - view_dependencies: Optional['DependencyList'] = None + """View definition SQL (when __table_type__ is **VIEW**, **MATERIALIZED_VIEW**, or + **STREAMING_TABLE**)""" + + view_dependencies: Optional[DependencyList] = None + """View dependencies (when table_type == **VIEW** or **MATERIALIZED_VIEW**, **STREAMING_TABLE**) - + when DependencyList is None, the dependency is not provided; - when DependencyList is an empty + list, the dependency is provided but is empty; - when DependencyList is not an empty list, + dependencies are provided and recorded.""" def as_dict(self) -> dict: + """Serializes the TableInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_point is not None: body['access_point'] = self.access_point if self.catalog_name is not None: body['catalog_name'] = self.catalog_name @@ -2553,7 +3481,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TableInfo': + def from_dict(cls, d: Dict[str, any]) -> TableInfo: + """Deserializes the TableInfo from a dictionary.""" return cls(access_point=d.get('access_point', None), catalog_name=d.get('catalog_name', None), columns=_repeated_dict(d, 'columns', ColumnInfo), @@ -2593,32 +3522,42 @@ def from_dict(cls, d: Dict[str, any]) -> 'TableInfo': @dataclass class TableRowFilter: name: str - input_column_names: 'List[str]' + """The full name of the row filter SQL UDF.""" + + input_column_names: List[str] + """The list of table columns to be passed as input to the row filter function. The column types + should match the types of the filter function arguments.""" def as_dict(self) -> dict: + """Serializes the TableRowFilter into a dictionary suitable for use as a JSON request body.""" body = {} if self.input_column_names: body['input_column_names'] = [v for v in self.input_column_names] if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TableRowFilter': + def from_dict(cls, d: Dict[str, any]) -> TableRowFilter: + """Deserializes the TableRowFilter from a dictionary.""" return cls(input_column_names=d.get('input_column_names', None), name=d.get('name', None)) @dataclass class TableSummary: full_name: Optional[str] = None - table_type: Optional['TableType'] = None + """The full name of the table.""" + + table_type: Optional[TableType] = None def as_dict(self) -> dict: + """Serializes the TableSummary into a dictionary suitable for use as a JSON request body.""" body = {} if self.full_name is not None: body['full_name'] = self.full_name if self.table_type is not None: body['table_type'] = self.table_type.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TableSummary': + def from_dict(cls, d: Dict[str, any]) -> TableSummary: + """Deserializes the TableSummary from a dictionary.""" return cls(full_name=d.get('full_name', None), table_type=_enum(d, 'table_type', TableType)) @@ -2634,13 +3573,25 @@ class TableType(Enum): @dataclass class UpdateCatalog: comment: Optional[str] = None - enable_predictive_optimization: Optional['EnablePredictiveOptimization'] = None - isolation_mode: Optional['IsolationMode'] = None + """User-provided free-form text description.""" + + enable_predictive_optimization: Optional[EnablePredictiveOptimization] = None + """Whether predictive optimization should be enabled for this object and objects under it.""" + + isolation_mode: Optional[IsolationMode] = None + """Whether the current securable is accessible from all workspaces or a specific set of workspaces.""" + name: Optional[str] = None + """Name of catalog.""" + owner: Optional[str] = None - properties: Optional['Dict[str,str]'] = None + """Username of current owner of catalog.""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" def as_dict(self) -> dict: + """Serializes the UpdateCatalog into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.enable_predictive_optimization is not None: @@ -2652,7 +3603,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateCatalog': + def from_dict(cls, d: Dict[str, any]) -> UpdateCatalog: + """Deserializes the UpdateCatalog from a dictionary.""" return cls(comment=d.get('comment', None), enable_predictive_optimization=_enum(d, 'enable_predictive_optimization', EnablePredictiveOptimization), @@ -2665,11 +3617,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateCatalog': @dataclass class UpdateConnection: name: str - options: 'Dict[str,str]' + """Name of the connection.""" + + options: Dict[str, str] + """A map of key-value properties attached to the securable.""" + name_arg: Optional[str] = None + """Name of the connection.""" + owner: Optional[str] = None + """Username of current owner of the connection.""" def as_dict(self) -> dict: + """Serializes the UpdateConnection into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.name_arg is not None: body['name_arg'] = self.name_arg @@ -2678,7 +3638,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateConnection': + def from_dict(cls, d: Dict[str, any]) -> UpdateConnection: + """Deserializes the UpdateConnection from a dictionary.""" return cls(name=d.get('name', None), name_arg=d.get('name_arg', None), options=d.get('options', None), @@ -2688,17 +3649,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateConnection': @dataclass class UpdateExternalLocation: access_point: Optional[str] = None + """The AWS access point to use when accesing s3 for this external location.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + credential_name: Optional[str] = None - encryption_details: Optional['EncryptionDetails'] = None + """Name of the storage credential used with this location.""" + + encryption_details: Optional[EncryptionDetails] = None + """Encryption options that apply to clients connecting to cloud storage.""" + force: Optional[bool] = None + """Force update even if changing url invalidates dependent external tables or mounts.""" + name: Optional[str] = None + """Name of the external location.""" + owner: Optional[str] = None + """The owner of the external location.""" + read_only: Optional[bool] = None + """Indicates whether the external location is read-only.""" + skip_validation: Optional[bool] = None + """Skips validation of the storage credential associated with the external location.""" + url: Optional[str] = None + """Path URL of the external location.""" def as_dict(self) -> dict: + """Serializes the UpdateExternalLocation into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_point is not None: body['access_point'] = self.access_point if self.comment is not None: body['comment'] = self.comment @@ -2713,7 +3694,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateExternalLocation': + def from_dict(cls, d: Dict[str, any]) -> UpdateExternalLocation: + """Deserializes the UpdateExternalLocation from a dictionary.""" return cls(access_point=d.get('access_point', None), comment=d.get('comment', None), credential_name=d.get('credential_name', None), @@ -2729,31 +3711,54 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateExternalLocation': @dataclass class UpdateFunction: name: Optional[str] = None + """The fully-qualified name of the function (of the form + __catalog_name__.__schema_name__.__function__name__).""" + owner: Optional[str] = None + """Username of current owner of function.""" def as_dict(self) -> dict: + """Serializes the UpdateFunction into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.owner is not None: body['owner'] = self.owner return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateFunction': + def from_dict(cls, d: Dict[str, any]) -> UpdateFunction: + """Deserializes the UpdateFunction from a dictionary.""" return cls(name=d.get('name', None), owner=d.get('owner', None)) @dataclass class UpdateMetastore: delta_sharing_organization_name: Optional[str] = None + """The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta + Sharing as the official name.""" + delta_sharing_recipient_token_lifetime_in_seconds: Optional[int] = None - delta_sharing_scope: Optional['UpdateMetastoreDeltaSharingScope'] = None + """The lifetime of delta sharing recipient token in seconds.""" + + delta_sharing_scope: Optional[UpdateMetastoreDeltaSharingScope] = None + """The scope of Delta Sharing enabled for the metastore.""" + id: Optional[str] = None + """Unique ID of the metastore.""" + name: Optional[str] = None + """The user-specified name of the metastore.""" + owner: Optional[str] = None + """The owner of the metastore.""" + privilege_model_version: Optional[str] = None + """Privilege model version of the metastore, of the form `major.minor` (e.g., `1.0`).""" + storage_root_credential_id: Optional[str] = None + """UUID of storage credential to access the metastore storage_root.""" def as_dict(self) -> dict: + """Serializes the UpdateMetastore into a dictionary suitable for use as a JSON request body.""" body = {} if self.delta_sharing_organization_name is not None: body['delta_sharing_organization_name'] = self.delta_sharing_organization_name @@ -2771,7 +3776,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateMetastore': + def from_dict(cls, d: Dict[str, any]) -> UpdateMetastore: + """Deserializes the UpdateMetastore from a dictionary.""" return cls(delta_sharing_organization_name=d.get('delta_sharing_organization_name', None), delta_sharing_recipient_token_lifetime_in_seconds=d.get( 'delta_sharing_recipient_token_lifetime_in_seconds', None), @@ -2786,10 +3792,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateMetastore': @dataclass class UpdateMetastoreAssignment: default_catalog_name: Optional[str] = None + """The name of the default catalog for the metastore.""" + metastore_id: Optional[str] = None + """The unique ID of the metastore.""" + workspace_id: Optional[int] = None + """A workspace ID.""" def as_dict(self) -> dict: + """Serializes the UpdateMetastoreAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.default_catalog_name is not None: body['default_catalog_name'] = self.default_catalog_name if self.metastore_id is not None: body['metastore_id'] = self.metastore_id @@ -2797,7 +3809,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateMetastoreAssignment': + def from_dict(cls, d: Dict[str, any]) -> UpdateMetastoreAssignment: + """Deserializes the UpdateMetastoreAssignment from a dictionary.""" return cls(default_catalog_name=d.get('default_catalog_name', None), metastore_id=d.get('metastore_id', None), workspace_id=d.get('workspace_id', None)) @@ -2813,10 +3826,16 @@ class UpdateMetastoreDeltaSharingScope(Enum): @dataclass class UpdateModelVersionRequest: comment: Optional[str] = None + """The comment attached to the model version""" + full_name: Optional[str] = None + """The three-level (fully qualified) name of the model version""" + version: Optional[int] = None + """The integer version number of the model version""" def as_dict(self) -> dict: + """Serializes the UpdateModelVersionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.full_name is not None: body['full_name'] = self.full_name @@ -2824,7 +3843,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelVersionRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateModelVersionRequest: + """Deserializes the UpdateModelVersionRequest from a dictionary.""" return cls(comment=d.get('comment', None), full_name=d.get('full_name', None), version=d.get('version', None)) @@ -2832,11 +3852,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelVersionRequest': @dataclass class UpdatePermissions: - changes: Optional['List[PermissionsChange]'] = None + changes: Optional[List[PermissionsChange]] = None + """Array of permissions change objects.""" + full_name: Optional[str] = None - securable_type: Optional['SecurableType'] = None + """Full name of securable.""" + + securable_type: Optional[SecurableType] = None + """Type of securable.""" def as_dict(self) -> dict: + """Serializes the UpdatePermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.changes: body['changes'] = [v.as_dict() for v in self.changes] if self.full_name is not None: body['full_name'] = self.full_name @@ -2844,7 +3870,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdatePermissions': + def from_dict(cls, d: Dict[str, any]) -> UpdatePermissions: + """Deserializes the UpdatePermissions from a dictionary.""" return cls(changes=_repeated_dict(d, 'changes', PermissionsChange), full_name=d.get('full_name', None), securable_type=_enum(d, 'securable_type', SecurableType)) @@ -2853,11 +3880,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdatePermissions': @dataclass class UpdateRegisteredModelRequest: comment: Optional[str] = None + """The comment attached to the registered model""" + full_name: Optional[str] = None + """The three-level (fully qualified) name of the registered model""" + name: Optional[str] = None + """The name of the registered model""" + owner: Optional[str] = None + """The identifier of the user who owns the registered model""" def as_dict(self) -> dict: + """Serializes the UpdateRegisteredModelRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.full_name is not None: body['full_name'] = self.full_name @@ -2866,7 +3901,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRegisteredModelRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateRegisteredModelRequest: + """Deserializes the UpdateRegisteredModelRequest from a dictionary.""" return cls(comment=d.get('comment', None), full_name=d.get('full_name', None), name=d.get('name', None), @@ -2876,13 +3912,25 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateRegisteredModelRequest': @dataclass class UpdateSchema: comment: Optional[str] = None - enable_predictive_optimization: Optional['EnablePredictiveOptimization'] = None + """User-provided free-form text description.""" + + enable_predictive_optimization: Optional[EnablePredictiveOptimization] = None + """Whether predictive optimization should be enabled for this object and objects under it.""" + full_name: Optional[str] = None + """Full name of the schema.""" + name: Optional[str] = None + """Name of schema, relative to parent catalog.""" + owner: Optional[str] = None - properties: Optional['Dict[str,str]'] = None + """Username of current owner of schema.""" + + properties: Optional[Dict[str, str]] = None + """A map of key-value properties attached to the securable.""" def as_dict(self) -> dict: + """Serializes the UpdateSchema into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.enable_predictive_optimization is not None: @@ -2894,7 +3942,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateSchema': + def from_dict(cls, d: Dict[str, any]) -> UpdateSchema: + """Deserializes the UpdateSchema from a dictionary.""" return cls(comment=d.get('comment', None), enable_predictive_optimization=_enum(d, 'enable_predictive_optimization', EnablePredictiveOptimization), @@ -2906,18 +3955,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateSchema': @dataclass class UpdateStorageCredential: - aws_iam_role: Optional['AwsIamRole'] = None - azure_managed_identity: Optional['AzureManagedIdentity'] = None - azure_service_principal: Optional['AzureServicePrincipal'] = None + aws_iam_role: Optional[AwsIamRole] = None + """The AWS IAM role configuration.""" + + azure_managed_identity: Optional[AzureManagedIdentity] = None + """The Azure managed identity configuration.""" + + azure_service_principal: Optional[AzureServicePrincipal] = None + """The Azure service principal configuration.""" + comment: Optional[str] = None + """Comment associated with the credential.""" + databricks_gcp_service_account: Optional[Any] = None + """The managed GCP service account configuration.""" + force: Optional[bool] = None + """Force update even if there are dependent external locations or external tables.""" + name: Optional[str] = None + """The credential name. The name must be unique within the metastore.""" + owner: Optional[str] = None + """Username of current owner of credential.""" + read_only: Optional[bool] = None + """Whether the storage credential is only usable for read operations.""" + skip_validation: Optional[bool] = None + """Supplying true to this argument skips validation of the updated credential.""" def as_dict(self) -> dict: + """Serializes the UpdateStorageCredential into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_iam_role: body['aws_iam_role'] = self.aws_iam_role.as_dict() if self.azure_managed_identity: body['azure_managed_identity'] = self.azure_managed_identity.as_dict() @@ -2934,7 +4003,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateStorageCredential': + def from_dict(cls, d: Dict[str, any]) -> UpdateStorageCredential: + """Deserializes the UpdateStorageCredential from a dictionary.""" return cls(aws_iam_role=_from_dict(d, 'aws_iam_role', AwsIamRole), azure_managed_identity=_from_dict(d, 'azure_managed_identity', AzureManagedIdentity), azure_service_principal=_from_dict(d, 'azure_service_principal', AzureServicePrincipal), @@ -2950,11 +4020,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateStorageCredential': @dataclass class UpdateVolumeRequestContent: comment: Optional[str] = None + """The comment attached to the volume""" + full_name_arg: Optional[str] = None + """The three-level (fully qualified) name of the volume""" + name: Optional[str] = None + """The name of the volume""" + owner: Optional[str] = None + """The identifier of the user who owns the volume""" def as_dict(self) -> dict: + """Serializes the UpdateVolumeRequestContent into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.full_name_arg is not None: body['full_name_arg'] = self.full_name_arg @@ -2963,7 +4041,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateVolumeRequestContent': + def from_dict(cls, d: Dict[str, any]) -> UpdateVolumeRequestContent: + """Deserializes the UpdateVolumeRequestContent from a dictionary.""" return cls(comment=d.get('comment', None), full_name_arg=d.get('full_name_arg', None), name=d.get('name', None), @@ -2972,11 +4051,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateVolumeRequestContent': @dataclass class UpdateWorkspaceBindings: - assign_workspaces: Optional['List[int]'] = None + assign_workspaces: Optional[List[int]] = None + """A list of workspace IDs.""" + name: Optional[str] = None - unassign_workspaces: Optional['List[int]'] = None + """The name of the catalog.""" + + unassign_workspaces: Optional[List[int]] = None + """A list of workspace IDs.""" def as_dict(self) -> dict: + """Serializes the UpdateWorkspaceBindings into a dictionary suitable for use as a JSON request body.""" body = {} if self.assign_workspaces: body['assign_workspaces'] = [v for v in self.assign_workspaces] if self.name is not None: body['name'] = self.name @@ -2984,7 +4069,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceBindings': + def from_dict(cls, d: Dict[str, any]) -> UpdateWorkspaceBindings: + """Deserializes the UpdateWorkspaceBindings from a dictionary.""" return cls(assign_workspaces=d.get('assign_workspaces', None), name=d.get('name', None), unassign_workspaces=d.get('unassign_workspaces', None)) @@ -2992,12 +4078,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceBindings': @dataclass class UpdateWorkspaceBindingsParameters: - add: Optional['List[WorkspaceBinding]'] = None - remove: Optional['List[WorkspaceBinding]'] = None + add: Optional[List[WorkspaceBinding]] = None + """List of workspace bindings""" + + remove: Optional[List[WorkspaceBinding]] = None + """List of workspace bindings""" + securable_name: Optional[str] = None + """The name of the securable.""" + securable_type: Optional[str] = None + """The type of the securable.""" def as_dict(self) -> dict: + """Serializes the UpdateWorkspaceBindingsParameters into a dictionary suitable for use as a JSON request body.""" body = {} if self.add: body['add'] = [v.as_dict() for v in self.add] if self.remove: body['remove'] = [v.as_dict() for v in self.remove] @@ -3006,7 +4100,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceBindingsParameters': + def from_dict(cls, d: Dict[str, any]) -> UpdateWorkspaceBindingsParameters: + """Deserializes the UpdateWorkspaceBindingsParameters from a dictionary.""" return cls(add=_repeated_dict(d, 'add', WorkspaceBinding), remove=_repeated_dict(d, 'remove', WorkspaceBinding), securable_name=d.get('securable_name', None), @@ -3015,16 +4110,32 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceBindingsParameters': @dataclass class ValidateStorageCredential: - aws_iam_role: Optional['AwsIamRole'] = None - azure_managed_identity: Optional['AzureManagedIdentity'] = None - azure_service_principal: Optional['AzureServicePrincipal'] = None + aws_iam_role: Optional[AwsIamRole] = None + """The AWS IAM role configuration.""" + + azure_managed_identity: Optional[AzureManagedIdentity] = None + """The Azure managed identity configuration.""" + + azure_service_principal: Optional[AzureServicePrincipal] = None + """The Azure service principal configuration.""" + databricks_gcp_service_account: Optional[Any] = None + """The Databricks created GCP service account configuration.""" + external_location_name: Optional[str] = None + """The name of an existing external location to validate.""" + read_only: Optional[bool] = None + """Whether the storage credential is only usable for read operations.""" + storage_credential_name: Optional[Any] = None + """The name of the storage credential to validate.""" + url: Optional[str] = None + """The external location url to validate.""" def as_dict(self) -> dict: + """Serializes the ValidateStorageCredential into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_iam_role: body['aws_iam_role'] = self.aws_iam_role.as_dict() if self.azure_managed_identity: body['azure_managed_identity'] = self.azure_managed_identity.as_dict() @@ -3040,7 +4151,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ValidateStorageCredential': + def from_dict(cls, d: Dict[str, any]) -> ValidateStorageCredential: + """Deserializes the ValidateStorageCredential from a dictionary.""" return cls(aws_iam_role=_from_dict(d, 'aws_iam_role', AwsIamRole), azure_managed_identity=_from_dict(d, 'azure_managed_identity', AzureManagedIdentity), azure_service_principal=_from_dict(d, 'azure_service_principal', AzureServicePrincipal), @@ -3054,26 +4166,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'ValidateStorageCredential': @dataclass class ValidateStorageCredentialResponse: is_dir: Optional[bool] = None - results: Optional['List[ValidationResult]'] = None + """Whether the tested location is a directory in cloud storage.""" + + results: Optional[List[ValidationResult]] = None + """The results of the validation check.""" def as_dict(self) -> dict: + """Serializes the ValidateStorageCredentialResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.is_dir is not None: body['isDir'] = self.is_dir if self.results: body['results'] = [v.as_dict() for v in self.results] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ValidateStorageCredentialResponse': + def from_dict(cls, d: Dict[str, any]) -> ValidateStorageCredentialResponse: + """Deserializes the ValidateStorageCredentialResponse from a dictionary.""" return cls(is_dir=d.get('isDir', None), results=_repeated_dict(d, 'results', ValidationResult)) @dataclass class ValidationResult: message: Optional[str] = None - operation: Optional['ValidationResultOperation'] = None - result: Optional['ValidationResultResult'] = None + """Error message would exist when the result does not equal to **PASS**.""" + + operation: Optional[ValidationResultOperation] = None + """The operation tested.""" + + result: Optional[ValidationResultResult] = None + """The results of the tested operation.""" def as_dict(self) -> dict: + """Serializes the ValidationResult into a dictionary suitable for use as a JSON request body.""" body = {} if self.message is not None: body['message'] = self.message if self.operation is not None: body['operation'] = self.operation.value @@ -3081,7 +4204,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ValidationResult': + def from_dict(cls, d: Dict[str, any]) -> ValidationResult: + """Deserializes the ValidationResult from a dictionary.""" return cls(message=d.get('message', None), operation=_enum(d, 'operation', ValidationResultOperation), result=_enum(d, 'result', ValidationResultResult)) @@ -3107,23 +4231,52 @@ class ValidationResultResult(Enum): @dataclass class VolumeInfo: access_point: Optional[str] = None + """The AWS access point to use when accesing s3 for this external location.""" + catalog_name: Optional[str] = None + """The name of the catalog where the schema and the volume are""" + comment: Optional[str] = None + """The comment attached to the volume""" + created_at: Optional[int] = None + created_by: Optional[str] = None - encryption_details: Optional['EncryptionDetails'] = None + """The identifier of the user who created the volume""" + + encryption_details: Optional[EncryptionDetails] = None + """Encryption options that apply to clients connecting to cloud storage.""" + full_name: Optional[str] = None + """The three-level (fully qualified) name of the volume""" + metastore_id: Optional[str] = None + """The unique identifier of the metastore""" + name: Optional[str] = None + """The name of the volume""" + owner: Optional[str] = None + """The identifier of the user who owns the volume""" + schema_name: Optional[str] = None + """The name of the schema where the volume is""" + storage_location: Optional[str] = None + """The storage location on the cloud""" + updated_at: Optional[int] = None + updated_by: Optional[str] = None + """The identifier of the user who updated the volume last time""" + volume_id: Optional[str] = None - volume_type: Optional['VolumeType'] = None + """The unique identifier of the volume""" + + volume_type: Optional[VolumeType] = None def as_dict(self) -> dict: + """Serializes the VolumeInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_point is not None: body['access_point'] = self.access_point if self.catalog_name is not None: body['catalog_name'] = self.catalog_name @@ -3144,7 +4297,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'VolumeInfo': + def from_dict(cls, d: Dict[str, any]) -> VolumeInfo: + """Deserializes the VolumeInfo from a dictionary.""" return cls(access_point=d.get('access_point', None), catalog_name=d.get('catalog_name', None), comment=d.get('comment', None), @@ -3171,17 +4325,20 @@ class VolumeType(Enum): @dataclass class WorkspaceBinding: - binding_type: Optional['WorkspaceBindingBindingType'] = None + binding_type: Optional[WorkspaceBindingBindingType] = None + workspace_id: Optional[int] = None def as_dict(self) -> dict: + """Serializes the WorkspaceBinding into a dictionary suitable for use as a JSON request body.""" body = {} if self.binding_type is not None: body['binding_type'] = self.binding_type.value if self.workspace_id is not None: body['workspace_id'] = self.workspace_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceBinding': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceBinding: + """Deserializes the WorkspaceBinding from a dictionary.""" return cls(binding_type=_enum(d, 'binding_type', WorkspaceBindingBindingType), workspace_id=d.get('workspace_id', None)) @@ -3196,15 +4353,18 @@ class WorkspaceBindingBindingType(Enum): class WorkspaceBindingsResponse: """Currently assigned workspace bindings""" - bindings: Optional['List[WorkspaceBinding]'] = None + bindings: Optional[List[WorkspaceBinding]] = None + """List of workspace bindings""" def as_dict(self) -> dict: + """Serializes the WorkspaceBindingsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.bindings: body['bindings'] = [v.as_dict() for v in self.bindings] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceBindingsResponse': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceBindingsResponse: + """Deserializes the WorkspaceBindingsResponse from a dictionary.""" return cls(bindings=_repeated_dict(d, 'bindings', WorkspaceBinding)) @@ -3387,7 +4547,7 @@ def get(self, metastore_id: str) -> AccountsMetastoreInfo: headers=headers) return AccountsMetastoreInfo.from_dict(res) - def list(self) -> Iterator['MetastoreInfo']: + def list(self) -> Iterator[MetastoreInfo]: """Get all metastores associated with an account. Gets all Unity Catalog metastores associated with an account specified by ID. @@ -3506,7 +4666,7 @@ def get(self, metastore_id: str, storage_credential_name: str) -> AccountsStorag headers=headers) return AccountsStorageCredentialInfo.from_dict(res) - def list(self, metastore_id: str) -> Iterator['StorageCredentialInfo']: + def list(self, metastore_id: str) -> Iterator[StorageCredentialInfo]: """Get all storage credentials assigned to a metastore. Gets a list of all storage credentials that have been assigned to given metastore. @@ -3698,7 +4858,7 @@ def get(self, name: str) -> CatalogInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/catalogs/{name}', headers=headers) return CatalogInfo.from_dict(res) - def list(self) -> Iterator['CatalogInfo']: + def list(self) -> Iterator[CatalogInfo]: """List catalogs. Gets an array of catalogs in the metastore. If the caller is the metastore admin, all catalogs will be @@ -3837,7 +4997,7 @@ def get(self, name_arg: str) -> ConnectionInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/connections/{name_arg}', headers=headers) return ConnectionInfo.from_dict(res) - def list(self) -> Iterator['ConnectionInfo']: + def list(self) -> Iterator[ConnectionInfo]: """List connections. List all connections. @@ -3984,7 +5144,7 @@ def get(self, name: str) -> ExternalLocationInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/external-locations/{name}', headers=headers) return ExternalLocationInfo.from_dict(res) - def list(self) -> Iterator['ExternalLocationInfo']: + def list(self) -> Iterator[ExternalLocationInfo]: """List external locations. Gets an array of external locations (__ExternalLocationInfo__ objects) from the metastore. The caller @@ -4132,7 +5292,7 @@ def get(self, name: str) -> FunctionInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/functions/{name}', headers=headers) return FunctionInfo.from_dict(res) - def list(self, catalog_name: str, schema_name: str) -> Iterator['FunctionInfo']: + def list(self, catalog_name: str, schema_name: str) -> Iterator[FunctionInfo]: """List functions. List functions within the specified parent catalog and schema. If the user is a metastore admin, all @@ -4398,7 +5558,7 @@ def get(self, id: str) -> MetastoreInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/metastores/{id}', headers=headers) return MetastoreInfo.from_dict(res) - def list(self) -> Iterator['MetastoreInfo']: + def list(self) -> Iterator[MetastoreInfo]: """List metastores. Gets an array of the available metastores (as __MetastoreInfo__ objects). The caller must be an admin @@ -4612,7 +5772,7 @@ def list(self, full_name: str, *, max_results: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['ModelVersionInfo']: + page_token: Optional[str] = None) -> Iterator[ModelVersionInfo]: """List Model Versions. List model versions. You can list model versions under a particular schema, or list all model versions @@ -4817,7 +5977,7 @@ def list(self, catalog_name: Optional[str] = None, max_results: Optional[int] = None, page_token: Optional[str] = None, - schema_name: Optional[str] = None) -> Iterator['RegisteredModelInfo']: + schema_name: Optional[str] = None) -> Iterator[RegisteredModelInfo]: """List Registered Models. List registered models. You can list registered models under a particular schema, or list all @@ -5002,7 +6162,7 @@ def get(self, full_name: str) -> SchemaInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/schemas/{full_name}', headers=headers) return SchemaInfo.from_dict(res) - def list(self, catalog_name: str) -> Iterator['SchemaInfo']: + def list(self, catalog_name: str) -> Iterator[SchemaInfo]: """List schemas. Gets an array of schemas for a catalog in the metastore. If the caller is the metastore admin or the @@ -5167,7 +6327,7 @@ def get(self, name: str) -> StorageCredentialInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/storage-credentials/{name}', headers=headers) return StorageCredentialInfo.from_dict(res) - def list(self) -> Iterator['StorageCredentialInfo']: + def list(self) -> Iterator[StorageCredentialInfo]: """List credentials. Gets an array of storage credentials (as __StorageCredentialInfo__ objects). The array is limited to @@ -5348,7 +6508,7 @@ def enable(self, metastore_id: str, schema_name: EnableSchemaName): f'/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas/{schema_name.value}', headers=headers) - def list(self, metastore_id: str) -> Iterator['SystemSchemaInfo']: + def list(self, metastore_id: str) -> Iterator[SystemSchemaInfo]: """List system schemas. Gets an array of system schemas for a metastore. The caller must be an account admin or a metastore @@ -5501,7 +6661,7 @@ def list(self, *, include_delta_metadata: Optional[bool] = None, max_results: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['TableInfo']: + page_token: Optional[str] = None) -> Iterator[TableInfo]: """List tables. Gets an array of all tables for the current metastore under the parent catalog and schema. The caller @@ -5552,7 +6712,7 @@ def list_summaries(self, max_results: Optional[int] = None, page_token: Optional[str] = None, schema_name_pattern: Optional[str] = None, - table_name_pattern: Optional[str] = None) -> Iterator['TableSummary']: + table_name_pattern: Optional[str] = None) -> Iterator[TableSummary]: """List table summaries. Gets an array of summaries for tables for a schema and catalog within the metastore. The table @@ -5698,7 +6858,7 @@ def delete(self, full_name_arg: str): headers = {} self._api.do('DELETE', f'/api/2.1/unity-catalog/volumes/{full_name_arg}', headers=headers) - def list(self, catalog_name: str, schema_name: str) -> Iterator['VolumeInfo']: + def list(self, catalog_name: str, schema_name: str) -> Iterator[VolumeInfo]: """List Volumes. Gets an array of all volumes for the current metastore under the parent catalog and schema. diff --git a/databricks/sdk/service/compute.py b/databricks/sdk/service/compute.py index 367420c51..60e92256c 100755 --- a/databricks/sdk/service/compute.py +++ b/databricks/sdk/service/compute.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging import random import time @@ -19,11 +21,32 @@ @dataclass class AddInstanceProfile: instance_profile_arn: str + """The AWS ARN of the instance profile to register with Databricks. This field is required.""" + iam_role_arn: Optional[str] = None + """The AWS IAM role ARN of the role associated with the instance profile. This field is required if + your role name and instance profile name do not match and you want to use the instance profile + with [Databricks SQL Serverless]. + + Otherwise, this field is optional. + + [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html""" + is_meta_instance_profile: Optional[bool] = None + """Boolean flag indicating whether the instance profile should only be used in credential + passthrough scenarios. If true, it means the instance profile contains an meta IAM role which + could assume a wide range of roles. Therefore it should always be used with authorization. This + field is optional, the default value is `false`.""" + skip_validation: Optional[bool] = None + """By default, Databricks validates that it has sufficient permissions to launch instances with the + instance profile. This validation uses AWS dry-run mode for the RunInstances API. If validation + fails with an error message that does not indicate an IAM related permission issue, (e.g. + “Your requested instance type is not supported in your requested availability zone”), you + can pass this flag to skip the validation and forcibly add the instance profile.""" def as_dict(self) -> dict: + """Serializes the AddInstanceProfile into a dictionary suitable for use as a JSON request body.""" body = {} if self.iam_role_arn is not None: body['iam_role_arn'] = self.iam_role_arn if self.instance_profile_arn is not None: body['instance_profile_arn'] = self.instance_profile_arn @@ -33,7 +56,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AddInstanceProfile': + def from_dict(cls, d: Dict[str, any]) -> AddInstanceProfile: + """Deserializes the AddInstanceProfile from a dictionary.""" return cls(iam_role_arn=d.get('iam_role_arn', None), instance_profile_arn=d.get('instance_profile_arn', None), is_meta_instance_profile=d.get('is_meta_instance_profile', None), @@ -43,33 +67,107 @@ def from_dict(cls, d: Dict[str, any]) -> 'AddInstanceProfile': @dataclass class AutoScale: min_workers: int + """The minimum number of workers to which the cluster can scale down when underutilized. It is also + the initial number of workers the cluster will have after creation.""" + max_workers: int + """The maximum number of workers to which the cluster can scale up when overloaded. Note that + `max_workers` must be strictly greater than `min_workers`.""" def as_dict(self) -> dict: + """Serializes the AutoScale into a dictionary suitable for use as a JSON request body.""" body = {} if self.max_workers is not None: body['max_workers'] = self.max_workers if self.min_workers is not None: body['min_workers'] = self.min_workers return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AutoScale': + def from_dict(cls, d: Dict[str, any]) -> AutoScale: + """Deserializes the AutoScale from a dictionary.""" return cls(max_workers=d.get('max_workers', None), min_workers=d.get('min_workers', None)) @dataclass class AwsAttributes: - availability: Optional['AwsAvailability'] = None + availability: Optional[AwsAvailability] = None + """Availability type used for all subsequent nodes past the `first_on_demand` ones. + + Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster.""" + ebs_volume_count: Optional[int] = None + """The number of volumes launched for each instance. Users can choose up to 10 volumes. This + feature is only enabled for supported node types. Legacy node types cannot specify custom EBS + volumes. For node types with no instance store, at least one EBS volume needs to be specified; + otherwise, cluster creation will fail. + + These EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc. Instance store volumes will be + mounted at `/local_disk0`, `/local_disk1`, and etc. + + If EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for + scratch storage because heterogenously sized scratch devices can lead to inefficient disk + utilization. If no EBS volumes are attached, Databricks will configure Spark to use instance + store volumes. + + Please note that if EBS volumes are specified, then the Spark configuration `spark.local.dir` + will be overridden.""" + ebs_volume_iops: Optional[int] = None + """""" + ebs_volume_size: Optional[int] = None + """The size of each EBS volume (in GiB) launched for each instance. For general purpose SSD, this + value must be within the range 100 - 4096. For throughput optimized HDD, this value must be + within the range 500 - 4096.""" + ebs_volume_throughput: Optional[int] = None - ebs_volume_type: Optional['EbsVolumeType'] = None + """""" + + ebs_volume_type: Optional[EbsVolumeType] = None + """The type of EBS volumes that will be launched with this cluster.""" + first_on_demand: Optional[int] = None + """The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. If this + value is greater than 0, the cluster driver node in particular will be placed on an on-demand + instance. If this value is greater than or equal to the current cluster size, all nodes will be + placed on on-demand instances. If this value is less than the current cluster size, + `first_on_demand` nodes will be placed on on-demand instances and the remainder will be placed + on `availability` instances. Note that this value does not affect cluster size and cannot + currently be mutated over the lifetime of a cluster.""" + instance_profile_arn: Optional[str] = None + """Nodes for this cluster will only be placed on AWS instances with this instance profile. If + ommitted, nodes will be placed on instances without an IAM instance profile. The instance + profile must have previously been added to the Databricks environment by an account + administrator. + + This feature may only be available to certain customer plans. + + If this field is ommitted, we will pull in the default from the conf if it exists.""" + spot_bid_price_percent: Optional[int] = None + """The bid price for AWS spot instances, as a percentage of the corresponding instance type's + on-demand price. For example, if this field is set to 50, and the cluster needs a new + `r3.xlarge` spot instance, then the bid price is half of the price of on-demand `r3.xlarge` + instances. Similarly, if this field is set to 200, the bid price is twice the price of on-demand + `r3.xlarge` instances. If not specified, the default value is 100. When spot instances are + requested for this cluster, only spot instances whose bid price percentage matches this field + will be considered. Note that, for safety, we enforce this field to be no more than 10000. + + The default value and documentation here should be kept consistent with + CommonConf.defaultSpotBidPricePercent and CommonConf.maxSpotBidPricePercent.""" + zone_id: Optional[str] = None + """Identifier for the availability zone/datacenter in which the cluster resides. This string will + be of a form like "us-west-2a". The provided availability zone must be in the same region as the + Databricks deployment. For example, "us-west-2a" is not a valid zone id if the Databricks + deployment resides in the "us-east-1" region. This is an optional field at cluster creation, and + if not specified, a default zone will be used. If the zone specified is "auto", will try to + place cluster in a zone with high availability, and will retry placement in a different AZ if + there is not enough capacity. The list of available zones as well as the default value can be + found by using the `List Zones` method.""" def as_dict(self) -> dict: + """Serializes the AwsAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.availability is not None: body['availability'] = self.availability.value if self.ebs_volume_count is not None: body['ebs_volume_count'] = self.ebs_volume_count @@ -85,7 +183,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AwsAttributes': + def from_dict(cls, d: Dict[str, any]) -> AwsAttributes: + """Deserializes the AwsAttributes from a dictionary.""" return cls(availability=_enum(d, 'availability', AwsAvailability), ebs_volume_count=d.get('ebs_volume_count', None), ebs_volume_iops=d.get('ebs_volume_iops', None), @@ -110,12 +209,31 @@ class AwsAvailability(Enum): @dataclass class AzureAttributes: - availability: Optional['AzureAvailability'] = None + availability: Optional[AzureAvailability] = None + """Availability type used for all subsequent nodes past the `first_on_demand` ones. Note: If + `first_on_demand` is zero (which only happens on pool clusters), this availability type will be + used for the entire cluster.""" + first_on_demand: Optional[int] = None - log_analytics_info: Optional['LogAnalyticsInfo'] = None + """The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. This + value should be greater than 0, to make sure the cluster driver node is placed on an on-demand + instance. If this value is greater than or equal to the current cluster size, all nodes will be + placed on on-demand instances. If this value is less than the current cluster size, + `first_on_demand` nodes will be placed on on-demand instances and the remainder will be placed + on `availability` instances. Note that this value does not affect cluster size and cannot + currently be mutated over the lifetime of a cluster.""" + + log_analytics_info: Optional[LogAnalyticsInfo] = None + """Defines values necessary to configure and run Azure Log Analytics agent""" + spot_bid_max_price: Optional[float] = None + """The max bid price to be used for Azure spot instances. The Max price for the bid cannot be + higher than the on-demand price of the instance. If not specified, the default value is -1, + which specifies that the instance cannot be evicted on the basis of price, and only on the basis + of availability. Further, the value should > 0 or -1.""" def as_dict(self) -> dict: + """Serializes the AzureAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.availability is not None: body['availability'] = self.availability.value if self.first_on_demand is not None: body['first_on_demand'] = self.first_on_demand @@ -124,7 +242,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AzureAttributes': + def from_dict(cls, d: Dict[str, any]) -> AzureAttributes: + """Deserializes the AzureAttributes from a dictionary.""" return cls(availability=_enum(d, 'availability', AzureAvailability), first_on_demand=d.get('first_on_demand', None), log_analytics_info=_from_dict(d, 'log_analytics_info', LogAnalyticsInfo), @@ -144,10 +263,13 @@ class AzureAvailability(Enum): @dataclass class CancelCommand: cluster_id: Optional[str] = None + command_id: Optional[str] = None + context_id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the CancelCommand into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['clusterId'] = self.cluster_id if self.command_id is not None: body['commandId'] = self.command_id @@ -155,7 +277,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CancelCommand': + def from_dict(cls, d: Dict[str, any]) -> CancelCommand: + """Deserializes the CancelCommand from a dictionary.""" return cls(cluster_id=d.get('clusterId', None), command_id=d.get('commandId', None), context_id=d.get('contextId', None)) @@ -164,46 +287,58 @@ def from_dict(cls, d: Dict[str, any]) -> 'CancelCommand': @dataclass class ChangeClusterOwner: cluster_id: str + """""" + owner_username: str + """New owner of the cluster_id after this RPC.""" def as_dict(self) -> dict: + """Serializes the ChangeClusterOwner into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.owner_username is not None: body['owner_username'] = self.owner_username return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ChangeClusterOwner': + def from_dict(cls, d: Dict[str, any]) -> ChangeClusterOwner: + """Deserializes the ChangeClusterOwner from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), owner_username=d.get('owner_username', None)) @dataclass class ClientsTypes: jobs: Optional[bool] = None + """With jobs set, the cluster can be used for jobs""" + notebooks: Optional[bool] = None + """With notebooks set, this cluster can be used for notebooks""" def as_dict(self) -> dict: + """Serializes the ClientsTypes into a dictionary suitable for use as a JSON request body.""" body = {} if self.jobs is not None: body['jobs'] = self.jobs if self.notebooks is not None: body['notebooks'] = self.notebooks return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClientsTypes': + def from_dict(cls, d: Dict[str, any]) -> ClientsTypes: + """Deserializes the ClientsTypes from a dictionary.""" return cls(jobs=d.get('jobs', None), notebooks=d.get('notebooks', None)) @dataclass class CloudProviderNodeInfo: - status: Optional['List[CloudProviderNodeStatus]'] = None + status: Optional[List[CloudProviderNodeStatus]] = None def as_dict(self) -> dict: + """Serializes the CloudProviderNodeInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.status: body['status'] = [v.value for v in self.status] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CloudProviderNodeInfo': + def from_dict(cls, d: Dict[str, any]) -> CloudProviderNodeInfo: + """Deserializes the CloudProviderNodeInfo from a dictionary.""" return cls(status=_repeated_enum(d, 'status', CloudProviderNodeStatus)) @@ -216,11 +351,20 @@ class CloudProviderNodeStatus(Enum): @dataclass class ClusterAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['ClusterPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[ClusterPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ClusterAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -230,7 +374,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> ClusterAccessControlRequest: + """Deserializes the ClusterAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', ClusterPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -239,13 +384,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterAccessControlRequest': @dataclass class ClusterAccessControlResponse: - all_permissions: Optional['List[ClusterPermission]'] = None + all_permissions: Optional[List[ClusterPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ClusterAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -256,7 +411,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> ClusterAccessControlResponse: + """Deserializes the ClusterAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', ClusterPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -267,32 +423,135 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterAccessControlResponse': @dataclass class ClusterAttributes: spark_version: str + """The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can + be retrieved by using the :method:clusters/sparkVersions API call.""" + autotermination_minutes: Optional[int] = None - aws_attributes: Optional['AwsAttributes'] = None - azure_attributes: Optional['AzureAttributes'] = None - cluster_log_conf: Optional['ClusterLogConf'] = None + """Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. Users can also set this value to 0 to explicitly disable automatic + termination.""" + + aws_attributes: Optional[AwsAttributes] = None + """Attributes related to clusters running on Amazon Web Services. If not specified at cluster + creation, a set of default values will be used.""" + + azure_attributes: Optional[AzureAttributes] = None + """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, + a set of default values will be used.""" + + cluster_log_conf: Optional[ClusterLogConf] = None + """The configuration for delivering spark logs to a long-term storage destination. Two kinds of + destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. + If the conf is given, the logs will be delivered to the destination every `5 mins`. The + destination of driver logs is `$destination/$clusterId/driver`, while the destination of + executor logs is `$destination/$clusterId/executor`.""" + cluster_name: Optional[str] = None - cluster_source: Optional['ClusterSource'] = None - custom_tags: Optional['Dict[str,str]'] = None - data_security_mode: Optional['DataSecurityMode'] = None - docker_image: Optional['DockerImage'] = None + """Cluster name requested by the user. This doesn't have to be unique. If not specified at + creation, the cluster name will be an empty string.""" + + cluster_source: Optional[ClusterSource] = None + """Determines whether the cluster was created by a user through the UI, created by the Databricks + Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster + tags""" + + data_security_mode: Optional[DataSecurityMode] = None + """Data security mode decides what data governance model to use when accessing data from a cluster. + + * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features + are not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively + used by a single user specified in `single_user_name`. Most programming languages, cluster + features and data governance features are available in this mode. * `USER_ISOLATION`: A secure + cluster that can be shared by multiple users. Cluster users are fully isolated so that they + cannot see each other's data and credentials. Most data governance features are supported in + this mode. But programming languages and cluster features might be limited. * + `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. * + `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high + concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy + Passthrough on standard clusters.""" + + docker_image: Optional[DockerImage] = None + driver_instance_pool_id: Optional[str] = None + """The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster + uses the instance pool with id (instance_pool_id) if the driver pool is not assigned.""" + driver_node_type_id: Optional[str] = None + """The node type of the Spark driver. Note that this field is optional; if unset, the driver node + type will be set as the same value as `node_type_id` defined above.""" + enable_elastic_disk: Optional[bool] = None + """Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. This feature requires specific AWS + permissions to function correctly - refer to the User Guide for more details.""" + enable_local_disk_encryption: Optional[bool] = None - gcp_attributes: Optional['GcpAttributes'] = None - init_scripts: Optional['List[InitScriptInfo]'] = None + """Whether to enable LUKS on cluster VMs' local disks""" + + gcp_attributes: Optional[GcpAttributes] = None + """Attributes related to clusters running on Google Cloud Platform. If not specified at cluster + creation, a set of default values will be used.""" + + init_scripts: Optional[List[InitScriptInfo]] = None + """The configuration for storing init scripts. Any number of destinations can be specified. The + scripts are executed sequentially in the order provided. If `cluster_log_conf` is specified, + init script logs are sent to `//init_scripts`.""" + instance_pool_id: Optional[str] = None + """The optional ID of the instance pool to which the cluster belongs.""" + node_type_id: Optional[str] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + policy_id: Optional[str] = None - runtime_engine: Optional['RuntimeEngine'] = None + """The ID of the cluster policy used to create the cluster if applicable.""" + + runtime_engine: Optional[RuntimeEngine] = None + """Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime + engine is inferred from spark_version.""" + single_user_name: Optional[str] = None - spark_conf: Optional['Dict[str,str]'] = None - spark_env_vars: Optional['Dict[str,str]'] = None - ssh_public_keys: Optional['List[str]'] = None - workload_type: Optional['WorkloadType'] = None + """Single user name if data_security_mode is `SINGLE_USER`""" + + spark_conf: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively.""" + + spark_env_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) + while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them + to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default + databricks managed environmental variables are included as well. + + Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": + "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS + -Dspark.shuffle.service.enabled=true"}`""" + + ssh_public_keys: Optional[List[str]] = None + """SSH public key contents that will be added to each Spark node in this cluster. The corresponding + private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can + be specified.""" + + workload_type: Optional[WorkloadType] = None def as_dict(self) -> dict: + """Serializes the ClusterAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.autotermination_minutes is not None: body['autotermination_minutes'] = self.autotermination_minutes @@ -325,7 +584,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterAttributes': + def from_dict(cls, d: Dict[str, any]) -> ClusterAttributes: + """Deserializes the ClusterAttributes from a dictionary.""" return cls(autotermination_minutes=d.get('autotermination_minutes', None), aws_attributes=_from_dict(d, 'aws_attributes', AwsAttributes), azure_attributes=_from_dict(d, 'azure_attributes', AzureAttributes), @@ -355,53 +615,227 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterAttributes': @dataclass class ClusterDetails: - autoscale: Optional['AutoScale'] = None + autoscale: Optional[AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + autotermination_minutes: Optional[int] = None - aws_attributes: Optional['AwsAttributes'] = None - azure_attributes: Optional['AzureAttributes'] = None + """Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. Users can also set this value to 0 to explicitly disable automatic + termination.""" + + aws_attributes: Optional[AwsAttributes] = None + """Attributes related to clusters running on Amazon Web Services. If not specified at cluster + creation, a set of default values will be used.""" + + azure_attributes: Optional[AzureAttributes] = None + """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, + a set of default values will be used.""" + cluster_cores: Optional[float] = None + """Number of CPU cores available for this cluster. Note that this can be fractional, e.g. 7.5 + cores, since certain node types are configured to share cores between Spark nodes on the same + instance.""" + cluster_id: Optional[str] = None - cluster_log_conf: Optional['ClusterLogConf'] = None - cluster_log_status: Optional['LogSyncStatus'] = None + """Canonical identifier for the cluster. This id is retained during cluster restarts and resizes, + while each new cluster has a globally unique id.""" + + cluster_log_conf: Optional[ClusterLogConf] = None + """The configuration for delivering spark logs to a long-term storage destination. Two kinds of + destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. + If the conf is given, the logs will be delivered to the destination every `5 mins`. The + destination of driver logs is `$destination/$clusterId/driver`, while the destination of + executor logs is `$destination/$clusterId/executor`.""" + + cluster_log_status: Optional[LogSyncStatus] = None + """Cluster log delivery status.""" + cluster_memory_mb: Optional[int] = None + """Total amount of cluster memory, in megabytes""" + cluster_name: Optional[str] = None - cluster_source: Optional['ClusterSource'] = None + """Cluster name requested by the user. This doesn't have to be unique. If not specified at + creation, the cluster name will be an empty string.""" + + cluster_source: Optional[ClusterSource] = None + """Determines whether the cluster was created by a user through the UI, created by the Databricks + Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only.""" + creator_user_name: Optional[str] = None - custom_tags: Optional['Dict[str,str]'] = None - data_security_mode: Optional['DataSecurityMode'] = None - default_tags: Optional['Dict[str,str]'] = None - docker_image: Optional['DockerImage'] = None - driver: Optional['SparkNode'] = None + """Creator user name. The field won't be included in the response if the user has already been + deleted.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster + tags""" + + data_security_mode: Optional[DataSecurityMode] = None + """Data security mode decides what data governance model to use when accessing data from a cluster. + + * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features + are not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively + used by a single user specified in `single_user_name`. Most programming languages, cluster + features and data governance features are available in this mode. * `USER_ISOLATION`: A secure + cluster that can be shared by multiple users. Cluster users are fully isolated so that they + cannot see each other's data and credentials. Most data governance features are supported in + this mode. But programming languages and cluster features might be limited. * + `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. * + `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high + concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy + Passthrough on standard clusters.""" + + default_tags: Optional[Dict[str, str]] = None + """Tags that are added by Databricks regardless of any `custom_tags`, including: + + - Vendor: Databricks + + - Creator: + + - ClusterName: + + - ClusterId: + + - Name: """ + + docker_image: Optional[DockerImage] = None + + driver: Optional[SparkNode] = None + """Node on which the Spark driver resides. The driver node contains the Spark master and the + application that manages the per-notebook Spark REPLs.""" + driver_instance_pool_id: Optional[str] = None + """The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster + uses the instance pool with id (instance_pool_id) if the driver pool is not assigned.""" + driver_node_type_id: Optional[str] = None + """The node type of the Spark driver. Note that this field is optional; if unset, the driver node + type will be set as the same value as `node_type_id` defined above.""" + enable_elastic_disk: Optional[bool] = None + """Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. This feature requires specific AWS + permissions to function correctly - refer to the User Guide for more details.""" + enable_local_disk_encryption: Optional[bool] = None - executors: Optional['List[SparkNode]'] = None - gcp_attributes: Optional['GcpAttributes'] = None - init_scripts: Optional['List[InitScriptInfo]'] = None + """Whether to enable LUKS on cluster VMs' local disks""" + + executors: Optional[List[SparkNode]] = None + """Nodes on which the Spark executors reside.""" + + gcp_attributes: Optional[GcpAttributes] = None + """Attributes related to clusters running on Google Cloud Platform. If not specified at cluster + creation, a set of default values will be used.""" + + init_scripts: Optional[List[InitScriptInfo]] = None + """The configuration for storing init scripts. Any number of destinations can be specified. The + scripts are executed sequentially in the order provided. If `cluster_log_conf` is specified, + init script logs are sent to `//init_scripts`.""" + instance_pool_id: Optional[str] = None + """The optional ID of the instance pool to which the cluster belongs.""" + jdbc_port: Optional[int] = None + """Port on which Spark JDBC server is listening, in the driver nod. No service will be listeningon + on this port in executor nodes.""" + last_restarted_time: Optional[int] = None + """the timestamp that the cluster was started/restarted""" + last_state_loss_time: Optional[int] = None + """Time when the cluster driver last lost its state (due to a restart or driver failure).""" + node_type_id: Optional[str] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" + policy_id: Optional[str] = None - runtime_engine: Optional['RuntimeEngine'] = None + """The ID of the cluster policy used to create the cluster if applicable.""" + + runtime_engine: Optional[RuntimeEngine] = None + """Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime + engine is inferred from spark_version.""" + single_user_name: Optional[str] = None - spark_conf: Optional['Dict[str,str]'] = None + """Single user name if data_security_mode is `SINGLE_USER`""" + + spark_conf: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively.""" + spark_context_id: Optional[int] = None - spark_env_vars: Optional['Dict[str,str]'] = None + """A canonical SparkContext identifier. This value *does* change when the Spark driver restarts. + The pair `(cluster_id, spark_context_id)` is a globally unique identifier over all Spark + contexts.""" + + spark_env_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) + while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them + to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default + databricks managed environmental variables are included as well. + + Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": + "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS + -Dspark.shuffle.service.enabled=true"}`""" + spark_version: Optional[str] = None - spec: Optional['CreateCluster'] = None - ssh_public_keys: Optional['List[str]'] = None + """The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can + be retrieved by using the :method:clusters/sparkVersions API call.""" + + spec: Optional[CreateCluster] = None + """`spec` contains a snapshot of the field values that were used to create or edit this cluster. + The contents of `spec` can be used in the body of a create cluster request. This field might not + be populated for older clusters. Note: not included in the response of the ListClusters API.""" + + ssh_public_keys: Optional[List[str]] = None + """SSH public key contents that will be added to each Spark node in this cluster. The corresponding + private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can + be specified.""" + start_time: Optional[int] = None - state: Optional['State'] = None + """Time (in epoch milliseconds) when the cluster creation request was received (when the cluster + entered a `PENDING` state).""" + + state: Optional[State] = None + """Current state of the cluster.""" + state_message: Optional[str] = None + """A message associated with the most recent state transition (e.g., the reason why the cluster + entered a `TERMINATED` state).""" + terminated_time: Optional[int] = None - termination_reason: Optional['TerminationReason'] = None - workload_type: Optional['WorkloadType'] = None + """Time (in epoch milliseconds) when the cluster was terminated, if applicable.""" + + termination_reason: Optional[TerminationReason] = None + """Information about why the cluster was terminated. This field only appears when the cluster is in + a `TERMINATING` or `TERMINATED` state.""" + + workload_type: Optional[WorkloadType] = None def as_dict(self) -> dict: + """Serializes the ClusterDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.autoscale: body['autoscale'] = self.autoscale.as_dict() if self.autotermination_minutes is not None: @@ -454,7 +888,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterDetails': + def from_dict(cls, d: Dict[str, any]) -> ClusterDetails: + """Deserializes the ClusterDetails from a dictionary.""" return cls(autoscale=_from_dict(d, 'autoscale', AutoScale), autotermination_minutes=d.get('autotermination_minutes', None), aws_attributes=_from_dict(d, 'aws_attributes', AwsAttributes), @@ -505,12 +940,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterDetails': @dataclass class ClusterEvent: cluster_id: str - data_plane_event_details: Optional['DataPlaneEventDetails'] = None - details: Optional['EventDetails'] = None + """""" + + data_plane_event_details: Optional[DataPlaneEventDetails] = None + """""" + + details: Optional[EventDetails] = None + """""" + timestamp: Optional[int] = None - type: Optional['EventType'] = None + """The timestamp when the event occurred, stored as the number of milliseconds since the Unix + epoch. If not provided, this will be assigned by the Timeline service.""" + + type: Optional[EventType] = None def as_dict(self) -> dict: + """Serializes the ClusterEvent into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.data_plane_event_details: @@ -521,7 +966,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterEvent': + def from_dict(cls, d: Dict[str, any]) -> ClusterEvent: + """Deserializes the ClusterEvent from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), data_plane_event_details=_from_dict(d, 'data_plane_event_details', DataPlaneEventDetails), details=_from_dict(d, 'details', EventDetails), @@ -532,43 +978,61 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterEvent': @dataclass class ClusterLibraryStatuses: cluster_id: Optional[str] = None - library_statuses: Optional['List[LibraryFullStatus]'] = None + """Unique identifier for the cluster.""" + + library_statuses: Optional[List[LibraryFullStatus]] = None + """Status of all libraries on the cluster.""" def as_dict(self) -> dict: + """Serializes the ClusterLibraryStatuses into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.library_statuses: body['library_statuses'] = [v.as_dict() for v in self.library_statuses] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterLibraryStatuses': + def from_dict(cls, d: Dict[str, any]) -> ClusterLibraryStatuses: + """Deserializes the ClusterLibraryStatuses from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), library_statuses=_repeated_dict(d, 'library_statuses', LibraryFullStatus)) @dataclass class ClusterLogConf: - dbfs: Optional['DbfsStorageInfo'] = None - s3: Optional['S3StorageInfo'] = None + dbfs: Optional[DbfsStorageInfo] = None + """destination needs to be provided. e.g. `{ "dbfs" : { "destination" : "dbfs:/home/cluster_log" } + }`""" + + s3: Optional[S3StorageInfo] = None + """destination and either the region or endpoint need to be provided. e.g. `{ "s3": { "destination" + : "s3://cluster_log_bucket/prefix", "region" : "us-west-2" } }` Cluster iam role is used to + access s3, please make sure the cluster iam role in `instance_profile_arn` has permission to + write data to the s3 destination.""" def as_dict(self) -> dict: + """Serializes the ClusterLogConf into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbfs: body['dbfs'] = self.dbfs.as_dict() if self.s3: body['s3'] = self.s3.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterLogConf': + def from_dict(cls, d: Dict[str, any]) -> ClusterLogConf: + """Deserializes the ClusterLogConf from a dictionary.""" return cls(dbfs=_from_dict(d, 'dbfs', DbfsStorageInfo), s3=_from_dict(d, 's3', S3StorageInfo)) @dataclass class ClusterPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['ClusterPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[ClusterPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ClusterPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -576,7 +1040,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPermission': + def from_dict(cls, d: Dict[str, any]) -> ClusterPermission: + """Deserializes the ClusterPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', ClusterPermissionLevel)) @@ -592,11 +1057,14 @@ class ClusterPermissionLevel(Enum): @dataclass class ClusterPermissions: - access_control_list: Optional['List[ClusterAccessControlResponse]'] = None + access_control_list: Optional[List[ClusterAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ClusterPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -605,7 +1073,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPermissions': + def from_dict(cls, d: Dict[str, any]) -> ClusterPermissions: + """Deserializes the ClusterPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ClusterAccessControlResponse), object_id=d.get('object_id', None), object_type=d.get('object_type', None)) @@ -614,26 +1083,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterPermissions': @dataclass class ClusterPermissionsDescription: description: Optional[str] = None - permission_level: Optional['ClusterPermissionLevel'] = None + + permission_level: Optional[ClusterPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ClusterPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> ClusterPermissionsDescription: + """Deserializes the ClusterPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', ClusterPermissionLevel)) @dataclass class ClusterPermissionsRequest: - access_control_list: Optional['List[ClusterAccessControlRequest]'] = None + access_control_list: Optional[List[ClusterAccessControlRequest]] = None + cluster_id: Optional[str] = None + """The cluster for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the ClusterPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -641,7 +1117,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> ClusterPermissionsRequest: + """Deserializes the ClusterPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ClusterAccessControlRequest), cluster_id=d.get('cluster_id', None)) @@ -649,11 +1126,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterPermissionsRequest': @dataclass class ClusterPolicyAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['ClusterPolicyPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[ClusterPolicyPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ClusterPolicyAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -663,7 +1149,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> ClusterPolicyAccessControlRequest: + """Deserializes the ClusterPolicyAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', ClusterPolicyPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -672,13 +1159,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyAccessControlRequest': @dataclass class ClusterPolicyAccessControlResponse: - all_permissions: Optional['List[ClusterPolicyPermission]'] = None + all_permissions: Optional[List[ClusterPolicyPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ClusterPolicyAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -689,7 +1186,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> ClusterPolicyAccessControlResponse: + """Deserializes the ClusterPolicyAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', ClusterPolicyPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -700,10 +1198,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyAccessControlResponse': @dataclass class ClusterPolicyPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['ClusterPolicyPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[ClusterPolicyPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ClusterPolicyPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -711,7 +1213,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyPermission': + def from_dict(cls, d: Dict[str, any]) -> ClusterPolicyPermission: + """Deserializes the ClusterPolicyPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', ClusterPolicyPermissionLevel)) @@ -725,11 +1228,14 @@ class ClusterPolicyPermissionLevel(Enum): @dataclass class ClusterPolicyPermissions: - access_control_list: Optional['List[ClusterPolicyAccessControlResponse]'] = None + access_control_list: Optional[List[ClusterPolicyAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ClusterPolicyPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -738,7 +1244,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyPermissions': + def from_dict(cls, d: Dict[str, any]) -> ClusterPolicyPermissions: + """Deserializes the ClusterPolicyPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ClusterPolicyAccessControlResponse), object_id=d.get('object_id', None), @@ -748,26 +1255,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyPermissions': @dataclass class ClusterPolicyPermissionsDescription: description: Optional[str] = None - permission_level: Optional['ClusterPolicyPermissionLevel'] = None + + permission_level: Optional[ClusterPolicyPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ClusterPolicyPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> ClusterPolicyPermissionsDescription: + """Deserializes the ClusterPolicyPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', ClusterPolicyPermissionLevel)) @dataclass class ClusterPolicyPermissionsRequest: - access_control_list: Optional['List[ClusterPolicyAccessControlRequest]'] = None + access_control_list: Optional[List[ClusterPolicyAccessControlRequest]] = None + cluster_policy_id: Optional[str] = None + """The cluster policy for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the ClusterPolicyPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -775,7 +1289,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> ClusterPolicyPermissionsRequest: + """Deserializes the ClusterPolicyPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ClusterPolicyAccessControlRequest), cluster_policy_id=d.get('cluster_policy_id', None)) @@ -783,17 +1298,30 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterPolicyPermissionsRequest': @dataclass class ClusterSize: - autoscale: Optional['AutoScale'] = None + autoscale: Optional[AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" def as_dict(self) -> dict: + """Serializes the ClusterSize into a dictionary suitable for use as a JSON request body.""" body = {} if self.autoscale: body['autoscale'] = self.autoscale.as_dict() if self.num_workers is not None: body['num_workers'] = self.num_workers return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterSize': + def from_dict(cls, d: Dict[str, any]) -> ClusterSize: + """Deserializes the ClusterSize from a dictionary.""" return cls(autoscale=_from_dict(d, 'autoscale', AutoScale), num_workers=d.get('num_workers', None)) @@ -813,35 +1341,151 @@ class ClusterSource(Enum): @dataclass class ClusterSpec: apply_policy_default_values: Optional[bool] = None - autoscale: Optional['AutoScale'] = None + + autoscale: Optional[AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + autotermination_minutes: Optional[int] = None - aws_attributes: Optional['AwsAttributes'] = None - azure_attributes: Optional['AzureAttributes'] = None - cluster_log_conf: Optional['ClusterLogConf'] = None + """Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. Users can also set this value to 0 to explicitly disable automatic + termination.""" + + aws_attributes: Optional[AwsAttributes] = None + """Attributes related to clusters running on Amazon Web Services. If not specified at cluster + creation, a set of default values will be used.""" + + azure_attributes: Optional[AzureAttributes] = None + """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, + a set of default values will be used.""" + + cluster_log_conf: Optional[ClusterLogConf] = None + """The configuration for delivering spark logs to a long-term storage destination. Two kinds of + destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. + If the conf is given, the logs will be delivered to the destination every `5 mins`. The + destination of driver logs is `$destination/$clusterId/driver`, while the destination of + executor logs is `$destination/$clusterId/executor`.""" + cluster_name: Optional[str] = None - cluster_source: Optional['ClusterSource'] = None - custom_tags: Optional['Dict[str,str]'] = None - data_security_mode: Optional['DataSecurityMode'] = None - docker_image: Optional['DockerImage'] = None + """Cluster name requested by the user. This doesn't have to be unique. If not specified at + creation, the cluster name will be an empty string.""" + + cluster_source: Optional[ClusterSource] = None + """Determines whether the cluster was created by a user through the UI, created by the Databricks + Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster + tags""" + + data_security_mode: Optional[DataSecurityMode] = None + """Data security mode decides what data governance model to use when accessing data from a cluster. + + * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features + are not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively + used by a single user specified in `single_user_name`. Most programming languages, cluster + features and data governance features are available in this mode. * `USER_ISOLATION`: A secure + cluster that can be shared by multiple users. Cluster users are fully isolated so that they + cannot see each other's data and credentials. Most data governance features are supported in + this mode. But programming languages and cluster features might be limited. * + `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. * + `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high + concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy + Passthrough on standard clusters.""" + + docker_image: Optional[DockerImage] = None + driver_instance_pool_id: Optional[str] = None + """The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster + uses the instance pool with id (instance_pool_id) if the driver pool is not assigned.""" + driver_node_type_id: Optional[str] = None + """The node type of the Spark driver. Note that this field is optional; if unset, the driver node + type will be set as the same value as `node_type_id` defined above.""" + enable_elastic_disk: Optional[bool] = None + """Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. This feature requires specific AWS + permissions to function correctly - refer to the User Guide for more details.""" + enable_local_disk_encryption: Optional[bool] = None - gcp_attributes: Optional['GcpAttributes'] = None - init_scripts: Optional['List[InitScriptInfo]'] = None + """Whether to enable LUKS on cluster VMs' local disks""" + + gcp_attributes: Optional[GcpAttributes] = None + """Attributes related to clusters running on Google Cloud Platform. If not specified at cluster + creation, a set of default values will be used.""" + + init_scripts: Optional[List[InitScriptInfo]] = None + """The configuration for storing init scripts. Any number of destinations can be specified. The + scripts are executed sequentially in the order provided. If `cluster_log_conf` is specified, + init script logs are sent to `//init_scripts`.""" + instance_pool_id: Optional[str] = None + """The optional ID of the instance pool to which the cluster belongs.""" + node_type_id: Optional[str] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" + policy_id: Optional[str] = None - runtime_engine: Optional['RuntimeEngine'] = None + """The ID of the cluster policy used to create the cluster if applicable.""" + + runtime_engine: Optional[RuntimeEngine] = None + """Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime + engine is inferred from spark_version.""" + single_user_name: Optional[str] = None - spark_conf: Optional['Dict[str,str]'] = None - spark_env_vars: Optional['Dict[str,str]'] = None + """Single user name if data_security_mode is `SINGLE_USER`""" + + spark_conf: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively.""" + + spark_env_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) + while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them + to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default + databricks managed environmental variables are included as well. + + Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": + "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS + -Dspark.shuffle.service.enabled=true"}`""" + spark_version: Optional[str] = None - ssh_public_keys: Optional['List[str]'] = None - workload_type: Optional['WorkloadType'] = None + """The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can + be retrieved by using the :method:clusters/sparkVersions API call.""" + + ssh_public_keys: Optional[List[str]] = None + """SSH public key contents that will be added to each Spark node in this cluster. The corresponding + private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can + be specified.""" + + workload_type: Optional[WorkloadType] = None def as_dict(self) -> dict: + """Serializes the ClusterSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.apply_policy_default_values is not None: body['apply_policy_default_values'] = self.apply_policy_default_values @@ -878,7 +1522,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterSpec': + def from_dict(cls, d: Dict[str, any]) -> ClusterSpec: + """Deserializes the ClusterSpec from a dictionary.""" return cls(apply_policy_default_values=d.get('apply_policy_default_values', None), autoscale=_from_dict(d, 'autoscale', AutoScale), autotermination_minutes=d.get('autotermination_minutes', None), @@ -912,11 +1557,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterSpec': @dataclass class Command: cluster_id: Optional[str] = None + """Running cluster id""" + command: Optional[str] = None + """Executable code""" + context_id: Optional[str] = None - language: Optional['Language'] = None + """Running context id""" + + language: Optional[Language] = None def as_dict(self) -> dict: + """Serializes the Command into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['clusterId'] = self.cluster_id if self.command is not None: body['command'] = self.command @@ -925,7 +1577,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Command': + def from_dict(cls, d: Dict[str, any]) -> Command: + """Deserializes the Command from a dictionary.""" return cls(cluster_id=d.get('clusterId', None), command=d.get('command', None), context_id=d.get('contextId', None), @@ -945,10 +1598,13 @@ class CommandStatus(Enum): @dataclass class CommandStatusResponse: id: Optional[str] = None - results: Optional['Results'] = None - status: Optional['CommandStatus'] = None + + results: Optional[Results] = None + + status: Optional[CommandStatus] = None def as_dict(self) -> dict: + """Serializes the CommandStatusResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id if self.results: body['results'] = self.results.as_dict() @@ -956,7 +1612,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CommandStatusResponse': + def from_dict(cls, d: Dict[str, any]) -> CommandStatusResponse: + """Deserializes the CommandStatusResponse from a dictionary.""" return cls(id=d.get('id', None), results=_from_dict(d, 'results', Results), status=_enum(d, 'status', CommandStatus)) @@ -964,15 +1621,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'CommandStatusResponse': @dataclass class ComputeSpec: - kind: Optional['ComputeSpecKind'] = None + kind: Optional[ComputeSpecKind] = None + """The kind of compute described by this compute specification.""" def as_dict(self) -> dict: + """Serializes the ComputeSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.kind is not None: body['kind'] = self.kind.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ComputeSpec': + def from_dict(cls, d: Dict[str, any]) -> ComputeSpec: + """Deserializes the ComputeSpec from a dictionary.""" return cls(kind=_enum(d, 'kind', ComputeSpecKind)) @@ -992,51 +1652,170 @@ class ContextStatus(Enum): @dataclass class ContextStatusResponse: id: Optional[str] = None - status: Optional['ContextStatus'] = None + + status: Optional[ContextStatus] = None def as_dict(self) -> dict: + """Serializes the ContextStatusResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id if self.status is not None: body['status'] = self.status.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ContextStatusResponse': + def from_dict(cls, d: Dict[str, any]) -> ContextStatusResponse: + """Deserializes the ContextStatusResponse from a dictionary.""" return cls(id=d.get('id', None), status=_enum(d, 'status', ContextStatus)) @dataclass class CreateCluster: spark_version: str + """The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can + be retrieved by using the :method:clusters/sparkVersions API call.""" + apply_policy_default_values: Optional[bool] = None - autoscale: Optional['AutoScale'] = None + + autoscale: Optional[AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + autotermination_minutes: Optional[int] = None - aws_attributes: Optional['AwsAttributes'] = None - azure_attributes: Optional['AzureAttributes'] = None - cluster_log_conf: Optional['ClusterLogConf'] = None + """Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. Users can also set this value to 0 to explicitly disable automatic + termination.""" + + aws_attributes: Optional[AwsAttributes] = None + """Attributes related to clusters running on Amazon Web Services. If not specified at cluster + creation, a set of default values will be used.""" + + azure_attributes: Optional[AzureAttributes] = None + """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, + a set of default values will be used.""" + + cluster_log_conf: Optional[ClusterLogConf] = None + """The configuration for delivering spark logs to a long-term storage destination. Two kinds of + destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. + If the conf is given, the logs will be delivered to the destination every `5 mins`. The + destination of driver logs is `$destination/$clusterId/driver`, while the destination of + executor logs is `$destination/$clusterId/executor`.""" + cluster_name: Optional[str] = None - cluster_source: Optional['ClusterSource'] = None - custom_tags: Optional['Dict[str,str]'] = None - data_security_mode: Optional['DataSecurityMode'] = None - docker_image: Optional['DockerImage'] = None + """Cluster name requested by the user. This doesn't have to be unique. If not specified at + creation, the cluster name will be an empty string.""" + + cluster_source: Optional[ClusterSource] = None + """Determines whether the cluster was created by a user through the UI, created by the Databricks + Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster + tags""" + + data_security_mode: Optional[DataSecurityMode] = None + """Data security mode decides what data governance model to use when accessing data from a cluster. + + * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features + are not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively + used by a single user specified in `single_user_name`. Most programming languages, cluster + features and data governance features are available in this mode. * `USER_ISOLATION`: A secure + cluster that can be shared by multiple users. Cluster users are fully isolated so that they + cannot see each other's data and credentials. Most data governance features are supported in + this mode. But programming languages and cluster features might be limited. * + `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. * + `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high + concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy + Passthrough on standard clusters.""" + + docker_image: Optional[DockerImage] = None + driver_instance_pool_id: Optional[str] = None + """The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster + uses the instance pool with id (instance_pool_id) if the driver pool is not assigned.""" + driver_node_type_id: Optional[str] = None + """The node type of the Spark driver. Note that this field is optional; if unset, the driver node + type will be set as the same value as `node_type_id` defined above.""" + enable_elastic_disk: Optional[bool] = None + """Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. This feature requires specific AWS + permissions to function correctly - refer to the User Guide for more details.""" + enable_local_disk_encryption: Optional[bool] = None - gcp_attributes: Optional['GcpAttributes'] = None - init_scripts: Optional['List[InitScriptInfo]'] = None + """Whether to enable LUKS on cluster VMs' local disks""" + + gcp_attributes: Optional[GcpAttributes] = None + """Attributes related to clusters running on Google Cloud Platform. If not specified at cluster + creation, a set of default values will be used.""" + + init_scripts: Optional[List[InitScriptInfo]] = None + """The configuration for storing init scripts. Any number of destinations can be specified. The + scripts are executed sequentially in the order provided. If `cluster_log_conf` is specified, + init script logs are sent to `//init_scripts`.""" + instance_pool_id: Optional[str] = None + """The optional ID of the instance pool to which the cluster belongs.""" + node_type_id: Optional[str] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" + policy_id: Optional[str] = None - runtime_engine: Optional['RuntimeEngine'] = None + """The ID of the cluster policy used to create the cluster if applicable.""" + + runtime_engine: Optional[RuntimeEngine] = None + """Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime + engine is inferred from spark_version.""" + single_user_name: Optional[str] = None - spark_conf: Optional['Dict[str,str]'] = None - spark_env_vars: Optional['Dict[str,str]'] = None - ssh_public_keys: Optional['List[str]'] = None - workload_type: Optional['WorkloadType'] = None + """Single user name if data_security_mode is `SINGLE_USER`""" + + spark_conf: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively.""" + + spark_env_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) + while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them + to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default + databricks managed environmental variables are included as well. + + Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": + "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS + -Dspark.shuffle.service.enabled=true"}`""" + + ssh_public_keys: Optional[List[str]] = None + """SSH public key contents that will be added to each Spark node in this cluster. The corresponding + private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can + be specified.""" + + workload_type: Optional[WorkloadType] = None def as_dict(self) -> dict: + """Serializes the CreateCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.apply_policy_default_values is not None: body['apply_policy_default_values'] = self.apply_policy_default_values @@ -1073,7 +1852,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCluster': + def from_dict(cls, d: Dict[str, any]) -> CreateCluster: + """Deserializes the CreateCluster from a dictionary.""" return cls(apply_policy_default_values=d.get('apply_policy_default_values', None), autoscale=_from_dict(d, 'autoscale', AutoScale), autotermination_minutes=d.get('autotermination_minutes', None), @@ -1109,48 +1889,101 @@ class CreateClusterResponse: cluster_id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the CreateClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateClusterResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateClusterResponse: + """Deserializes the CreateClusterResponse from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None)) @dataclass class CreateContext: cluster_id: Optional[str] = None - language: Optional['Language'] = None + """Running cluster id""" + + language: Optional[Language] = None def as_dict(self) -> dict: + """Serializes the CreateContext into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['clusterId'] = self.cluster_id if self.language is not None: body['language'] = self.language.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateContext': + def from_dict(cls, d: Dict[str, any]) -> CreateContext: + """Deserializes the CreateContext from a dictionary.""" return cls(cluster_id=d.get('clusterId', None), language=_enum(d, 'language', Language)) @dataclass class CreateInstancePool: instance_pool_name: str + """Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 + characters.""" + node_type_id: str - aws_attributes: Optional['InstancePoolAwsAttributes'] = None - azure_attributes: Optional['InstancePoolAzureAttributes'] = None - custom_tags: Optional['Dict[str,str]'] = None - disk_spec: Optional['DiskSpec'] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + + aws_attributes: Optional[InstancePoolAwsAttributes] = None + """Attributes related to instance pools running on Amazon Web Services. If not specified at pool + creation, a set of default values will be used.""" + + azure_attributes: Optional[InstancePoolAzureAttributes] = None + """Attributes related to instance pools running on Azure. If not specified at pool creation, a set + of default values will be used.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS instances + and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags""" + + disk_spec: Optional[DiskSpec] = None + """Defines the specification of the disks that will be attached to all spark containers.""" + enable_elastic_disk: Optional[bool] = None - gcp_attributes: Optional['InstancePoolGcpAttributes'] = None + """Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire + additional disk space when its Spark workers are running low on disk space. In AWS, this feature + requires specific AWS permissions to function correctly - refer to the User Guide for more + details.""" + + gcp_attributes: Optional[InstancePoolGcpAttributes] = None + """Attributes related to instance pools running on Google Cloud Platform. If not specified at pool + creation, a set of default values will be used.""" + idle_instance_autotermination_minutes: Optional[int] = None + """Automatically terminates the extra instances in the pool cache after they are inactive for this + time in minutes if min_idle_instances requirement is already met. If not set, the extra pool + instances will be automatically terminated after a default timeout. If specified, the threshold + must be between 0 and 10000 minutes. Users can also set this value to 0 to instantly remove idle + instances from the cache if min cache size could still hold.""" + max_capacity: Optional[int] = None + """Maximum number of outstanding instances to keep in the pool, including both instances used by + clusters and idle instances. Clusters that require further instance provisioning will fail + during upsize requests.""" + min_idle_instances: Optional[int] = None - preloaded_docker_images: Optional['List[DockerImage]'] = None - preloaded_spark_versions: Optional['List[str]'] = None + """Minimum number of idle instances to keep in the instance pool""" + + preloaded_docker_images: Optional[List[DockerImage]] = None + """Custom Docker Image BYOC""" + + preloaded_spark_versions: Optional[List[str]] = None + """A list containing at most one preloaded Spark image version for the pool. Pool-backed clusters + started with the preloaded Spark version will start faster. A list of available Spark versions + can be retrieved by using the :method:clusters/sparkVersions API call.""" def as_dict(self) -> dict: + """Serializes the CreateInstancePool into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_attributes: body['aws_attributes'] = self.aws_attributes.as_dict() if self.azure_attributes: body['azure_attributes'] = self.azure_attributes.as_dict() @@ -1171,7 +2004,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateInstancePool': + def from_dict(cls, d: Dict[str, any]) -> CreateInstancePool: + """Deserializes the CreateInstancePool from a dictionary.""" return cls(aws_attributes=_from_dict(d, 'aws_attributes', InstancePoolAwsAttributes), azure_attributes=_from_dict(d, 'azure_attributes', InstancePoolAzureAttributes), custom_tags=d.get('custom_tags', None), @@ -1190,28 +2024,59 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateInstancePool': @dataclass class CreateInstancePoolResponse: instance_pool_id: Optional[str] = None + """The ID of the created instance pool.""" def as_dict(self) -> dict: + """Serializes the CreateInstancePoolResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_pool_id is not None: body['instance_pool_id'] = self.instance_pool_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateInstancePoolResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateInstancePoolResponse: + """Deserializes the CreateInstancePoolResponse from a dictionary.""" return cls(instance_pool_id=d.get('instance_pool_id', None)) @dataclass class CreatePolicy: name: str + """Cluster Policy name requested by the user. This has to be unique. Length must be between 1 and + 100 characters.""" + definition: Optional[str] = None + """Policy definition document expressed in [Databricks Cluster Policy Definition Language]. + + [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" + description: Optional[str] = None - libraries: Optional['List[Library]'] = None + """Additional human-readable description of the cluster policy.""" + + libraries: Optional[List[Library]] = None + """A list of libraries to be installed on the next cluster restart that uses this policy.""" + max_clusters_per_user: Optional[int] = None + """Max number of clusters per user that can be active using this policy. If not present, there is + no max limit.""" + policy_family_definition_overrides: Optional[str] = None + """Policy definition JSON document expressed in [Databricks Policy Definition Language]. The JSON + document must be passed as a string and cannot be embedded in the requests. + + You can use this to customize the policy definition inherited from the policy family. Policy + rules specified here are merged into the inherited policy definition. + + [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" + policy_family_id: Optional[str] = None + """ID of the policy family. The cluster policy's policy definition inherits the policy family's + policy definition. + + Cannot be used with `definition`. Use `policy_family_definition_overrides` instead to customize + the policy definition.""" def as_dict(self) -> dict: + """Serializes the CreatePolicy into a dictionary suitable for use as a JSON request body.""" body = {} if self.definition is not None: body['definition'] = self.definition if self.description is not None: body['description'] = self.description @@ -1224,7 +2089,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePolicy': + def from_dict(cls, d: Dict[str, any]) -> CreatePolicy: + """Deserializes the CreatePolicy from a dictionary.""" return cls(definition=d.get('definition', None), description=d.get('description', None), libraries=_repeated_dict(d, 'libraries', Library), @@ -1237,28 +2103,34 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreatePolicy': @dataclass class CreatePolicyResponse: policy_id: Optional[str] = None + """Canonical unique identifier for the cluster policy.""" def as_dict(self) -> dict: + """Serializes the CreatePolicyResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.policy_id is not None: body['policy_id'] = self.policy_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePolicyResponse': + def from_dict(cls, d: Dict[str, any]) -> CreatePolicyResponse: + """Deserializes the CreatePolicyResponse from a dictionary.""" return cls(policy_id=d.get('policy_id', None)) @dataclass class CreateResponse: script_id: Optional[str] = None + """The global init script ID.""" def as_dict(self) -> dict: + """Serializes the CreateResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.script_id is not None: body['script_id'] = self.script_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateResponse: + """Deserializes the CreateResponse from a dictionary.""" return cls(script_id=d.get('script_id', None)) @@ -1267,23 +2139,33 @@ class Created: id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the Created into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Created': + def from_dict(cls, d: Dict[str, any]) -> Created: + """Deserializes the Created from a dictionary.""" return cls(id=d.get('id', None)) @dataclass class DataPlaneEventDetails: - event_type: Optional['DataPlaneEventDetailsEventType'] = None + event_type: Optional[DataPlaneEventDetailsEventType] = None + """""" + executor_failures: Optional[int] = None + """""" + host_id: Optional[str] = None + """""" + timestamp: Optional[int] = None + """""" def as_dict(self) -> dict: + """Serializes the DataPlaneEventDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.event_type is not None: body['event_type'] = self.event_type.value if self.executor_failures is not None: body['executor_failures'] = self.executor_failures @@ -1292,7 +2174,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DataPlaneEventDetails': + def from_dict(cls, d: Dict[str, any]) -> DataPlaneEventDetails: + """Deserializes the DataPlaneEventDetails from a dictionary.""" return cls(event_type=_enum(d, 'event_type', DataPlaneEventDetailsEventType), executor_failures=d.get('executor_failures', None), host_id=d.get('host_id', None), @@ -1332,84 +2215,124 @@ class DataSecurityMode(Enum): @dataclass class DbfsStorageInfo: destination: Optional[str] = None + """dbfs destination, e.g. `dbfs:/my/path`""" def as_dict(self) -> dict: + """Serializes the DbfsStorageInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.destination is not None: body['destination'] = self.destination return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DbfsStorageInfo': + def from_dict(cls, d: Dict[str, any]) -> DbfsStorageInfo: + """Deserializes the DbfsStorageInfo from a dictionary.""" return cls(destination=d.get('destination', None)) @dataclass class DeleteCluster: cluster_id: str + """The cluster to be terminated.""" def as_dict(self) -> dict: + """Serializes the DeleteCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteCluster': + def from_dict(cls, d: Dict[str, any]) -> DeleteCluster: + """Deserializes the DeleteCluster from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None)) @dataclass class DeleteInstancePool: instance_pool_id: str + """The instance pool to be terminated.""" def as_dict(self) -> dict: + """Serializes the DeleteInstancePool into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_pool_id is not None: body['instance_pool_id'] = self.instance_pool_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteInstancePool': + def from_dict(cls, d: Dict[str, any]) -> DeleteInstancePool: + """Deserializes the DeleteInstancePool from a dictionary.""" return cls(instance_pool_id=d.get('instance_pool_id', None)) @dataclass class DeletePolicy: policy_id: str + """The ID of the policy to delete.""" def as_dict(self) -> dict: + """Serializes the DeletePolicy into a dictionary suitable for use as a JSON request body.""" body = {} if self.policy_id is not None: body['policy_id'] = self.policy_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeletePolicy': + def from_dict(cls, d: Dict[str, any]) -> DeletePolicy: + """Deserializes the DeletePolicy from a dictionary.""" return cls(policy_id=d.get('policy_id', None)) @dataclass class DestroyContext: cluster_id: str + context_id: str def as_dict(self) -> dict: + """Serializes the DestroyContext into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['clusterId'] = self.cluster_id if self.context_id is not None: body['contextId'] = self.context_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DestroyContext': + def from_dict(cls, d: Dict[str, any]) -> DestroyContext: + """Deserializes the DestroyContext from a dictionary.""" return cls(cluster_id=d.get('clusterId', None), context_id=d.get('contextId', None)) @dataclass class DiskSpec: disk_count: Optional[int] = None + """The number of disks launched for each instance: - This feature is only enabled for supported + node types. - Users can choose up to the limit of the disks supported by the node type. - For + node types with no OS disk, at least one disk must be specified; otherwise, cluster creation + will fail. + + If disks are attached, Databricks will configure Spark to use only the disks for scratch + storage, because heterogenously sized scratch devices can lead to inefficient disk utilization. + If no disks are attached, Databricks will configure Spark to use instance store disks. + + Note: If disks are specified, then the Spark configuration `spark.local.dir` will be overridden. + + Disks will be mounted at: - For AWS: `/ebs0`, `/ebs1`, and etc. - For Azure: `/remote_volume0`, + `/remote_volume1`, and etc.""" + disk_iops: Optional[int] = None + disk_size: Optional[int] = None + """The size of each disk (in GiB) launched for each instance. Values must fall into the supported + range for a particular instance type. + + For AWS: - General Purpose SSD: 100 - 4096 GiB - Throughput Optimized HDD: 500 - 4096 GiB + + For Azure: - Premium LRS (SSD): 1 - 1023 GiB - Standard LRS (HDD): 1- 1023 GiB""" + disk_throughput: Optional[int] = None - disk_type: Optional['DiskType'] = None + + disk_type: Optional[DiskType] = None + """The type of disks that will be launched with this cluster.""" def as_dict(self) -> dict: + """Serializes the DiskSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.disk_count is not None: body['disk_count'] = self.disk_count if self.disk_iops is not None: body['disk_iops'] = self.disk_iops @@ -1419,7 +2342,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DiskSpec': + def from_dict(cls, d: Dict[str, any]) -> DiskSpec: + """Deserializes the DiskSpec from a dictionary.""" return cls(disk_count=d.get('disk_count', None), disk_iops=d.get('disk_iops', None), disk_size=d.get('disk_size', None), @@ -1429,10 +2353,12 @@ def from_dict(cls, d: Dict[str, any]) -> 'DiskSpec': @dataclass class DiskType: - azure_disk_volume_type: Optional['DiskTypeAzureDiskVolumeType'] = None - ebs_volume_type: Optional['DiskTypeEbsVolumeType'] = None + azure_disk_volume_type: Optional[DiskTypeAzureDiskVolumeType] = None + + ebs_volume_type: Optional[DiskTypeEbsVolumeType] = None def as_dict(self) -> dict: + """Serializes the DiskType into a dictionary suitable for use as a JSON request body.""" body = {} if self.azure_disk_volume_type is not None: body['azure_disk_volume_type'] = self.azure_disk_volume_type.value @@ -1440,7 +2366,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DiskType': + def from_dict(cls, d: Dict[str, any]) -> DiskType: + """Deserializes the DiskType from a dictionary.""" return cls(azure_disk_volume_type=_enum(d, 'azure_disk_volume_type', DiskTypeAzureDiskVolumeType), ebs_volume_type=_enum(d, 'ebs_volume_type', DiskTypeEbsVolumeType)) @@ -1460,32 +2387,41 @@ class DiskTypeEbsVolumeType(Enum): @dataclass class DockerBasicAuth: password: Optional[str] = None + """Password of the user""" + username: Optional[str] = None + """Name of the user""" def as_dict(self) -> dict: + """Serializes the DockerBasicAuth into a dictionary suitable for use as a JSON request body.""" body = {} if self.password is not None: body['password'] = self.password if self.username is not None: body['username'] = self.username return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DockerBasicAuth': + def from_dict(cls, d: Dict[str, any]) -> DockerBasicAuth: + """Deserializes the DockerBasicAuth from a dictionary.""" return cls(password=d.get('password', None), username=d.get('username', None)) @dataclass class DockerImage: - basic_auth: Optional['DockerBasicAuth'] = None + basic_auth: Optional[DockerBasicAuth] = None + url: Optional[str] = None + """URL of the docker image.""" def as_dict(self) -> dict: + """Serializes the DockerImage into a dictionary suitable for use as a JSON request body.""" body = {} if self.basic_auth: body['basic_auth'] = self.basic_auth.as_dict() if self.url is not None: body['url'] = self.url return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DockerImage': + def from_dict(cls, d: Dict[str, any]) -> DockerImage: + """Deserializes the DockerImage from a dictionary.""" return cls(basic_auth=_from_dict(d, 'basic_auth', DockerBasicAuth), url=d.get('url', None)) @@ -1499,36 +2435,154 @@ class EbsVolumeType(Enum): @dataclass class EditCluster: cluster_id: str + """ID of the cluser""" + spark_version: str + """The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can + be retrieved by using the :method:clusters/sparkVersions API call.""" + apply_policy_default_values: Optional[bool] = None - autoscale: Optional['AutoScale'] = None + + autoscale: Optional[AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + autotermination_minutes: Optional[int] = None - aws_attributes: Optional['AwsAttributes'] = None - azure_attributes: Optional['AzureAttributes'] = None - cluster_log_conf: Optional['ClusterLogConf'] = None + """Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. Users can also set this value to 0 to explicitly disable automatic + termination.""" + + aws_attributes: Optional[AwsAttributes] = None + """Attributes related to clusters running on Amazon Web Services. If not specified at cluster + creation, a set of default values will be used.""" + + azure_attributes: Optional[AzureAttributes] = None + """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, + a set of default values will be used.""" + + cluster_log_conf: Optional[ClusterLogConf] = None + """The configuration for delivering spark logs to a long-term storage destination. Two kinds of + destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. + If the conf is given, the logs will be delivered to the destination every `5 mins`. The + destination of driver logs is `$destination/$clusterId/driver`, while the destination of + executor logs is `$destination/$clusterId/executor`.""" + cluster_name: Optional[str] = None - cluster_source: Optional['ClusterSource'] = None - custom_tags: Optional['Dict[str,str]'] = None - data_security_mode: Optional['DataSecurityMode'] = None - docker_image: Optional['DockerImage'] = None + """Cluster name requested by the user. This doesn't have to be unique. If not specified at + creation, the cluster name will be an empty string.""" + + cluster_source: Optional[ClusterSource] = None + """Determines whether the cluster was created by a user through the UI, created by the Databricks + Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster + tags""" + + data_security_mode: Optional[DataSecurityMode] = None + """Data security mode decides what data governance model to use when accessing data from a cluster. + + * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features + are not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively + used by a single user specified in `single_user_name`. Most programming languages, cluster + features and data governance features are available in this mode. * `USER_ISOLATION`: A secure + cluster that can be shared by multiple users. Cluster users are fully isolated so that they + cannot see each other's data and credentials. Most data governance features are supported in + this mode. But programming languages and cluster features might be limited. * + `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. * + `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high + concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy + Passthrough on standard clusters.""" + + docker_image: Optional[DockerImage] = None + driver_instance_pool_id: Optional[str] = None + """The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster + uses the instance pool with id (instance_pool_id) if the driver pool is not assigned.""" + driver_node_type_id: Optional[str] = None + """The node type of the Spark driver. Note that this field is optional; if unset, the driver node + type will be set as the same value as `node_type_id` defined above.""" + enable_elastic_disk: Optional[bool] = None + """Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. This feature requires specific AWS + permissions to function correctly - refer to the User Guide for more details.""" + enable_local_disk_encryption: Optional[bool] = None - gcp_attributes: Optional['GcpAttributes'] = None - init_scripts: Optional['List[InitScriptInfo]'] = None + """Whether to enable LUKS on cluster VMs' local disks""" + + gcp_attributes: Optional[GcpAttributes] = None + """Attributes related to clusters running on Google Cloud Platform. If not specified at cluster + creation, a set of default values will be used.""" + + init_scripts: Optional[List[InitScriptInfo]] = None + """The configuration for storing init scripts. Any number of destinations can be specified. The + scripts are executed sequentially in the order provided. If `cluster_log_conf` is specified, + init script logs are sent to `//init_scripts`.""" + instance_pool_id: Optional[str] = None + """The optional ID of the instance pool to which the cluster belongs.""" + node_type_id: Optional[str] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" + policy_id: Optional[str] = None - runtime_engine: Optional['RuntimeEngine'] = None + """The ID of the cluster policy used to create the cluster if applicable.""" + + runtime_engine: Optional[RuntimeEngine] = None + """Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime + engine is inferred from spark_version.""" + single_user_name: Optional[str] = None - spark_conf: Optional['Dict[str,str]'] = None - spark_env_vars: Optional['Dict[str,str]'] = None - ssh_public_keys: Optional['List[str]'] = None - workload_type: Optional['WorkloadType'] = None + """Single user name if data_security_mode is `SINGLE_USER`""" + + spark_conf: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively.""" + + spark_env_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) + while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them + to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default + databricks managed environmental variables are included as well. + + Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": + "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS + -Dspark.shuffle.service.enabled=true"}`""" + + ssh_public_keys: Optional[List[str]] = None + """SSH public key contents that will be added to each Spark node in this cluster. The corresponding + private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can + be specified.""" + + workload_type: Optional[WorkloadType] = None def as_dict(self) -> dict: + """Serializes the EditCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.apply_policy_default_values is not None: body['apply_policy_default_values'] = self.apply_policy_default_values @@ -1566,7 +2620,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EditCluster': + def from_dict(cls, d: Dict[str, any]) -> EditCluster: + """Deserializes the EditCluster from a dictionary.""" return cls(apply_policy_default_values=d.get('apply_policy_default_values', None), autoscale=_from_dict(d, 'autoscale', AutoScale), autotermination_minutes=d.get('autotermination_minutes', None), @@ -1601,14 +2656,41 @@ def from_dict(cls, d: Dict[str, any]) -> 'EditCluster': @dataclass class EditInstancePool: instance_pool_id: str + """Instance pool ID""" + instance_pool_name: str + """Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 + characters.""" + node_type_id: str - custom_tags: Optional['Dict[str,str]'] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS instances + and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags""" + idle_instance_autotermination_minutes: Optional[int] = None + """Automatically terminates the extra instances in the pool cache after they are inactive for this + time in minutes if min_idle_instances requirement is already met. If not set, the extra pool + instances will be automatically terminated after a default timeout. If specified, the threshold + must be between 0 and 10000 minutes. Users can also set this value to 0 to instantly remove idle + instances from the cache if min cache size could still hold.""" + max_capacity: Optional[int] = None + """Maximum number of outstanding instances to keep in the pool, including both instances used by + clusters and idle instances. Clusters that require further instance provisioning will fail + during upsize requests.""" + min_idle_instances: Optional[int] = None + """Minimum number of idle instances to keep in the instance pool""" def as_dict(self) -> dict: + """Serializes the EditInstancePool into a dictionary suitable for use as a JSON request body.""" body = {} if self.custom_tags: body['custom_tags'] = self.custom_tags if self.idle_instance_autotermination_minutes is not None: @@ -1621,7 +2703,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EditInstancePool': + def from_dict(cls, d: Dict[str, any]) -> EditInstancePool: + """Deserializes the EditInstancePool from a dictionary.""" return cls(custom_tags=d.get('custom_tags', None), idle_instance_autotermination_minutes=d.get('idle_instance_autotermination_minutes', None), instance_pool_id=d.get('instance_pool_id', None), @@ -1634,15 +2717,45 @@ def from_dict(cls, d: Dict[str, any]) -> 'EditInstancePool': @dataclass class EditPolicy: policy_id: str + """The ID of the policy to update.""" + name: str + """Cluster Policy name requested by the user. This has to be unique. Length must be between 1 and + 100 characters.""" + definition: Optional[str] = None + """Policy definition document expressed in [Databricks Cluster Policy Definition Language]. + + [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" + description: Optional[str] = None - libraries: Optional['List[Library]'] = None + """Additional human-readable description of the cluster policy.""" + + libraries: Optional[List[Library]] = None + """A list of libraries to be installed on the next cluster restart that uses this policy.""" + max_clusters_per_user: Optional[int] = None + """Max number of clusters per user that can be active using this policy. If not present, there is + no max limit.""" + policy_family_definition_overrides: Optional[str] = None + """Policy definition JSON document expressed in [Databricks Policy Definition Language]. The JSON + document must be passed as a string and cannot be embedded in the requests. + + You can use this to customize the policy definition inherited from the policy family. Policy + rules specified here are merged into the inherited policy definition. + + [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" + policy_family_id: Optional[str] = None + """ID of the policy family. The cluster policy's policy definition inherits the policy family's + policy definition. + + Cannot be used with `definition`. Use `policy_family_definition_overrides` instead to customize + the policy definition.""" def as_dict(self) -> dict: + """Serializes the EditPolicy into a dictionary suitable for use as a JSON request body.""" body = {} if self.definition is not None: body['definition'] = self.definition if self.description is not None: body['description'] = self.description @@ -1656,7 +2769,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EditPolicy': + def from_dict(cls, d: Dict[str, any]) -> EditPolicy: + """Deserializes the EditPolicy from a dictionary.""" return cls(definition=d.get('definition', None), description=d.get('description', None), libraries=_repeated_dict(d, 'libraries', Library), @@ -1669,28 +2783,71 @@ def from_dict(cls, d: Dict[str, any]) -> 'EditPolicy': @dataclass class EventDetails: - attributes: Optional['ClusterAttributes'] = None - cause: Optional['EventDetailsCause'] = None - cluster_size: Optional['ClusterSize'] = None + attributes: Optional[ClusterAttributes] = None + """* For created clusters, the attributes of the cluster. * For edited clusters, the new attributes + of the cluster.""" + + cause: Optional[EventDetailsCause] = None + """The cause of a change in target size.""" + + cluster_size: Optional[ClusterSize] = None + """The actual cluster size that was set in the cluster creation or edit.""" + current_num_vcpus: Optional[int] = None + """The current number of vCPUs in the cluster.""" + current_num_workers: Optional[int] = None + """The current number of nodes in the cluster.""" + did_not_expand_reason: Optional[str] = None + """""" + disk_size: Optional[int] = None + """Current disk size in bytes""" + driver_state_message: Optional[str] = None + """More details about the change in driver's state""" + enable_termination_for_node_blocklisted: Optional[bool] = None + """Whether or not a blocklisted node should be terminated. For ClusterEventType NODE_BLACKLISTED.""" + free_space: Optional[int] = None - init_scripts: Optional['InitScriptEventDetails'] = None + """""" + + init_scripts: Optional[InitScriptEventDetails] = None + """List of global and cluster init scripts associated with this cluster event.""" + instance_id: Optional[str] = None + """Instance Id where the event originated from""" + job_run_name: Optional[str] = None - previous_attributes: Optional['ClusterAttributes'] = None - previous_cluster_size: Optional['ClusterSize'] = None + """Unique identifier of the specific job run associated with this cluster event * For clusters + created for jobs, this will be the same as the cluster name""" + + previous_attributes: Optional[ClusterAttributes] = None + """The cluster attributes before a cluster was edited.""" + + previous_cluster_size: Optional[ClusterSize] = None + """The size of the cluster before an edit or resize.""" + previous_disk_size: Optional[int] = None - reason: Optional['TerminationReason'] = None + """Previous disk size in bytes""" + + reason: Optional[TerminationReason] = None + """A termination reason: * On a TERMINATED event, this is the reason of the termination. * On a + RESIZE_COMPLETE event, this indicates the reason that we failed to acquire some nodes.""" + target_num_vcpus: Optional[int] = None + """The targeted number of vCPUs in the cluster.""" + target_num_workers: Optional[int] = None + """The targeted number of nodes in the cluster.""" + user: Optional[str] = None + """The user that caused the event to occur. (Empty if it was done by the control plane.)""" def as_dict(self) -> dict: + """Serializes the EventDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.attributes: body['attributes'] = self.attributes.as_dict() if self.cause is not None: body['cause'] = self.cause.value @@ -1716,7 +2873,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EventDetails': + def from_dict(cls, d: Dict[str, any]) -> EventDetails: + """Deserializes the EventDetails from a dictionary.""" return cls(attributes=_from_dict(d, 'attributes', ClusterAttributes), cause=_enum(d, 'cause', EventDetailsCause), cluster_size=_from_dict(d, 'cluster_size', ClusterSize), @@ -1780,12 +2938,27 @@ class EventType(Enum): @dataclass class GcpAttributes: - availability: Optional['GcpAvailability'] = None + availability: Optional[GcpAvailability] = None + """This field determines whether the instance pool will contain preemptible VMs, on-demand VMs, or + preemptible VMs with a fallback to on-demand VMs if the former is unavailable.""" + boot_disk_size: Optional[int] = None + """boot disk size in GB""" + google_service_account: Optional[str] = None + """If provided, the cluster will impersonate the google service account when accessing gcloud + services (like GCS). The google service account must have previously been added to the + Databricks environment by an account administrator.""" + local_ssd_count: Optional[int] = None + """If provided, each node (workers and driver) in the cluster will have this number of local SSDs + attached. Each local SSD is 375GB in size. Refer to [GCP documentation] for the supported number + of local SSDs for each instance type. + + [GCP documentation]: https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds""" def as_dict(self) -> dict: + """Serializes the GcpAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.availability is not None: body['availability'] = self.availability.value if self.boot_disk_size is not None: body['boot_disk_size'] = self.boot_disk_size @@ -1795,7 +2968,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GcpAttributes': + def from_dict(cls, d: Dict[str, any]) -> GcpAttributes: + """Deserializes the GcpAttributes from a dictionary.""" return cls(availability=_enum(d, 'availability', GcpAvailability), boot_disk_size=d.get('boot_disk_size', None), google_service_account=d.get('google_service_account', None), @@ -1813,29 +2987,35 @@ class GcpAvailability(Enum): @dataclass class GetClusterPermissionLevelsResponse: - permission_levels: Optional['List[ClusterPermissionsDescription]'] = None + permission_levels: Optional[List[ClusterPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetClusterPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetClusterPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetClusterPermissionLevelsResponse: + """Deserializes the GetClusterPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', ClusterPermissionsDescription)) @dataclass class GetClusterPolicyPermissionLevelsResponse: - permission_levels: Optional['List[ClusterPolicyPermissionsDescription]'] = None + permission_levels: Optional[List[ClusterPolicyPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetClusterPolicyPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetClusterPolicyPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetClusterPolicyPermissionLevelsResponse: + """Deserializes the GetClusterPolicyPermissionLevelsResponse from a dictionary.""" return cls( permission_levels=_repeated_dict(d, 'permission_levels', ClusterPolicyPermissionsDescription)) @@ -1843,14 +3023,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetClusterPolicyPermissionLevelsRespon @dataclass class GetEvents: cluster_id: str + """The ID of the cluster to retrieve events about.""" + end_time: Optional[int] = None - event_types: Optional['List[EventType]'] = None + """The end time in epoch milliseconds. If empty, returns events up to the current time.""" + + event_types: Optional[List[EventType]] = None + """An optional set of event types to filter on. If empty, all event types are returned.""" + limit: Optional[int] = None + """The maximum number of events to include in a page of events. Defaults to 50, and maximum allowed + value is 500.""" + offset: Optional[int] = None - order: Optional['GetEventsOrder'] = None + """The offset in the result set. Defaults to 0 (no offset). When an offset is specified and the + results are requested in descending order, the end_time field is required.""" + + order: Optional[GetEventsOrder] = None + """The order to list events in; either "ASC" or "DESC". Defaults to "DESC".""" + start_time: Optional[int] = None + """The start time in epoch milliseconds. If empty, returns events starting from the beginning of + time.""" def as_dict(self) -> dict: + """Serializes the GetEvents into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.end_time is not None: body['end_time'] = self.end_time @@ -1862,7 +3059,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetEvents': + def from_dict(cls, d: Dict[str, any]) -> GetEvents: + """Deserializes the GetEvents from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), end_time=d.get('end_time', None), event_types=_repeated_enum(d, 'event_types', EventType), @@ -1881,11 +3079,18 @@ class GetEventsOrder(Enum): @dataclass class GetEventsResponse: - events: Optional['List[ClusterEvent]'] = None - next_page: Optional['GetEvents'] = None + events: Optional[List[ClusterEvent]] = None + """""" + + next_page: Optional[GetEvents] = None + """The parameters required to retrieve the next page of events. Omitted if there are no more events + to read.""" + total_count: Optional[int] = None + """The total number of events filtered by the start_time, end_time, and event_types.""" def as_dict(self) -> dict: + """Serializes the GetEventsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.events: body['events'] = [v.as_dict() for v in self.events] if self.next_page: body['next_page'] = self.next_page.as_dict() @@ -1893,7 +3098,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetEventsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetEventsResponse: + """Deserializes the GetEventsResponse from a dictionary.""" return cls(events=_repeated_dict(d, 'events', ClusterEvent), next_page=_from_dict(d, 'next_page', GetEvents), total_count=d.get('total_count', None)) @@ -1902,25 +3108,90 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetEventsResponse': @dataclass class GetInstancePool: instance_pool_id: str - aws_attributes: Optional['InstancePoolAwsAttributes'] = None - azure_attributes: Optional['InstancePoolAzureAttributes'] = None - custom_tags: Optional['Dict[str,str]'] = None - default_tags: Optional['Dict[str,str]'] = None - disk_spec: Optional['DiskSpec'] = None + """Canonical unique identifier for the pool.""" + + aws_attributes: Optional[InstancePoolAwsAttributes] = None + """Attributes related to instance pools running on Amazon Web Services. If not specified at pool + creation, a set of default values will be used.""" + + azure_attributes: Optional[InstancePoolAzureAttributes] = None + """Attributes related to instance pools running on Azure. If not specified at pool creation, a set + of default values will be used.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS instances + and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags""" + + default_tags: Optional[Dict[str, str]] = None + """Tags that are added by Databricks regardless of any `custom_tags`, including: + + - Vendor: Databricks + + - InstancePoolCreator: + + - InstancePoolName: + + - InstancePoolId: """ + + disk_spec: Optional[DiskSpec] = None + """Defines the specification of the disks that will be attached to all spark containers.""" + enable_elastic_disk: Optional[bool] = None - gcp_attributes: Optional['InstancePoolGcpAttributes'] = None + """Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire + additional disk space when its Spark workers are running low on disk space. In AWS, this feature + requires specific AWS permissions to function correctly - refer to the User Guide for more + details.""" + + gcp_attributes: Optional[InstancePoolGcpAttributes] = None + """Attributes related to instance pools running on Google Cloud Platform. If not specified at pool + creation, a set of default values will be used.""" + idle_instance_autotermination_minutes: Optional[int] = None + """Automatically terminates the extra instances in the pool cache after they are inactive for this + time in minutes if min_idle_instances requirement is already met. If not set, the extra pool + instances will be automatically terminated after a default timeout. If specified, the threshold + must be between 0 and 10000 minutes. Users can also set this value to 0 to instantly remove idle + instances from the cache if min cache size could still hold.""" + instance_pool_name: Optional[str] = None + """Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 + characters.""" + max_capacity: Optional[int] = None + """Maximum number of outstanding instances to keep in the pool, including both instances used by + clusters and idle instances. Clusters that require further instance provisioning will fail + during upsize requests.""" + min_idle_instances: Optional[int] = None + """Minimum number of idle instances to keep in the instance pool""" + node_type_id: Optional[str] = None - preloaded_docker_images: Optional['List[DockerImage]'] = None - preloaded_spark_versions: Optional['List[str]'] = None - state: Optional['InstancePoolState'] = None - stats: Optional['InstancePoolStats'] = None - status: Optional['InstancePoolStatus'] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + + preloaded_docker_images: Optional[List[DockerImage]] = None + """Custom Docker Image BYOC""" + + preloaded_spark_versions: Optional[List[str]] = None + """A list containing at most one preloaded Spark image version for the pool. Pool-backed clusters + started with the preloaded Spark version will start faster. A list of available Spark versions + can be retrieved by using the :method:clusters/sparkVersions API call.""" + + state: Optional[InstancePoolState] = None + """Current state of the instance pool.""" + + stats: Optional[InstancePoolStats] = None + """Usage statistics about the instance pool.""" + + status: Optional[InstancePoolStatus] = None + """Status of failed pending instances in the pool.""" def as_dict(self) -> dict: + """Serializes the GetInstancePool into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_attributes: body['aws_attributes'] = self.aws_attributes.as_dict() if self.azure_attributes: body['azure_attributes'] = self.azure_attributes.as_dict() @@ -1946,7 +3217,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetInstancePool': + def from_dict(cls, d: Dict[str, any]) -> GetInstancePool: + """Deserializes the GetInstancePool from a dictionary.""" return cls(aws_attributes=_from_dict(d, 'aws_attributes', InstancePoolAwsAttributes), azure_attributes=_from_dict(d, 'azure_attributes', InstancePoolAzureAttributes), custom_tags=d.get('custom_tags', None), @@ -1969,41 +3241,63 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetInstancePool': @dataclass class GetInstancePoolPermissionLevelsResponse: - permission_levels: Optional['List[InstancePoolPermissionsDescription]'] = None + permission_levels: Optional[List[InstancePoolPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetInstancePoolPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetInstancePoolPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetInstancePoolPermissionLevelsResponse: + """Deserializes the GetInstancePoolPermissionLevelsResponse from a dictionary.""" return cls( permission_levels=_repeated_dict(d, 'permission_levels', InstancePoolPermissionsDescription)) @dataclass class GetSparkVersionsResponse: - versions: Optional['List[SparkVersion]'] = None + versions: Optional[List[SparkVersion]] = None + """All the available Spark versions.""" def as_dict(self) -> dict: + """Serializes the GetSparkVersionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.versions: body['versions'] = [v.as_dict() for v in self.versions] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetSparkVersionsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetSparkVersionsResponse: + """Deserializes the GetSparkVersionsResponse from a dictionary.""" return cls(versions=_repeated_dict(d, 'versions', SparkVersion)) @dataclass class GlobalInitScriptCreateRequest: name: str + """The name of the script""" + script: str + """The Base64-encoded content of the script.""" + enabled: Optional[bool] = None + """Specifies whether the script is enabled. The script runs only if enabled.""" + position: Optional[int] = None + """The position of a global init script, where 0 represents the first script to run, 1 is the + second script to run, in ascending order. + + If you omit the numeric position for a new global init script, it defaults to last position. It + will run after all current scripts. Setting any value greater than the position of the last + script is equivalent to the last position. Example: Take three existing scripts with positions + 0, 1, and 2. Any position of (3) or greater puts the script in the last position. If an explicit + position value conflicts with an existing script value, your request succeeds, but the original + script at that position and all later scripts have their positions incremented by 1.""" def as_dict(self) -> dict: + """Serializes the GlobalInitScriptCreateRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.enabled is not None: body['enabled'] = self.enabled if self.name is not None: body['name'] = self.name @@ -2012,7 +3306,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptCreateRequest': + def from_dict(cls, d: Dict[str, any]) -> GlobalInitScriptCreateRequest: + """Deserializes the GlobalInitScriptCreateRequest from a dictionary.""" return cls(enabled=d.get('enabled', None), name=d.get('name', None), position=d.get('position', None), @@ -2022,15 +3317,32 @@ def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptCreateRequest': @dataclass class GlobalInitScriptDetails: created_at: Optional[int] = None + """Time when the script was created, represented as a Unix timestamp in milliseconds.""" + created_by: Optional[str] = None + """The username of the user who created the script.""" + enabled: Optional[bool] = None + """Specifies whether the script is enabled. The script runs only if enabled.""" + name: Optional[str] = None + """The name of the script""" + position: Optional[int] = None + """The position of a script, where 0 represents the first script to run, 1 is the second script to + run, in ascending order.""" + script_id: Optional[str] = None + """The global init script ID.""" + updated_at: Optional[int] = None + """Time when the script was updated, represented as a Unix timestamp in milliseconds.""" + updated_by: Optional[str] = None + """The username of the user who last updated the script""" def as_dict(self) -> dict: + """Serializes the GlobalInitScriptDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.created_by is not None: body['created_by'] = self.created_by @@ -2043,7 +3355,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptDetails': + def from_dict(cls, d: Dict[str, any]) -> GlobalInitScriptDetails: + """Deserializes the GlobalInitScriptDetails from a dictionary.""" return cls(created_at=d.get('created_at', None), created_by=d.get('created_by', None), enabled=d.get('enabled', None), @@ -2057,16 +3370,35 @@ def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptDetails': @dataclass class GlobalInitScriptDetailsWithContent: created_at: Optional[int] = None + """Time when the script was created, represented as a Unix timestamp in milliseconds.""" + created_by: Optional[str] = None + """The username of the user who created the script.""" + enabled: Optional[bool] = None + """Specifies whether the script is enabled. The script runs only if enabled.""" + name: Optional[str] = None + """The name of the script""" + position: Optional[int] = None + """The position of a script, where 0 represents the first script to run, 1 is the second script to + run, in ascending order.""" + script: Optional[str] = None + """The Base64-encoded content of the script.""" + script_id: Optional[str] = None + """The global init script ID.""" + updated_at: Optional[int] = None + """Time when the script was updated, represented as a Unix timestamp in milliseconds.""" + updated_by: Optional[str] = None + """The username of the user who last updated the script""" def as_dict(self) -> dict: + """Serializes the GlobalInitScriptDetailsWithContent into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.created_by is not None: body['created_by'] = self.created_by @@ -2080,7 +3412,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptDetailsWithContent': + def from_dict(cls, d: Dict[str, any]) -> GlobalInitScriptDetailsWithContent: + """Deserializes the GlobalInitScriptDetailsWithContent from a dictionary.""" return cls(created_at=d.get('created_at', None), created_by=d.get('created_by', None), enabled=d.get('enabled', None), @@ -2095,12 +3428,30 @@ def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptDetailsWithContent': @dataclass class GlobalInitScriptUpdateRequest: name: str + """The name of the script""" + script: str + """The Base64-encoded content of the script.""" + enabled: Optional[bool] = None + """Specifies whether the script is enabled. The script runs only if enabled.""" + position: Optional[int] = None + """The position of a script, where 0 represents the first script to run, 1 is the second script to + run, in ascending order. To move the script to run first, set its position to 0. + + To move the script to the end, set its position to any value greater or equal to the position of + the last script. Example, three existing scripts with positions 0, 1, and 2. Any position value + of 2 or greater puts the script in the last position (2). + + If an explicit position value conflicts with an existing script, your request succeeds, but the + original script at that position and all later scripts have their positions incremented by 1.""" + script_id: Optional[str] = None + """The ID of the global init script.""" def as_dict(self) -> dict: + """Serializes the GlobalInitScriptUpdateRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.enabled is not None: body['enabled'] = self.enabled if self.name is not None: body['name'] = self.name @@ -2110,7 +3461,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptUpdateRequest': + def from_dict(cls, d: Dict[str, any]) -> GlobalInitScriptUpdateRequest: + """Deserializes the GlobalInitScriptUpdateRequest from a dictionary.""" return cls(enabled=d.get('enabled', None), name=d.get('name', None), position=d.get('position', None), @@ -2120,11 +3472,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'GlobalInitScriptUpdateRequest': @dataclass class InitScriptEventDetails: - cluster: Optional['List[InitScriptInfoAndExecutionDetails]'] = None - global_: Optional['List[InitScriptInfoAndExecutionDetails]'] = None + cluster: Optional[List[InitScriptInfoAndExecutionDetails]] = None + """The cluster scoped init scripts associated with this cluster event""" + + global_: Optional[List[InitScriptInfoAndExecutionDetails]] = None + """The global init scripts associated with this cluster event""" + reported_for_node: Optional[str] = None + """The private ip address of the node where the init scripts were run.""" def as_dict(self) -> dict: + """Serializes the InitScriptEventDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster: body['cluster'] = [v.as_dict() for v in self.cluster] if self.global_: body['global'] = [v.as_dict() for v in self.global_] @@ -2132,7 +3490,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InitScriptEventDetails': + def from_dict(cls, d: Dict[str, any]) -> InitScriptEventDetails: + """Deserializes the InitScriptEventDetails from a dictionary.""" return cls(cluster=_repeated_dict(d, 'cluster', InitScriptInfoAndExecutionDetails), global_=_repeated_dict(d, 'global', InitScriptInfoAndExecutionDetails), reported_for_node=d.get('reported_for_node', None)) @@ -2141,10 +3500,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'InitScriptEventDetails': @dataclass class InitScriptExecutionDetails: error_message: Optional[str] = None + """Addition details regarding errors.""" + execution_duration_seconds: Optional[int] = None - status: Optional['InitScriptExecutionDetailsStatus'] = None + """The duration of the script execution in seconds.""" + + status: Optional[InitScriptExecutionDetailsStatus] = None + """The current status of the script""" def as_dict(self) -> dict: + """Serializes the InitScriptExecutionDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.error_message is not None: body['error_message'] = self.error_message if self.execution_duration_seconds is not None: @@ -2153,7 +3518,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InitScriptExecutionDetails': + def from_dict(cls, d: Dict[str, any]) -> InitScriptExecutionDetails: + """Deserializes the InitScriptExecutionDetails from a dictionary.""" return cls(error_message=d.get('error_message', None), execution_duration_seconds=d.get('execution_duration_seconds', None), status=_enum(d, 'status', InitScriptExecutionDetailsStatus)) @@ -2172,13 +3538,30 @@ class InitScriptExecutionDetailsStatus(Enum): @dataclass class InitScriptInfo: - dbfs: Optional['DbfsStorageInfo'] = None - file: Optional['LocalFileInfo'] = None - s3: Optional['S3StorageInfo'] = None - volumes: Optional['VolumesStorageInfo'] = None - workspace: Optional['WorkspaceStorageInfo'] = None + dbfs: Optional[DbfsStorageInfo] = None + """destination needs to be provided. e.g. `{ "dbfs" : { "destination" : "dbfs:/home/cluster_log" } + }`""" + + file: Optional[LocalFileInfo] = None + """destination needs to be provided. e.g. `{ "file" : { "destination" : "file:/my/local/file.sh" } + }`""" + + s3: Optional[S3StorageInfo] = None + """destination and either the region or endpoint need to be provided. e.g. `{ "s3": { "destination" + : "s3://cluster_log_bucket/prefix", "region" : "us-west-2" } }` Cluster iam role is used to + access s3, please make sure the cluster iam role in `instance_profile_arn` has permission to + write data to the s3 destination.""" + + volumes: Optional[VolumesStorageInfo] = None + """destination needs to be provided. e.g. `{ "volumes" : { "destination" : "/Volumes/my-init.sh" } + }`""" + + workspace: Optional[WorkspaceStorageInfo] = None + """destination needs to be provided. e.g. `{ "workspace" : { "destination" : + "/Users/user1@databricks.com/my-init.sh" } }`""" def as_dict(self) -> dict: + """Serializes the InitScriptInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbfs: body['dbfs'] = self.dbfs.as_dict() if self.file: body['file'] = self.file.as_dict() @@ -2188,7 +3571,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InitScriptInfo': + def from_dict(cls, d: Dict[str, any]) -> InitScriptInfo: + """Deserializes the InitScriptInfo from a dictionary.""" return cls(dbfs=_from_dict(d, 'dbfs', DbfsStorageInfo), file=_from_dict(d, 'file', LocalFileInfo), s3=_from_dict(d, 's3', S3StorageInfo), @@ -2198,17 +3582,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'InitScriptInfo': @dataclass class InitScriptInfoAndExecutionDetails: - execution_details: Optional['InitScriptExecutionDetails'] = None - script: Optional['InitScriptInfo'] = None + execution_details: Optional[InitScriptExecutionDetails] = None + """Details about the script""" + + script: Optional[InitScriptInfo] = None + """The script""" def as_dict(self) -> dict: + """Serializes the InitScriptInfoAndExecutionDetails into a dictionary suitable for use as a JSON request body.""" body = {} if self.execution_details: body['execution_details'] = self.execution_details.as_dict() if self.script: body['script'] = self.script.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InitScriptInfoAndExecutionDetails': + def from_dict(cls, d: Dict[str, any]) -> InitScriptInfoAndExecutionDetails: + """Deserializes the InitScriptInfoAndExecutionDetails from a dictionary.""" return cls(execution_details=_from_dict(d, 'execution_details', InitScriptExecutionDetails), script=_from_dict(d, 'script', InitScriptInfo)) @@ -2216,27 +3605,41 @@ def from_dict(cls, d: Dict[str, any]) -> 'InitScriptInfoAndExecutionDetails': @dataclass class InstallLibraries: cluster_id: str - libraries: 'List[Library]' + """Unique identifier for the cluster on which to install these libraries.""" + + libraries: List[Library] + """The libraries to install.""" def as_dict(self) -> dict: + """Serializes the InstallLibraries into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.libraries: body['libraries'] = [v.as_dict() for v in self.libraries] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstallLibraries': + def from_dict(cls, d: Dict[str, any]) -> InstallLibraries: + """Deserializes the InstallLibraries from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), libraries=_repeated_dict(d, 'libraries', Library)) @dataclass class InstancePoolAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['InstancePoolPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[InstancePoolPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the InstancePoolAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -2246,7 +3649,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolAccessControlRequest: + """Deserializes the InstancePoolAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', InstancePoolPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -2255,13 +3659,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAccessControlRequest': @dataclass class InstancePoolAccessControlResponse: - all_permissions: Optional['List[InstancePoolPermission]'] = None + all_permissions: Optional[List[InstancePoolPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the InstancePoolAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -2272,7 +3686,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolAccessControlResponse: + """Deserializes the InstancePoolAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', InstancePoolPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -2282,26 +3697,91 @@ def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAccessControlResponse': @dataclass class InstancePoolAndStats: - aws_attributes: Optional['InstancePoolAwsAttributes'] = None - azure_attributes: Optional['InstancePoolAzureAttributes'] = None - custom_tags: Optional['Dict[str,str]'] = None - default_tags: Optional['Dict[str,str]'] = None - disk_spec: Optional['DiskSpec'] = None + aws_attributes: Optional[InstancePoolAwsAttributes] = None + """Attributes related to instance pools running on Amazon Web Services. If not specified at pool + creation, a set of default values will be used.""" + + azure_attributes: Optional[InstancePoolAzureAttributes] = None + """Attributes related to instance pools running on Azure. If not specified at pool creation, a set + of default values will be used.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS instances + and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags""" + + default_tags: Optional[Dict[str, str]] = None + """Tags that are added by Databricks regardless of any `custom_tags`, including: + + - Vendor: Databricks + + - InstancePoolCreator: + + - InstancePoolName: + + - InstancePoolId: """ + + disk_spec: Optional[DiskSpec] = None + """Defines the specification of the disks that will be attached to all spark containers.""" + enable_elastic_disk: Optional[bool] = None - gcp_attributes: Optional['InstancePoolGcpAttributes'] = None + """Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire + additional disk space when its Spark workers are running low on disk space. In AWS, this feature + requires specific AWS permissions to function correctly - refer to the User Guide for more + details.""" + + gcp_attributes: Optional[InstancePoolGcpAttributes] = None + """Attributes related to instance pools running on Google Cloud Platform. If not specified at pool + creation, a set of default values will be used.""" + idle_instance_autotermination_minutes: Optional[int] = None + """Automatically terminates the extra instances in the pool cache after they are inactive for this + time in minutes if min_idle_instances requirement is already met. If not set, the extra pool + instances will be automatically terminated after a default timeout. If specified, the threshold + must be between 0 and 10000 minutes. Users can also set this value to 0 to instantly remove idle + instances from the cache if min cache size could still hold.""" + instance_pool_id: Optional[str] = None + """Canonical unique identifier for the pool.""" + instance_pool_name: Optional[str] = None + """Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 + characters.""" + max_capacity: Optional[int] = None + """Maximum number of outstanding instances to keep in the pool, including both instances used by + clusters and idle instances. Clusters that require further instance provisioning will fail + during upsize requests.""" + min_idle_instances: Optional[int] = None + """Minimum number of idle instances to keep in the instance pool""" + node_type_id: Optional[str] = None - preloaded_docker_images: Optional['List[DockerImage]'] = None - preloaded_spark_versions: Optional['List[str]'] = None - state: Optional['InstancePoolState'] = None - stats: Optional['InstancePoolStats'] = None - status: Optional['InstancePoolStatus'] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + + preloaded_docker_images: Optional[List[DockerImage]] = None + """Custom Docker Image BYOC""" + + preloaded_spark_versions: Optional[List[str]] = None + """A list containing at most one preloaded Spark image version for the pool. Pool-backed clusters + started with the preloaded Spark version will start faster. A list of available Spark versions + can be retrieved by using the :method:clusters/sparkVersions API call.""" + + state: Optional[InstancePoolState] = None + """Current state of the instance pool.""" + + stats: Optional[InstancePoolStats] = None + """Usage statistics about the instance pool.""" + + status: Optional[InstancePoolStatus] = None + """Status of failed pending instances in the pool.""" def as_dict(self) -> dict: + """Serializes the InstancePoolAndStats into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_attributes: body['aws_attributes'] = self.aws_attributes.as_dict() if self.azure_attributes: body['azure_attributes'] = self.azure_attributes.as_dict() @@ -2327,7 +3807,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAndStats': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolAndStats: + """Deserializes the InstancePoolAndStats from a dictionary.""" return cls(aws_attributes=_from_dict(d, 'aws_attributes', InstancePoolAwsAttributes), azure_attributes=_from_dict(d, 'azure_attributes', InstancePoolAzureAttributes), custom_tags=d.get('custom_tags', None), @@ -2350,11 +3831,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAndStats': @dataclass class InstancePoolAwsAttributes: - availability: Optional['InstancePoolAwsAttributesAvailability'] = None + availability: Optional[InstancePoolAwsAttributesAvailability] = None + """Availability type used for the spot nodes. + + The default value is defined by InstancePoolConf.instancePoolDefaultAwsAvailability""" + spot_bid_price_percent: Optional[int] = None + """Calculates the bid price for AWS spot instances, as a percentage of the corresponding instance + type's on-demand price. For example, if this field is set to 50, and the cluster needs a new + `r3.xlarge` spot instance, then the bid price is half of the price of on-demand `r3.xlarge` + instances. Similarly, if this field is set to 200, the bid price is twice the price of on-demand + `r3.xlarge` instances. If not specified, the default value is 100. When spot instances are + requested for this cluster, only spot instances whose bid price percentage matches this field + will be considered. Note that, for safety, we enforce this field to be no more than 10000. + + The default value and documentation here should be kept consistent with + CommonConf.defaultSpotBidPricePercent and CommonConf.maxSpotBidPricePercent.""" + zone_id: Optional[str] = None + """Identifier for the availability zone/datacenter in which the cluster resides. This string will + be of a form like "us-west-2a". The provided availability zone must be in the same region as the + Databricks deployment. For example, "us-west-2a" is not a valid zone id if the Databricks + deployment resides in the "us-east-1" region. This is an optional field at cluster creation, and + if not specified, a default zone will be used. The list of available zones as well as the + default value can be found by using the `List Zones` method.""" def as_dict(self) -> dict: + """Serializes the InstancePoolAwsAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.availability is not None: body['availability'] = self.availability.value if self.spot_bid_price_percent is not None: @@ -2363,7 +3866,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAwsAttributes': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolAwsAttributes: + """Deserializes the InstancePoolAwsAttributes from a dictionary.""" return cls(availability=_enum(d, 'availability', InstancePoolAwsAttributesAvailability), spot_bid_price_percent=d.get('spot_bid_price_percent', None), zone_id=d.get('zone_id', None)) @@ -2380,17 +3884,25 @@ class InstancePoolAwsAttributesAvailability(Enum): @dataclass class InstancePoolAzureAttributes: - availability: Optional['InstancePoolAzureAttributesAvailability'] = None + availability: Optional[InstancePoolAzureAttributesAvailability] = None + """Shows the Availability type used for the spot nodes. + + The default value is defined by InstancePoolConf.instancePoolDefaultAzureAvailability""" + spot_bid_max_price: Optional[float] = None + """The default value and documentation here should be kept consistent with + CommonConf.defaultSpotBidMaxPrice.""" def as_dict(self) -> dict: + """Serializes the InstancePoolAzureAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.availability is not None: body['availability'] = self.availability.value if self.spot_bid_max_price is not None: body['spot_bid_max_price'] = self.spot_bid_max_price return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolAzureAttributes': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolAzureAttributes: + """Deserializes the InstancePoolAzureAttributes from a dictionary.""" return cls(availability=_enum(d, 'availability', InstancePoolAzureAttributesAvailability), spot_bid_max_price=d.get('spot_bid_max_price', None)) @@ -2406,11 +3918,26 @@ class InstancePoolAzureAttributesAvailability(Enum): @dataclass class InstancePoolGcpAttributes: - gcp_availability: Optional['GcpAvailability'] = None + gcp_availability: Optional[GcpAvailability] = None + """This field determines whether the instance pool will contain preemptible VMs, on-demand VMs, or + preemptible VMs with a fallback to on-demand VMs if the former is unavailable.""" + local_ssd_count: Optional[int] = None + """If provided, each node in the instance pool will have this number of local SSDs attached. Each + local SSD is 375GB in size. Refer to [GCP documentation] for the supported number of local SSDs + for each instance type. + + [GCP documentation]: https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds""" + zone_id: Optional[str] = None + """Identifier for the availability zone/datacenter in which the cluster resides. This string will + be of a form like "us-west1-a". The provided availability zone must be in the same region as the + Databricks workspace. For example, "us-west1-a" is not a valid zone id if the Databricks + workspace resides in the "us-east1" region. This is an optional field at instance pool creation, + and if not specified, a default zone will be used.""" def as_dict(self) -> dict: + """Serializes the InstancePoolGcpAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.gcp_availability is not None: body['gcp_availability'] = self.gcp_availability.value if self.local_ssd_count is not None: body['local_ssd_count'] = self.local_ssd_count @@ -2418,7 +3945,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolGcpAttributes': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolGcpAttributes: + """Deserializes the InstancePoolGcpAttributes from a dictionary.""" return cls(gcp_availability=_enum(d, 'gcp_availability', GcpAvailability), local_ssd_count=d.get('local_ssd_count', None), zone_id=d.get('zone_id', None)) @@ -2427,10 +3955,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolGcpAttributes': @dataclass class InstancePoolPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['InstancePoolPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[InstancePoolPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the InstancePoolPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -2438,7 +3970,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolPermission': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolPermission: + """Deserializes the InstancePoolPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', InstancePoolPermissionLevel)) @@ -2453,11 +3986,14 @@ class InstancePoolPermissionLevel(Enum): @dataclass class InstancePoolPermissions: - access_control_list: Optional['List[InstancePoolAccessControlResponse]'] = None + access_control_list: Optional[List[InstancePoolAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the InstancePoolPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -2466,7 +4002,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolPermissions': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolPermissions: + """Deserializes the InstancePoolPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', InstancePoolAccessControlResponse), object_id=d.get('object_id', None), @@ -2476,26 +4013,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolPermissions': @dataclass class InstancePoolPermissionsDescription: description: Optional[str] = None - permission_level: Optional['InstancePoolPermissionLevel'] = None + + permission_level: Optional[InstancePoolPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the InstancePoolPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolPermissionsDescription: + """Deserializes the InstancePoolPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', InstancePoolPermissionLevel)) @dataclass class InstancePoolPermissionsRequest: - access_control_list: Optional['List[InstancePoolAccessControlRequest]'] = None + access_control_list: Optional[List[InstancePoolAccessControlRequest]] = None + instance_pool_id: Optional[str] = None + """The instance pool for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the InstancePoolPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -2503,7 +4047,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolPermissionsRequest: + """Deserializes the InstancePoolPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', InstancePoolAccessControlRequest), instance_pool_id=d.get('instance_pool_id', None)) @@ -2520,11 +4065,19 @@ class InstancePoolState(Enum): @dataclass class InstancePoolStats: idle_count: Optional[int] = None + """Number of active instances in the pool that are NOT part of a cluster.""" + pending_idle_count: Optional[int] = None + """Number of pending instances in the pool that are NOT part of a cluster.""" + pending_used_count: Optional[int] = None + """Number of pending instances in the pool that are part of a cluster.""" + used_count: Optional[int] = None + """Number of active instances in the pool that are part of a cluster.""" def as_dict(self) -> dict: + """Serializes the InstancePoolStats into a dictionary suitable for use as a JSON request body.""" body = {} if self.idle_count is not None: body['idle_count'] = self.idle_count if self.pending_idle_count is not None: body['pending_idle_count'] = self.pending_idle_count @@ -2533,7 +4086,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolStats': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolStats: + """Deserializes the InstancePoolStats from a dictionary.""" return cls(idle_count=d.get('idle_count', None), pending_idle_count=d.get('pending_idle_count', None), pending_used_count=d.get('pending_used_count', None), @@ -2542,26 +4096,46 @@ def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolStats': @dataclass class InstancePoolStatus: - pending_instance_errors: Optional['List[PendingInstanceError]'] = None + pending_instance_errors: Optional[List[PendingInstanceError]] = None + """List of error messages for the failed pending instances. The pending_instance_errors follows + FIFO with maximum length of the min_idle of the pool. The pending_instance_errors is emptied + once the number of exiting available instances reaches the min_idle of the pool.""" def as_dict(self) -> dict: + """Serializes the InstancePoolStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.pending_instance_errors: body['pending_instance_errors'] = [v.as_dict() for v in self.pending_instance_errors] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstancePoolStatus': + def from_dict(cls, d: Dict[str, any]) -> InstancePoolStatus: + """Deserializes the InstancePoolStatus from a dictionary.""" return cls(pending_instance_errors=_repeated_dict(d, 'pending_instance_errors', PendingInstanceError)) @dataclass class InstanceProfile: instance_profile_arn: str + """The AWS ARN of the instance profile to register with Databricks. This field is required.""" + iam_role_arn: Optional[str] = None + """The AWS IAM role ARN of the role associated with the instance profile. This field is required if + your role name and instance profile name do not match and you want to use the instance profile + with [Databricks SQL Serverless]. + + Otherwise, this field is optional. + + [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html""" + is_meta_instance_profile: Optional[bool] = None + """Boolean flag indicating whether the instance profile should only be used in credential + passthrough scenarios. If true, it means the instance profile contains an meta IAM role which + could assume a wide range of roles. Therefore it should always be used with authorization. This + field is optional, the default value is `false`.""" def as_dict(self) -> dict: + """Serializes the InstanceProfile into a dictionary suitable for use as a JSON request body.""" body = {} if self.iam_role_arn is not None: body['iam_role_arn'] = self.iam_role_arn if self.instance_profile_arn is not None: body['instance_profile_arn'] = self.instance_profile_arn @@ -2570,7 +4144,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InstanceProfile': + def from_dict(cls, d: Dict[str, any]) -> InstanceProfile: + """Deserializes the InstanceProfile from a dictionary.""" return cls(iam_role_arn=d.get('iam_role_arn', None), instance_profile_arn=d.get('instance_profile_arn', None), is_meta_instance_profile=d.get('is_meta_instance_profile', None)) @@ -2585,14 +4160,35 @@ class Language(Enum): @dataclass class Library: - cran: Optional['RCranLibrary'] = None + cran: Optional[RCranLibrary] = None + """Specification of a CRAN library to be installed as part of the library""" + egg: Optional[str] = None + """URI of the egg to be installed. Currently only DBFS and S3 URIs are supported. For example: `{ + "egg": "dbfs:/my/egg" }` or `{ "egg": "s3://my-bucket/egg" }`. If S3 is used, please make sure + the cluster has read access on the library. You may need to launch the cluster with an IAM role + to access the S3 URI.""" + jar: Optional[str] = None - maven: Optional['MavenLibrary'] = None - pypi: Optional['PythonPyPiLibrary'] = None + """URI of the jar to be installed. Currently only DBFS and S3 URIs are supported. For example: `{ + "jar": "dbfs:/mnt/databricks/library.jar" }` or `{ "jar": "s3://my-bucket/library.jar" }`. If S3 + is used, please make sure the cluster has read access on the library. You may need to launch the + cluster with an IAM role to access the S3 URI.""" + + maven: Optional[MavenLibrary] = None + """Specification of a maven library to be installed. For example: `{ "coordinates": + "org.jsoup:jsoup:1.7.2" }`""" + + pypi: Optional[PythonPyPiLibrary] = None + """Specification of a PyPi library to be installed. For example: `{ "package": "simplejson" }`""" + whl: Optional[str] = None + """URI of the wheel to be installed. For example: `{ "whl": "dbfs:/my/whl" }` or `{ "whl": + "s3://my-bucket/whl" }`. If S3 is used, please make sure the cluster has read access on the + library. You may need to launch the cluster with an IAM role to access the S3 URI.""" def as_dict(self) -> dict: + """Serializes the Library into a dictionary suitable for use as a JSON request body.""" body = {} if self.cran: body['cran'] = self.cran.as_dict() if self.egg is not None: body['egg'] = self.egg @@ -2603,7 +4199,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Library': + def from_dict(cls, d: Dict[str, any]) -> Library: + """Deserializes the Library from a dictionary.""" return cls(cran=_from_dict(d, 'cran', RCranLibrary), egg=d.get('egg', None), jar=d.get('jar', None), @@ -2615,11 +4212,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'Library': @dataclass class LibraryFullStatus: is_library_for_all_clusters: Optional[bool] = None - library: Optional['Library'] = None - messages: Optional['List[str]'] = None - status: Optional['LibraryFullStatusStatus'] = None + """Whether the library was set to be installed on all clusters via the libraries UI.""" + + library: Optional[Library] = None + """Unique identifier for the library.""" + + messages: Optional[List[str]] = None + """All the info and warning messages that have occurred so far for this library.""" + + status: Optional[LibraryFullStatusStatus] = None + """Status of installing the library on the cluster.""" def as_dict(self) -> dict: + """Serializes the LibraryFullStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.is_library_for_all_clusters is not None: body['is_library_for_all_clusters'] = self.is_library_for_all_clusters @@ -2629,7 +4234,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LibraryFullStatus': + def from_dict(cls, d: Dict[str, any]) -> LibraryFullStatus: + """Deserializes the LibraryFullStatus from a dictionary.""" return cls(is_library_for_all_clusters=d.get('is_library_for_all_clusters', None), library=_from_dict(d, 'library', Library), messages=d.get('messages', None), @@ -2650,131 +4256,161 @@ class LibraryFullStatusStatus(Enum): @dataclass class ListAllClusterLibraryStatusesResponse: - statuses: Optional['List[ClusterLibraryStatuses]'] = None + statuses: Optional[List[ClusterLibraryStatuses]] = None + """A list of cluster statuses.""" def as_dict(self) -> dict: + """Serializes the ListAllClusterLibraryStatusesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.statuses: body['statuses'] = [v.as_dict() for v in self.statuses] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListAllClusterLibraryStatusesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListAllClusterLibraryStatusesResponse: + """Deserializes the ListAllClusterLibraryStatusesResponse from a dictionary.""" return cls(statuses=_repeated_dict(d, 'statuses', ClusterLibraryStatuses)) @dataclass class ListAvailableZonesResponse: default_zone: Optional[str] = None - zones: Optional['List[str]'] = None + """The availability zone if no `zone_id` is provided in the cluster creation request.""" + + zones: Optional[List[str]] = None + """The list of available zones (e.g., ['us-west-2c', 'us-east-2']).""" def as_dict(self) -> dict: + """Serializes the ListAvailableZonesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.default_zone is not None: body['default_zone'] = self.default_zone if self.zones: body['zones'] = [v for v in self.zones] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListAvailableZonesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListAvailableZonesResponse: + """Deserializes the ListAvailableZonesResponse from a dictionary.""" return cls(default_zone=d.get('default_zone', None), zones=d.get('zones', None)) @dataclass class ListClustersResponse: - clusters: Optional['List[ClusterDetails]'] = None + clusters: Optional[List[ClusterDetails]] = None + """""" def as_dict(self) -> dict: + """Serializes the ListClustersResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.clusters: body['clusters'] = [v.as_dict() for v in self.clusters] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListClustersResponse': + def from_dict(cls, d: Dict[str, any]) -> ListClustersResponse: + """Deserializes the ListClustersResponse from a dictionary.""" return cls(clusters=_repeated_dict(d, 'clusters', ClusterDetails)) @dataclass class ListGlobalInitScriptsResponse: - scripts: Optional['List[GlobalInitScriptDetails]'] = None + scripts: Optional[List[GlobalInitScriptDetails]] = None def as_dict(self) -> dict: + """Serializes the ListGlobalInitScriptsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.scripts: body['scripts'] = [v.as_dict() for v in self.scripts] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListGlobalInitScriptsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListGlobalInitScriptsResponse: + """Deserializes the ListGlobalInitScriptsResponse from a dictionary.""" return cls(scripts=_repeated_dict(d, 'scripts', GlobalInitScriptDetails)) @dataclass class ListInstancePools: - instance_pools: Optional['List[InstancePoolAndStats]'] = None + instance_pools: Optional[List[InstancePoolAndStats]] = None def as_dict(self) -> dict: + """Serializes the ListInstancePools into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_pools: body['instance_pools'] = [v.as_dict() for v in self.instance_pools] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListInstancePools': + def from_dict(cls, d: Dict[str, any]) -> ListInstancePools: + """Deserializes the ListInstancePools from a dictionary.""" return cls(instance_pools=_repeated_dict(d, 'instance_pools', InstancePoolAndStats)) @dataclass class ListInstanceProfilesResponse: - instance_profiles: Optional['List[InstanceProfile]'] = None + instance_profiles: Optional[List[InstanceProfile]] = None + """A list of instance profiles that the user can access.""" def as_dict(self) -> dict: + """Serializes the ListInstanceProfilesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_profiles: body['instance_profiles'] = [v.as_dict() for v in self.instance_profiles] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListInstanceProfilesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListInstanceProfilesResponse: + """Deserializes the ListInstanceProfilesResponse from a dictionary.""" return cls(instance_profiles=_repeated_dict(d, 'instance_profiles', InstanceProfile)) @dataclass class ListNodeTypesResponse: - node_types: Optional['List[NodeType]'] = None + node_types: Optional[List[NodeType]] = None + """The list of available Spark node types.""" def as_dict(self) -> dict: + """Serializes the ListNodeTypesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.node_types: body['node_types'] = [v.as_dict() for v in self.node_types] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListNodeTypesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListNodeTypesResponse: + """Deserializes the ListNodeTypesResponse from a dictionary.""" return cls(node_types=_repeated_dict(d, 'node_types', NodeType)) @dataclass class ListPoliciesResponse: - policies: Optional['List[Policy]'] = None + policies: Optional[List[Policy]] = None + """List of policies.""" def as_dict(self) -> dict: + """Serializes the ListPoliciesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.policies: body['policies'] = [v.as_dict() for v in self.policies] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListPoliciesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListPoliciesResponse: + """Deserializes the ListPoliciesResponse from a dictionary.""" return cls(policies=_repeated_dict(d, 'policies', Policy)) @dataclass class ListPolicyFamiliesResponse: - policy_families: 'List[PolicyFamily]' + policy_families: List[PolicyFamily] + """List of policy families.""" + next_page_token: Optional[str] = None + """A token that can be used to get the next page of results. If not present, there are no more + results to show.""" def as_dict(self) -> dict: + """Serializes the ListPolicyFamiliesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.policy_families: body['policy_families'] = [v.as_dict() for v in self.policy_families] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListPolicyFamiliesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListPolicyFamiliesResponse: + """Deserializes the ListPolicyFamiliesResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), policy_families=_repeated_dict(d, 'policy_families', PolicyFamily)) @@ -2794,23 +4430,30 @@ class ListSortOrder(Enum): @dataclass class LocalFileInfo: destination: Optional[str] = None + """local file destination, e.g. `file:/my/local/file.sh`""" def as_dict(self) -> dict: + """Serializes the LocalFileInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.destination is not None: body['destination'] = self.destination return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LocalFileInfo': + def from_dict(cls, d: Dict[str, any]) -> LocalFileInfo: + """Deserializes the LocalFileInfo from a dictionary.""" return cls(destination=d.get('destination', None)) @dataclass class LogAnalyticsInfo: log_analytics_primary_key: Optional[str] = None + """""" + log_analytics_workspace_id: Optional[str] = None + """""" def as_dict(self) -> dict: + """Serializes the LogAnalyticsInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.log_analytics_primary_key is not None: body['log_analytics_primary_key'] = self.log_analytics_primary_key @@ -2819,7 +4462,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogAnalyticsInfo': + def from_dict(cls, d: Dict[str, any]) -> LogAnalyticsInfo: + """Deserializes the LogAnalyticsInfo from a dictionary.""" return cls(log_analytics_primary_key=d.get('log_analytics_primary_key', None), log_analytics_workspace_id=d.get('log_analytics_workspace_id', None)) @@ -2827,26 +4471,43 @@ def from_dict(cls, d: Dict[str, any]) -> 'LogAnalyticsInfo': @dataclass class LogSyncStatus: last_attempted: Optional[int] = None + """The timestamp of last attempt. If the last attempt fails, `last_exception` will contain the + exception in the last attempt.""" + last_exception: Optional[str] = None + """The exception thrown in the last attempt, it would be null (omitted in the response) if there is + no exception in last attempted.""" def as_dict(self) -> dict: + """Serializes the LogSyncStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.last_attempted is not None: body['last_attempted'] = self.last_attempted if self.last_exception is not None: body['last_exception'] = self.last_exception return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogSyncStatus': + def from_dict(cls, d: Dict[str, any]) -> LogSyncStatus: + """Deserializes the LogSyncStatus from a dictionary.""" return cls(last_attempted=d.get('last_attempted', None), last_exception=d.get('last_exception', None)) @dataclass class MavenLibrary: coordinates: str - exclusions: Optional['List[str]'] = None + """Gradle-style maven coordinates. For example: "org.jsoup:jsoup:1.7.2".""" + + exclusions: Optional[List[str]] = None + """List of dependences to exclude. For example: `["slf4j:slf4j", "*:hadoop-client"]`. + + Maven dependency exclusions: + https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html.""" + repo: Optional[str] = None + """Maven repo to install the Maven package from. If omitted, both Maven Central Repository and + Spark Packages are searched.""" def as_dict(self) -> dict: + """Serializes the MavenLibrary into a dictionary suitable for use as a JSON request body.""" body = {} if self.coordinates is not None: body['coordinates'] = self.coordinates if self.exclusions: body['exclusions'] = [v for v in self.exclusions] @@ -2854,7 +4515,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'MavenLibrary': + def from_dict(cls, d: Dict[str, any]) -> MavenLibrary: + """Deserializes the MavenLibrary from a dictionary.""" return cls(coordinates=d.get('coordinates', None), exclusions=d.get('exclusions', None), repo=d.get('repo', None)) @@ -2863,12 +4525,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'MavenLibrary': @dataclass class NodeInstanceType: instance_type_id: Optional[str] = None + local_disk_size_gb: Optional[int] = None + local_disks: Optional[int] = None + local_nvme_disk_size_gb: Optional[int] = None + local_nvme_disks: Optional[int] = None def as_dict(self) -> dict: + """Serializes the NodeInstanceType into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_type_id is not None: body['instance_type_id'] = self.instance_type_id if self.local_disk_size_gb is not None: body['local_disk_size_gb'] = self.local_disk_size_gb @@ -2879,7 +4546,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NodeInstanceType': + def from_dict(cls, d: Dict[str, any]) -> NodeInstanceType: + """Deserializes the NodeInstanceType from a dictionary.""" return cls(instance_type_id=d.get('instance_type_id', None), local_disk_size_gb=d.get('local_disk_size_gb', None), local_disks=d.get('local_disks', None), @@ -2890,28 +4558,61 @@ def from_dict(cls, d: Dict[str, any]) -> 'NodeInstanceType': @dataclass class NodeType: node_type_id: str + """Unique identifier for this node type.""" + memory_mb: int + """Memory (in MB) available for this node type.""" + num_cores: float + """Number of CPU cores available for this node type. Note that this can be fractional, e.g., 2.5 + cores, if the the number of cores on a machine instance is not divisible by the number of Spark + nodes on that machine.""" + description: str + """A string description associated with this node type, e.g., "r3.xlarge".""" + instance_type_id: str + """An identifier for the type of hardware that this node runs on, e.g., "r3.2xlarge" in AWS.""" + category: Optional[str] = None + display_order: Optional[int] = None + is_deprecated: Optional[bool] = None + """Whether the node type is deprecated. Non-deprecated node types offer greater performance.""" + is_encrypted_in_transit: Optional[bool] = None + """AWS specific, whether this instance supports encryption in transit, used for hipaa and pci + workloads.""" + is_graviton: Optional[bool] = None + is_hidden: Optional[bool] = None + is_io_cache_enabled: Optional[bool] = None - node_info: Optional['CloudProviderNodeInfo'] = None - node_instance_type: Optional['NodeInstanceType'] = None + + node_info: Optional[CloudProviderNodeInfo] = None + + node_instance_type: Optional[NodeInstanceType] = None + num_gpus: Optional[int] = None + photon_driver_capable: Optional[bool] = None + photon_worker_capable: Optional[bool] = None + support_cluster_tags: Optional[bool] = None + support_ebs_volumes: Optional[bool] = None + support_port_forwarding: Optional[bool] = None + supports_elastic_disk: Optional[bool] = None + """Indicates if this node type can be used for an instance pool or cluster with elastic disk + enabled. This is true for most node types.""" def as_dict(self) -> dict: + """Serializes the NodeType into a dictionary suitable for use as a JSON request body.""" body = {} if self.category is not None: body['category'] = self.category if self.description is not None: body['description'] = self.description @@ -2939,7 +4640,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NodeType': + def from_dict(cls, d: Dict[str, any]) -> NodeType: + """Deserializes the NodeType from a dictionary.""" return cls(category=d.get('category', None), description=d.get('description', None), display_order=d.get('display_order', None), @@ -2966,62 +4668,105 @@ def from_dict(cls, d: Dict[str, any]) -> 'NodeType': @dataclass class PendingInstanceError: instance_id: Optional[str] = None + message: Optional[str] = None def as_dict(self) -> dict: + """Serializes the PendingInstanceError into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_id is not None: body['instance_id'] = self.instance_id if self.message is not None: body['message'] = self.message return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PendingInstanceError': + def from_dict(cls, d: Dict[str, any]) -> PendingInstanceError: + """Deserializes the PendingInstanceError from a dictionary.""" return cls(instance_id=d.get('instance_id', None), message=d.get('message', None)) @dataclass class PermanentDeleteCluster: cluster_id: str + """The cluster to be deleted.""" def as_dict(self) -> dict: + """Serializes the PermanentDeleteCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermanentDeleteCluster': + def from_dict(cls, d: Dict[str, any]) -> PermanentDeleteCluster: + """Deserializes the PermanentDeleteCluster from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None)) @dataclass class PinCluster: cluster_id: str + """""" def as_dict(self) -> dict: + """Serializes the PinCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PinCluster': + def from_dict(cls, d: Dict[str, any]) -> PinCluster: + """Deserializes the PinCluster from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None)) @dataclass class Policy: created_at_timestamp: Optional[int] = None + """Creation time. The timestamp (in millisecond) when this Cluster Policy was created.""" + creator_user_name: Optional[str] = None + """Creator user name. The field won't be included in the response if the user has already been + deleted.""" + definition: Optional[str] = None + """Policy definition document expressed in [Databricks Cluster Policy Definition Language]. + + [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" + description: Optional[str] = None + """Additional human-readable description of the cluster policy.""" + is_default: Optional[bool] = None - libraries: Optional['List[Library]'] = None + """If true, policy is a default policy created and managed by . Default policies cannot + be deleted, and their policy families cannot be changed.""" + + libraries: Optional[List[Library]] = None + """A list of libraries to be installed on the next cluster restart that uses this policy.""" + max_clusters_per_user: Optional[int] = None + """Max number of clusters per user that can be active using this policy. If not present, there is + no max limit.""" + name: Optional[str] = None + """Cluster Policy name requested by the user. This has to be unique. Length must be between 1 and + 100 characters.""" + policy_family_definition_overrides: Optional[str] = None + """Policy definition JSON document expressed in [Databricks Policy Definition Language]. The JSON + document must be passed as a string and cannot be embedded in the requests. + + You can use this to customize the policy definition inherited from the policy family. Policy + rules specified here are merged into the inherited policy definition. + + [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" + policy_family_id: Optional[str] = None + """ID of the policy family.""" + policy_id: Optional[str] = None + """Canonical unique identifier for the Cluster Policy.""" def as_dict(self) -> dict: + """Serializes the Policy into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at_timestamp is not None: body['created_at_timestamp'] = self.created_at_timestamp if self.creator_user_name is not None: body['creator_user_name'] = self.creator_user_name @@ -3038,7 +4783,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Policy': + def from_dict(cls, d: Dict[str, any]) -> Policy: + """Deserializes the Policy from a dictionary.""" return cls(created_at_timestamp=d.get('created_at_timestamp', None), creator_user_name=d.get('creator_user_name', None), definition=d.get('definition', None), @@ -3055,11 +4801,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'Policy': @dataclass class PolicyFamily: policy_family_id: str + """ID of the policy family.""" + name: str + """Name of the policy family.""" + description: str + """Human-readable description of the purpose of the policy family.""" + definition: str + """Policy definition document expressed in [Databricks Cluster Policy Definition Language]. + + [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html""" def as_dict(self) -> dict: + """Serializes the PolicyFamily into a dictionary suitable for use as a JSON request body.""" body = {} if self.definition is not None: body['definition'] = self.definition if self.description is not None: body['description'] = self.description @@ -3068,7 +4824,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PolicyFamily': + def from_dict(cls, d: Dict[str, any]) -> PolicyFamily: + """Deserializes the PolicyFamily from a dictionary.""" return cls(definition=d.get('definition', None), description=d.get('description', None), name=d.get('name', None), @@ -3078,56 +4835,84 @@ def from_dict(cls, d: Dict[str, any]) -> 'PolicyFamily': @dataclass class PythonPyPiLibrary: package: str + """The name of the pypi package to install. An optional exact version specification is also + supported. Examples: "simplejson" and "simplejson==3.8.0".""" + repo: Optional[str] = None + """The repository where the package can be found. If not specified, the default pip index is used.""" def as_dict(self) -> dict: + """Serializes the PythonPyPiLibrary into a dictionary suitable for use as a JSON request body.""" body = {} if self.package is not None: body['package'] = self.package if self.repo is not None: body['repo'] = self.repo return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PythonPyPiLibrary': + def from_dict(cls, d: Dict[str, any]) -> PythonPyPiLibrary: + """Deserializes the PythonPyPiLibrary from a dictionary.""" return cls(package=d.get('package', None), repo=d.get('repo', None)) @dataclass class RCranLibrary: package: str + """The name of the CRAN package to install.""" + repo: Optional[str] = None + """The repository where the package can be found. If not specified, the default CRAN repo is used.""" def as_dict(self) -> dict: + """Serializes the RCranLibrary into a dictionary suitable for use as a JSON request body.""" body = {} if self.package is not None: body['package'] = self.package if self.repo is not None: body['repo'] = self.repo return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RCranLibrary': + def from_dict(cls, d: Dict[str, any]) -> RCranLibrary: + """Deserializes the RCranLibrary from a dictionary.""" return cls(package=d.get('package', None), repo=d.get('repo', None)) @dataclass class RemoveInstanceProfile: instance_profile_arn: str + """The ARN of the instance profile to remove. This field is required.""" def as_dict(self) -> dict: + """Serializes the RemoveInstanceProfile into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance_profile_arn is not None: body['instance_profile_arn'] = self.instance_profile_arn return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RemoveInstanceProfile': + def from_dict(cls, d: Dict[str, any]) -> RemoveInstanceProfile: + """Deserializes the RemoveInstanceProfile from a dictionary.""" return cls(instance_profile_arn=d.get('instance_profile_arn', None)) @dataclass class ResizeCluster: cluster_id: str - autoscale: Optional['AutoScale'] = None + """The cluster to be resized.""" + + autoscale: Optional[AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" def as_dict(self) -> dict: + """Serializes the ResizeCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.autoscale: body['autoscale'] = self.autoscale.as_dict() if self.cluster_id is not None: body['cluster_id'] = self.cluster_id @@ -3135,7 +4920,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResizeCluster': + def from_dict(cls, d: Dict[str, any]) -> ResizeCluster: + """Deserializes the ResizeCluster from a dictionary.""" return cls(autoscale=_from_dict(d, 'autoscale', AutoScale), cluster_id=d.get('cluster_id', None), num_workers=d.get('num_workers', None)) @@ -3144,16 +4930,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'ResizeCluster': @dataclass class RestartCluster: cluster_id: str + """The cluster to be started.""" + restart_user: Optional[str] = None + """""" def as_dict(self) -> dict: + """Serializes the RestartCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.restart_user is not None: body['restart_user'] = self.restart_user return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RestartCluster': + def from_dict(cls, d: Dict[str, any]) -> RestartCluster: + """Deserializes the RestartCluster from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), restart_user=d.get('restart_user', None)) @@ -3169,17 +4960,34 @@ class ResultType(Enum): @dataclass class Results: cause: Optional[str] = None + """The cause of the error""" + data: Optional[Any] = None + file_name: Optional[str] = None - file_names: Optional['List[str]'] = None + """The image filename""" + + file_names: Optional[List[str]] = None + is_json_schema: Optional[bool] = None + """true if a JSON schema is returned instead of a string representation of the Hive type.""" + pos: Optional[int] = None - result_type: Optional['ResultType'] = None - schema: Optional['List[Dict[str,Any]]'] = None + """internal field used by SDK""" + + result_type: Optional[ResultType] = None + + schema: Optional[List[Dict[str, Any]]] = None + """The table schema""" + summary: Optional[str] = None + """The summary of the error""" + truncated: Optional[bool] = None + """true if partial results are returned.""" def as_dict(self) -> dict: + """Serializes the Results into a dictionary suitable for use as a JSON request body.""" body = {} if self.cause is not None: body['cause'] = self.cause if self.data: body['data'] = self.data @@ -3194,7 +5002,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Results': + def from_dict(cls, d: Dict[str, any]) -> Results: + """Deserializes the Results from a dictionary.""" return cls(cause=d.get('cause', None), data=d.get('data', None), file_name=d.get('fileName', None), @@ -3219,14 +5028,40 @@ class RuntimeEngine(Enum): @dataclass class S3StorageInfo: canned_acl: Optional[str] = None + """(Optional) Set canned access control list for the logs, e.g. `bucket-owner-full-control`. If + `canned_cal` is set, please make sure the cluster iam role has `s3:PutObjectAcl` permission on + the destination bucket and prefix. The full list of possible canned acl can be found at + http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl. Please also note + that by default only the object owner gets full controls. If you are using cross account role + for writing data, you may want to set `bucket-owner-full-control` to make bucket owner able to + read the logs.""" + destination: Optional[str] = None + """S3 destination, e.g. `s3://my-bucket/some-prefix` Note that logs will be delivered using cluster + iam role, please make sure you set cluster iam role and the role has write access to the + destination. Please also note that you cannot use AWS keys to deliver logs.""" + enable_encryption: Optional[bool] = None + """(Optional) Flag to enable server side encryption, `false` by default.""" + encryption_type: Optional[str] = None + """(Optional) The encryption type, it could be `sse-s3` or `sse-kms`. It will be used only when + encryption is enabled and the default type is `sse-s3`.""" + endpoint: Optional[str] = None + """S3 endpoint, e.g. `https://s3-us-west-2.amazonaws.com`. Either region or endpoint needs to be + set. If both are set, endpoint will be used.""" + kms_key: Optional[str] = None + """(Optional) Kms key which will be used if encryption is enabled and encryption type is set to + `sse-kms`.""" + region: Optional[str] = None + """S3 region, e.g. `us-west-2`. Either region or endpoint needs to be set. If both are set, + endpoint will be used.""" def as_dict(self) -> dict: + """Serializes the S3StorageInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.canned_acl is not None: body['canned_acl'] = self.canned_acl if self.destination is not None: body['destination'] = self.destination @@ -3238,7 +5073,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'S3StorageInfo': + def from_dict(cls, d: Dict[str, any]) -> S3StorageInfo: + """Deserializes the S3StorageInfo from a dictionary.""" return cls(canned_acl=d.get('canned_acl', None), destination=d.get('destination', None), enable_encryption=d.get('enable_encryption', None), @@ -3251,14 +5087,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'S3StorageInfo': @dataclass class SparkNode: host_private_ip: Optional[str] = None + """The private IP address of the host instance.""" + instance_id: Optional[str] = None - node_aws_attributes: Optional['SparkNodeAwsAttributes'] = None + """Globally unique identifier for the host instance from the cloud provider.""" + + node_aws_attributes: Optional[SparkNodeAwsAttributes] = None + """Attributes specific to AWS for a Spark node.""" + node_id: Optional[str] = None + """Globally unique identifier for this node.""" + private_ip: Optional[str] = None + """Private IP address (typically a 10.x.x.x address) of the Spark node. Note that this is different + from the private IP address of the host instance.""" + public_dns: Optional[str] = None + """Public DNS address of this node. This address can be used to access the Spark JDBC server on the + driver node. To communicate with the JDBC server, traffic must be manually authorized by adding + security group rules to the "worker-unmanaged" security group via the AWS console. + + Actually it's the public DNS address of the host instance.""" + start_timestamp: Optional[int] = None + """The timestamp (in millisecond) when the Spark node is launched. + + The start_timestamp is set right before the container is being launched. The timestamp when the + container is placed on the ResourceManager, before its launch and setup by the NodeDaemon. This + timestamp is the same as the creation timestamp in the database.""" def as_dict(self) -> dict: + """Serializes the SparkNode into a dictionary suitable for use as a JSON request body.""" body = {} if self.host_private_ip is not None: body['host_private_ip'] = self.host_private_ip if self.instance_id is not None: body['instance_id'] = self.instance_id @@ -3270,7 +5129,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparkNode': + def from_dict(cls, d: Dict[str, any]) -> SparkNode: + """Deserializes the SparkNode from a dictionary.""" return cls(host_private_ip=d.get('host_private_ip', None), instance_id=d.get('instance_id', None), node_aws_attributes=_from_dict(d, 'node_aws_attributes', SparkNodeAwsAttributes), @@ -3283,44 +5143,58 @@ def from_dict(cls, d: Dict[str, any]) -> 'SparkNode': @dataclass class SparkNodeAwsAttributes: is_spot: Optional[bool] = None + """Whether this node is on an Amazon spot instance.""" def as_dict(self) -> dict: + """Serializes the SparkNodeAwsAttributes into a dictionary suitable for use as a JSON request body.""" body = {} if self.is_spot is not None: body['is_spot'] = self.is_spot return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparkNodeAwsAttributes': + def from_dict(cls, d: Dict[str, any]) -> SparkNodeAwsAttributes: + """Deserializes the SparkNodeAwsAttributes from a dictionary.""" return cls(is_spot=d.get('is_spot', None)) @dataclass class SparkVersion: key: Optional[str] = None + """Spark version key, for example "2.1.x-scala2.11". This is the value which should be provided as + the "spark_version" when creating a new cluster. Note that the exact Spark version may change + over time for a "wildcard" version (i.e., "2.1.x-scala2.11" is a "wildcard" version) with minor + bug fixes.""" + name: Optional[str] = None + """A descriptive name for this Spark version, for example "Spark 2.1".""" def as_dict(self) -> dict: + """Serializes the SparkVersion into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparkVersion': + def from_dict(cls, d: Dict[str, any]) -> SparkVersion: + """Deserializes the SparkVersion from a dictionary.""" return cls(key=d.get('key', None), name=d.get('name', None)) @dataclass class StartCluster: cluster_id: str + """The cluster to be started.""" def as_dict(self) -> dict: + """Serializes the StartCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StartCluster': + def from_dict(cls, d: Dict[str, any]) -> StartCluster: + """Deserializes the StartCluster from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None)) @@ -3339,11 +5213,17 @@ class State(Enum): @dataclass class TerminationReason: - code: Optional['TerminationReasonCode'] = None - parameters: Optional['Dict[str,str]'] = None - type: Optional['TerminationReasonType'] = None + code: Optional[TerminationReasonCode] = None + """status code indicating why the cluster was terminated""" + + parameters: Optional[Dict[str, str]] = None + """list of parameters that provide additional information about why the cluster was terminated""" + + type: Optional[TerminationReasonType] = None + """type of the termination""" def as_dict(self) -> dict: + """Serializes the TerminationReason into a dictionary suitable for use as a JSON request body.""" body = {} if self.code is not None: body['code'] = self.code.value if self.parameters: body['parameters'] = self.parameters @@ -3351,7 +5231,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TerminationReason': + def from_dict(cls, d: Dict[str, any]) -> TerminationReason: + """Deserializes the TerminationReason from a dictionary.""" return cls(code=_enum(d, 'code', TerminationReasonCode), parameters=d.get('parameters', None), type=_enum(d, 'type', TerminationReasonType)) @@ -3453,72 +5334,89 @@ class TerminationReasonType(Enum): @dataclass class UninstallLibraries: cluster_id: str - libraries: 'List[Library]' + """Unique identifier for the cluster on which to uninstall these libraries.""" + + libraries: List[Library] + """The libraries to uninstall.""" def as_dict(self) -> dict: + """Serializes the UninstallLibraries into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.libraries: body['libraries'] = [v.as_dict() for v in self.libraries] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UninstallLibraries': + def from_dict(cls, d: Dict[str, any]) -> UninstallLibraries: + """Deserializes the UninstallLibraries from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), libraries=_repeated_dict(d, 'libraries', Library)) @dataclass class UnpinCluster: cluster_id: str + """""" def as_dict(self) -> dict: + """Serializes the UnpinCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UnpinCluster': + def from_dict(cls, d: Dict[str, any]) -> UnpinCluster: + """Deserializes the UnpinCluster from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None)) @dataclass class VolumesStorageInfo: destination: Optional[str] = None + """Unity Catalog Volumes file destination, e.g. `/Volumes/my-init.sh`""" def as_dict(self) -> dict: + """Serializes the VolumesStorageInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.destination is not None: body['destination'] = self.destination return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'VolumesStorageInfo': + def from_dict(cls, d: Dict[str, any]) -> VolumesStorageInfo: + """Deserializes the VolumesStorageInfo from a dictionary.""" return cls(destination=d.get('destination', None)) @dataclass class WorkloadType: - clients: Optional['ClientsTypes'] = None + clients: Optional[ClientsTypes] = None + """defined what type of clients can use the cluster. E.g. Notebooks, Jobs""" def as_dict(self) -> dict: + """Serializes the WorkloadType into a dictionary suitable for use as a JSON request body.""" body = {} if self.clients: body['clients'] = self.clients.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkloadType': + def from_dict(cls, d: Dict[str, any]) -> WorkloadType: + """Deserializes the WorkloadType from a dictionary.""" return cls(clients=_from_dict(d, 'clients', ClientsTypes)) @dataclass class WorkspaceStorageInfo: destination: Optional[str] = None + """workspace files destination, e.g. `/Users/user1@databricks.com/my-init.sh`""" def as_dict(self) -> dict: + """Serializes the WorkspaceStorageInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.destination is not None: body['destination'] = self.destination return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceStorageInfo': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceStorageInfo: + """Deserializes the WorkspaceStorageInfo from a dictionary.""" return cls(destination=d.get('destination', None)) @@ -3732,7 +5630,7 @@ def get_permissions(self, cluster_policy_id: str) -> ClusterPolicyPermissions: def list(self, *, sort_column: Optional[ListSortColumn] = None, - sort_order: Optional[ListSortOrder] = None) -> Iterator['Policy']: + sort_order: Optional[ListSortOrder] = None) -> Iterator[Policy]: """List cluster policies. Returns a list of policies accessible by the requesting user. @@ -4465,7 +6363,7 @@ def events(self, limit: Optional[int] = None, offset: Optional[int] = None, order: Optional[GetEventsOrder] = None, - start_time: Optional[int] = None) -> Iterator['ClusterEvent']: + start_time: Optional[int] = None) -> Iterator[ClusterEvent]: """List cluster activity events. Retrieves a list of events about the activity of a cluster. This API is paginated. If there are more @@ -4561,7 +6459,7 @@ def get_permissions(self, cluster_id: str) -> ClusterPermissions: res = self._api.do('GET', f'/api/2.0/permissions/clusters/{cluster_id}', headers=headers) return ClusterPermissions.from_dict(res) - def list(self, *, can_use_client: Optional[str] = None) -> Iterator['ClusterDetails']: + def list(self, *, can_use_client: Optional[str] = None) -> Iterator[ClusterDetails]: """List all clusters. Return information about all pinned clusters, active clusters, up to 200 of the most recently @@ -5189,7 +7087,7 @@ def get(self, script_id: str) -> GlobalInitScriptDetailsWithContent: res = self._api.do('GET', f'/api/2.0/global-init-scripts/{script_id}', headers=headers) return GlobalInitScriptDetailsWithContent.from_dict(res) - def list(self) -> Iterator['GlobalInitScriptDetails']: + def list(self) -> Iterator[GlobalInitScriptDetails]: """Get init scripts. Get a list of all global init scripts for this workspace. This returns all properties for each script @@ -5474,7 +7372,7 @@ def get_permissions(self, instance_pool_id: str) -> InstancePoolPermissions: res = self._api.do('GET', f'/api/2.0/permissions/instance-pools/{instance_pool_id}', headers=headers) return InstancePoolPermissions.from_dict(res) - def list(self) -> Iterator['InstancePoolAndStats']: + def list(self) -> Iterator[InstancePoolAndStats]: """List instance pool info. Gets a list of instance pools with their statistics. @@ -5639,7 +7537,7 @@ def edit(self, headers = {'Accept': 'application/json', 'Content-Type': 'application/json', } self._api.do('POST', '/api/2.0/instance-profiles/edit', body=body, headers=headers) - def list(self) -> Iterator['InstanceProfile']: + def list(self) -> Iterator[InstanceProfile]: """List available instance profiles. List the instance profiles that the calling user can use to launch a cluster. @@ -5708,7 +7606,7 @@ def all_cluster_statuses(self) -> ListAllClusterLibraryStatusesResponse: res = self._api.do('GET', '/api/2.0/libraries/all-cluster-statuses', headers=headers) return ListAllClusterLibraryStatusesResponse.from_dict(res) - def cluster_status(self, cluster_id: str) -> Iterator['LibraryFullStatus']: + def cluster_status(self, cluster_id: str) -> Iterator[LibraryFullStatus]: """Get status. Get the status of libraries on a cluster. A status will be available for all libraries installed on @@ -5811,7 +7709,7 @@ def get(self, policy_family_id: str) -> PolicyFamily: def list(self, *, max_results: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['PolicyFamily']: + page_token: Optional[str] = None) -> Iterator[PolicyFamily]: """List policy families. Retrieve a list of policy families. This API is paginated. diff --git a/databricks/sdk/service/files.py b/databricks/sdk/service/files.py index f8b840313..29fb916f2 100755 --- a/databricks/sdk/service/files.py +++ b/databricks/sdk/service/files.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from typing import BinaryIO, Dict, Iterator, List, Optional @@ -14,76 +16,99 @@ @dataclass class AddBlock: handle: int + """The handle on an open stream.""" + data: str + """The base64-encoded data to append to the stream. This has a limit of 1 MB.""" def as_dict(self) -> dict: + """Serializes the AddBlock into a dictionary suitable for use as a JSON request body.""" body = {} if self.data is not None: body['data'] = self.data if self.handle is not None: body['handle'] = self.handle return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AddBlock': + def from_dict(cls, d: Dict[str, any]) -> AddBlock: + """Deserializes the AddBlock from a dictionary.""" return cls(data=d.get('data', None), handle=d.get('handle', None)) @dataclass class Close: handle: int + """The handle on an open stream.""" def as_dict(self) -> dict: + """Serializes the Close into a dictionary suitable for use as a JSON request body.""" body = {} if self.handle is not None: body['handle'] = self.handle return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Close': + def from_dict(cls, d: Dict[str, any]) -> Close: + """Deserializes the Close from a dictionary.""" return cls(handle=d.get('handle', None)) @dataclass class Create: path: str + """The path of the new file. The path should be the absolute DBFS path.""" + overwrite: Optional[bool] = None + """The flag that specifies whether to overwrite existing file/files.""" def as_dict(self) -> dict: + """Serializes the Create into a dictionary suitable for use as a JSON request body.""" body = {} if self.overwrite is not None: body['overwrite'] = self.overwrite if self.path is not None: body['path'] = self.path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Create': + def from_dict(cls, d: Dict[str, any]) -> Create: + """Deserializes the Create from a dictionary.""" return cls(overwrite=d.get('overwrite', None), path=d.get('path', None)) @dataclass class CreateResponse: handle: Optional[int] = None + """Handle which should subsequently be passed into the AddBlock and Close calls when writing to a + file through a stream.""" def as_dict(self) -> dict: + """Serializes the CreateResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.handle is not None: body['handle'] = self.handle return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateResponse: + """Deserializes the CreateResponse from a dictionary.""" return cls(handle=d.get('handle', None)) @dataclass class Delete: path: str + """The path of the file or directory to delete. The path should be the absolute DBFS path.""" + recursive: Optional[bool] = None + """Whether or not to recursively delete the directory's contents. Deleting empty directories can be + done without providing the recursive flag.""" def as_dict(self) -> dict: + """Serializes the Delete into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path if self.recursive is not None: body['recursive'] = self.recursive return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Delete': + def from_dict(cls, d: Dict[str, any]) -> Delete: + """Deserializes the Delete from a dictionary.""" return cls(path=d.get('path', None), recursive=d.get('recursive', None)) @@ -95,11 +120,19 @@ class DownloadResponse: @dataclass class FileInfo: file_size: Optional[int] = None + """The length of the file in bytes. This field is omitted for directories.""" + is_dir: Optional[bool] = None + """True if the path is a directory.""" + modification_time: Optional[int] = None + """Last modification time of given file in milliseconds since epoch.""" + path: Optional[str] = None + """The absolute path of the file or directory.""" def as_dict(self) -> dict: + """Serializes the FileInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.file_size is not None: body['file_size'] = self.file_size if self.is_dir is not None: body['is_dir'] = self.is_dir @@ -108,7 +141,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FileInfo': + def from_dict(cls, d: Dict[str, any]) -> FileInfo: + """Deserializes the FileInfo from a dictionary.""" return cls(file_size=d.get('file_size', None), is_dir=d.get('is_dir', None), modification_time=d.get('modification_time', None), @@ -117,55 +151,72 @@ def from_dict(cls, d: Dict[str, any]) -> 'FileInfo': @dataclass class ListStatusResponse: - files: Optional['List[FileInfo]'] = None + files: Optional[List[FileInfo]] = None + """A list of FileInfo's that describe contents of directory or file. See example above.""" def as_dict(self) -> dict: + """Serializes the ListStatusResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.files: body['files'] = [v.as_dict() for v in self.files] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListStatusResponse': + def from_dict(cls, d: Dict[str, any]) -> ListStatusResponse: + """Deserializes the ListStatusResponse from a dictionary.""" return cls(files=_repeated_dict(d, 'files', FileInfo)) @dataclass class MkDirs: path: str + """The path of the new directory. The path should be the absolute DBFS path.""" def as_dict(self) -> dict: + """Serializes the MkDirs into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'MkDirs': + def from_dict(cls, d: Dict[str, any]) -> MkDirs: + """Deserializes the MkDirs from a dictionary.""" return cls(path=d.get('path', None)) @dataclass class Move: source_path: str + """The source path of the file or directory. The path should be the absolute DBFS path.""" + destination_path: str + """The destination path of the file or directory. The path should be the absolute DBFS path.""" def as_dict(self) -> dict: + """Serializes the Move into a dictionary suitable for use as a JSON request body.""" body = {} if self.destination_path is not None: body['destination_path'] = self.destination_path if self.source_path is not None: body['source_path'] = self.source_path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Move': + def from_dict(cls, d: Dict[str, any]) -> Move: + """Deserializes the Move from a dictionary.""" return cls(destination_path=d.get('destination_path', None), source_path=d.get('source_path', None)) @dataclass class Put: path: str + """The path of the new file. The path should be the absolute DBFS path.""" + contents: Optional[str] = None + """This parameter might be absent, and instead a posted file will be used.""" + overwrite: Optional[bool] = None + """The flag that specifies whether to overwrite existing file/files.""" def as_dict(self) -> dict: + """Serializes the Put into a dictionary suitable for use as a JSON request body.""" body = {} if self.contents is not None: body['contents'] = self.contents if self.overwrite is not None: body['overwrite'] = self.overwrite @@ -173,7 +224,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Put': + def from_dict(cls, d: Dict[str, any]) -> Put: + """Deserializes the Put from a dictionary.""" return cls(contents=d.get('contents', None), overwrite=d.get('overwrite', None), path=d.get('path', None)) @@ -182,16 +234,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'Put': @dataclass class ReadResponse: bytes_read: Optional[int] = None + """The number of bytes read (could be less than `length` if we hit end of file). This refers to + number of bytes read in unencoded version (response data is base64-encoded).""" + data: Optional[str] = None + """The base64-encoded contents of the file read.""" def as_dict(self) -> dict: + """Serializes the ReadResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.bytes_read is not None: body['bytes_read'] = self.bytes_read if self.data is not None: body['data'] = self.data return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ReadResponse': + def from_dict(cls, d: Dict[str, any]) -> ReadResponse: + """Deserializes the ReadResponse from a dictionary.""" return cls(bytes_read=d.get('bytes_read', None), data=d.get('data', None)) @@ -315,7 +373,7 @@ def get_status(self, path: str) -> FileInfo: res = self._api.do('GET', '/api/2.0/dbfs/get-status', query=query, headers=headers) return FileInfo.from_dict(res) - def list(self, path: str) -> Iterator['FileInfo']: + def list(self, path: str) -> Iterator[FileInfo]: """List directory contents or file details. List the contents of a directory, or details of the file. If the file or directory does not exist, diff --git a/databricks/sdk/service/iam.py b/databricks/sdk/service/iam.py index ecda45549..36a3cd061 100755 --- a/databricks/sdk/service/iam.py +++ b/databricks/sdk/service/iam.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -15,11 +17,20 @@ @dataclass class AccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['PermissionLevel'] = None + """name of the group""" + + permission_level: Optional[PermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the AccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -29,7 +40,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> AccessControlRequest: + """Deserializes the AccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', PermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -38,13 +50,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'AccessControlRequest': @dataclass class AccessControlResponse: - all_permissions: Optional['List[Permission]'] = None + all_permissions: Optional[List[Permission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the AccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -55,7 +77,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> AccessControlResponse: + """Deserializes the AccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', Permission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -66,11 +89,15 @@ def from_dict(cls, d: Dict[str, any]) -> 'AccessControlResponse': @dataclass class ComplexValue: display: Optional[str] = None + primary: Optional[bool] = None + type: Optional[str] = None + value: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ComplexValue into a dictionary suitable for use as a JSON request body.""" body = {} if self.display is not None: body['display'] = self.display if self.primary is not None: body['primary'] = self.primary @@ -79,7 +106,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ComplexValue': + def from_dict(cls, d: Dict[str, any]) -> ComplexValue: + """Deserializes the ComplexValue from a dictionary.""" return cls(display=d.get('display', None), primary=d.get('primary', None), type=d.get('type', None), @@ -88,43 +116,51 @@ def from_dict(cls, d: Dict[str, any]) -> 'ComplexValue': @dataclass class GetAssignableRolesForResourceResponse: - roles: Optional['List[Role]'] = None + roles: Optional[List[Role]] = None def as_dict(self) -> dict: + """Serializes the GetAssignableRolesForResourceResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.roles: body['roles'] = [v.as_dict() for v in self.roles] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetAssignableRolesForResourceResponse': + def from_dict(cls, d: Dict[str, any]) -> GetAssignableRolesForResourceResponse: + """Deserializes the GetAssignableRolesForResourceResponse from a dictionary.""" return cls(roles=_repeated_dict(d, 'roles', Role)) @dataclass class GetPasswordPermissionLevelsResponse: - permission_levels: Optional['List[PasswordPermissionsDescription]'] = None + permission_levels: Optional[List[PasswordPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetPasswordPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPasswordPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetPasswordPermissionLevelsResponse: + """Deserializes the GetPasswordPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', PasswordPermissionsDescription)) @dataclass class GetPermissionLevelsResponse: - permission_levels: Optional['List[PermissionsDescription]'] = None + permission_levels: Optional[List[PermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetPermissionLevelsResponse: + """Deserializes the GetPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', PermissionsDescription)) @@ -137,32 +173,55 @@ class GetSortOrder(Enum): @dataclass class GrantRule: role: str - principals: Optional['List[str]'] = None + """Role that is assigned to the list of principals.""" + + principals: Optional[List[str]] = None + """Principals this grant rule applies to.""" def as_dict(self) -> dict: + """Serializes the GrantRule into a dictionary suitable for use as a JSON request body.""" body = {} if self.principals: body['principals'] = [v for v in self.principals] if self.role is not None: body['role'] = self.role return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GrantRule': + def from_dict(cls, d: Dict[str, any]) -> GrantRule: + """Deserializes the GrantRule from a dictionary.""" return cls(principals=d.get('principals', None), role=d.get('role', None)) @dataclass class Group: display_name: Optional[str] = None - entitlements: Optional['List[ComplexValue]'] = None + """String that represents a human-readable group name""" + + entitlements: Optional[List[ComplexValue]] = None + """Entitlements assigned to the group. See [assigning entitlements] for a full list of supported + values. + + [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements""" + external_id: Optional[str] = None - groups: Optional['List[ComplexValue]'] = None + + groups: Optional[List[ComplexValue]] = None + id: Optional[str] = None - members: Optional['List[ComplexValue]'] = None - meta: Optional['ResourceMeta'] = None - roles: Optional['List[ComplexValue]'] = None - schemas: Optional['List[GroupSchema]'] = None + """Databricks group ID""" + + members: Optional[List[ComplexValue]] = None + + meta: Optional[ResourceMeta] = None + """Container for the group identifier. Workspace local versus account.""" + + roles: Optional[List[ComplexValue]] = None + """Corresponds to AWS instance profile/arn role.""" + + schemas: Optional[List[GroupSchema]] = None + """The schema of the group.""" def as_dict(self) -> dict: + """Serializes the Group into a dictionary suitable for use as a JSON request body.""" body = {} if self.display_name is not None: body['displayName'] = self.display_name if self.entitlements: body['entitlements'] = [v.as_dict() for v in self.entitlements] @@ -176,7 +235,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Group': + def from_dict(cls, d: Dict[str, any]) -> Group: + """Deserializes the Group from a dictionary.""" return cls(display_name=d.get('displayName', None), entitlements=_repeated_dict(d, 'entitlements', ComplexValue), external_id=d.get('externalId', None), @@ -196,12 +256,22 @@ class GroupSchema(Enum): @dataclass class ListGroupsResponse: items_per_page: Optional[int] = None - resources: Optional['List[Group]'] = None - schemas: Optional['List[ListResponseSchema]'] = None + """Total results returned in the response.""" + + resources: Optional[List[Group]] = None + """User objects returned in the response.""" + + schemas: Optional[List[ListResponseSchema]] = None + """The schema of the service principal.""" + start_index: Optional[int] = None + """Starting index of all the results that matched the request filters. First item is number 1.""" + total_results: Optional[int] = None + """Total results that match the request filters.""" def as_dict(self) -> dict: + """Serializes the ListGroupsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.items_per_page is not None: body['itemsPerPage'] = self.items_per_page if self.resources: body['Resources'] = [v.as_dict() for v in self.resources] @@ -211,7 +281,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListGroupsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListGroupsResponse: + """Deserializes the ListGroupsResponse from a dictionary.""" return cls(items_per_page=d.get('itemsPerPage', None), resources=_repeated_dict(d, 'Resources', Group), schemas=_repeated_enum(d, 'schemas', ListResponseSchema), @@ -227,12 +298,22 @@ class ListResponseSchema(Enum): @dataclass class ListServicePrincipalResponse: items_per_page: Optional[int] = None - resources: Optional['List[ServicePrincipal]'] = None - schemas: Optional['List[ListResponseSchema]'] = None + """Total results returned in the response.""" + + resources: Optional[List[ServicePrincipal]] = None + """User objects returned in the response.""" + + schemas: Optional[List[ListResponseSchema]] = None + """The schema of the List response.""" + start_index: Optional[int] = None + """Starting index of all the results that matched the request filters. First item is number 1.""" + total_results: Optional[int] = None + """Total results that match the request filters.""" def as_dict(self) -> dict: + """Serializes the ListServicePrincipalResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.items_per_page is not None: body['itemsPerPage'] = self.items_per_page if self.resources: body['Resources'] = [v.as_dict() for v in self.resources] @@ -242,7 +323,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListServicePrincipalResponse': + def from_dict(cls, d: Dict[str, any]) -> ListServicePrincipalResponse: + """Deserializes the ListServicePrincipalResponse from a dictionary.""" return cls(items_per_page=d.get('itemsPerPage', None), resources=_repeated_dict(d, 'Resources', ServicePrincipal), schemas=_repeated_enum(d, 'schemas', ListResponseSchema), @@ -259,12 +341,22 @@ class ListSortOrder(Enum): @dataclass class ListUsersResponse: items_per_page: Optional[int] = None - resources: Optional['List[User]'] = None - schemas: Optional['List[ListResponseSchema]'] = None + """Total results returned in the response.""" + + resources: Optional[List[User]] = None + """User objects returned in the response.""" + + schemas: Optional[List[ListResponseSchema]] = None + """The schema of the List response.""" + start_index: Optional[int] = None + """Starting index of all the results that matched the request filters. First item is number 1.""" + total_results: Optional[int] = None + """Total results that match the request filters.""" def as_dict(self) -> dict: + """Serializes the ListUsersResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.items_per_page is not None: body['itemsPerPage'] = self.items_per_page if self.resources: body['Resources'] = [v.as_dict() for v in self.resources] @@ -274,7 +366,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListUsersResponse': + def from_dict(cls, d: Dict[str, any]) -> ListUsersResponse: + """Deserializes the ListUsersResponse from a dictionary.""" return cls(items_per_page=d.get('itemsPerPage', None), resources=_repeated_dict(d, 'Resources', User), schemas=_repeated_enum(d, 'schemas', ListResponseSchema), @@ -285,26 +378,34 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListUsersResponse': @dataclass class Name: family_name: Optional[str] = None + """Family name of the Databricks user.""" + given_name: Optional[str] = None + """Given name of the Databricks user.""" def as_dict(self) -> dict: + """Serializes the Name into a dictionary suitable for use as a JSON request body.""" body = {} if self.family_name is not None: body['familyName'] = self.family_name if self.given_name is not None: body['givenName'] = self.given_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Name': + def from_dict(cls, d: Dict[str, any]) -> Name: + """Deserializes the Name from a dictionary.""" return cls(family_name=d.get('familyName', None), given_name=d.get('givenName', None)) @dataclass class ObjectPermissions: - access_control_list: Optional['List[AccessControlResponse]'] = None + access_control_list: Optional[List[AccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ObjectPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -313,7 +414,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ObjectPermissions': + def from_dict(cls, d: Dict[str, any]) -> ObjectPermissions: + """Deserializes the ObjectPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', AccessControlResponse), object_id=d.get('object_id', None), object_type=d.get('object_type', None)) @@ -322,10 +424,15 @@ def from_dict(cls, d: Dict[str, any]) -> 'ObjectPermissions': @dataclass class PartialUpdate: id: Optional[str] = None - operations: Optional['List[Patch]'] = None - schemas: Optional['List[PatchSchema]'] = None + """Unique ID for a user in the Databricks workspace.""" + + operations: Optional[List[Patch]] = None + + schemas: Optional[List[PatchSchema]] = None + """The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"].""" def as_dict(self) -> dict: + """Serializes the PartialUpdate into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id if self.operations: body['Operations'] = [v.as_dict() for v in self.operations] @@ -333,7 +440,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PartialUpdate': + def from_dict(cls, d: Dict[str, any]) -> PartialUpdate: + """Deserializes the PartialUpdate from a dictionary.""" return cls(id=d.get('id', None), operations=_repeated_dict(d, 'Operations', Patch), schemas=_repeated_enum(d, 'schemas', PatchSchema)) @@ -342,11 +450,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'PartialUpdate': @dataclass class PasswordAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['PasswordPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[PasswordPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the PasswordAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -356,7 +473,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PasswordAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> PasswordAccessControlRequest: + """Deserializes the PasswordAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', PasswordPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -365,13 +483,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'PasswordAccessControlRequest': @dataclass class PasswordAccessControlResponse: - all_permissions: Optional['List[PasswordPermission]'] = None + all_permissions: Optional[List[PasswordPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the PasswordAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -382,7 +510,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PasswordAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> PasswordAccessControlResponse: + """Deserializes the PasswordAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', PasswordPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -393,10 +522,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'PasswordAccessControlResponse': @dataclass class PasswordPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['PasswordPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[PasswordPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the PasswordPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -404,7 +537,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PasswordPermission': + def from_dict(cls, d: Dict[str, any]) -> PasswordPermission: + """Deserializes the PasswordPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', PasswordPermissionLevel)) @@ -418,11 +552,14 @@ class PasswordPermissionLevel(Enum): @dataclass class PasswordPermissions: - access_control_list: Optional['List[PasswordAccessControlResponse]'] = None + access_control_list: Optional[List[PasswordAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the PasswordPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -431,7 +568,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PasswordPermissions': + def from_dict(cls, d: Dict[str, any]) -> PasswordPermissions: + """Deserializes the PasswordPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', PasswordAccessControlResponse), object_id=d.get('object_id', None), @@ -441,42 +579,54 @@ def from_dict(cls, d: Dict[str, any]) -> 'PasswordPermissions': @dataclass class PasswordPermissionsDescription: description: Optional[str] = None - permission_level: Optional['PasswordPermissionLevel'] = None + + permission_level: Optional[PasswordPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the PasswordPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PasswordPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> PasswordPermissionsDescription: + """Deserializes the PasswordPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', PasswordPermissionLevel)) @dataclass class PasswordPermissionsRequest: - access_control_list: Optional['List[PasswordAccessControlRequest]'] = None + access_control_list: Optional[List[PasswordAccessControlRequest]] = None def as_dict(self) -> dict: + """Serializes the PasswordPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PasswordPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> PasswordPermissionsRequest: + """Deserializes the PasswordPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', PasswordAccessControlRequest)) @dataclass class Patch: - op: Optional['PatchOp'] = None + op: Optional[PatchOp] = None + """Type of patch operation.""" + path: Optional[str] = None + """Selection of patch operation""" + value: Optional[Any] = None + """Value to modify""" def as_dict(self) -> dict: + """Serializes the Patch into a dictionary suitable for use as a JSON request body.""" body = {} if self.op is not None: body['op'] = self.op.value if self.path is not None: body['path'] = self.path @@ -484,7 +634,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Patch': + def from_dict(cls, d: Dict[str, any]) -> Patch: + """Deserializes the Patch from a dictionary.""" return cls(op=_enum(d, 'op', PatchOp), path=d.get('path', None), value=d.get('value', None)) @@ -504,10 +655,14 @@ class PatchSchema(Enum): @dataclass class Permission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['PermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[PermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the Permission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -515,7 +670,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Permission': + def from_dict(cls, d: Dict[str, any]) -> Permission: + """Deserializes the Permission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', PermissionLevel)) @@ -524,10 +680,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'Permission': @dataclass class PermissionAssignment: error: Optional[str] = None - permissions: Optional['List[WorkspacePermission]'] = None - principal: Optional['PrincipalOutput'] = None + """Error response associated with a workspace permission assignment, if any.""" + + permissions: Optional[List[WorkspacePermission]] = None + """The permissions level of the principal.""" + + principal: Optional[PrincipalOutput] = None + """Information about the principal assigned to the workspace.""" def as_dict(self) -> dict: + """Serializes the PermissionAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.error is not None: body['error'] = self.error if self.permissions: body['permissions'] = [v.value for v in self.permissions] @@ -535,7 +697,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionAssignment': + def from_dict(cls, d: Dict[str, any]) -> PermissionAssignment: + """Deserializes the PermissionAssignment from a dictionary.""" return cls(error=d.get('error', None), permissions=_repeated_enum(d, 'permissions', WorkspacePermission), principal=_from_dict(d, 'principal', PrincipalOutput)) @@ -543,16 +706,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'PermissionAssignment': @dataclass class PermissionAssignments: - permission_assignments: Optional['List[PermissionAssignment]'] = None + permission_assignments: Optional[List[PermissionAssignment]] = None + """Array of permissions assignments defined for a workspace.""" def as_dict(self) -> dict: + """Serializes the PermissionAssignments into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_assignments: body['permission_assignments'] = [v.as_dict() for v in self.permission_assignments] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionAssignments': + def from_dict(cls, d: Dict[str, any]) -> PermissionAssignments: + """Deserializes the PermissionAssignments from a dictionary.""" return cls(permission_assignments=_repeated_dict(d, 'permission_assignments', PermissionAssignment)) @@ -579,16 +745,20 @@ class PermissionLevel(Enum): @dataclass class PermissionOutput: description: Optional[str] = None - permission_level: Optional['WorkspacePermission'] = None + """The results of a permissions query.""" + + permission_level: Optional[WorkspacePermission] = None def as_dict(self) -> dict: + """Serializes the PermissionOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionOutput': + def from_dict(cls, d: Dict[str, any]) -> PermissionOutput: + """Deserializes the PermissionOutput from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', WorkspacePermission)) @@ -596,27 +766,35 @@ def from_dict(cls, d: Dict[str, any]) -> 'PermissionOutput': @dataclass class PermissionsDescription: description: Optional[str] = None - permission_level: Optional['PermissionLevel'] = None + + permission_level: Optional[PermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the PermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> PermissionsDescription: + """Deserializes the PermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', PermissionLevel)) @dataclass class PermissionsRequest: - access_control_list: Optional['List[AccessControlRequest]'] = None + access_control_list: Optional[List[AccessControlRequest]] = None + request_object_id: Optional[str] = None + request_object_type: Optional[str] = None + """""" def as_dict(self) -> dict: + """Serializes the PermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -625,7 +803,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> PermissionsRequest: + """Deserializes the PermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', AccessControlRequest), request_object_id=d.get('request_object_id', None), request_object_type=d.get('request_object_type', None)) @@ -634,12 +813,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'PermissionsRequest': @dataclass class PrincipalOutput: display_name: Optional[str] = None + """The display name of the principal.""" + group_name: Optional[str] = None + """The group name of the groupl. Present only if the principal is a group.""" + principal_id: Optional[int] = None + """The unique, opaque id of the principal.""" + service_principal_name: Optional[str] = None + """The name of the service principal. Present only if the principal is a service principal.""" + user_name: Optional[str] = None + """The username of the user. Present only if the principal is a user.""" def as_dict(self) -> dict: + """Serializes the PrincipalOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.display_name is not None: body['display_name'] = self.display_name if self.group_name is not None: body['group_name'] = self.group_name @@ -650,7 +839,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PrincipalOutput': + def from_dict(cls, d: Dict[str, any]) -> PrincipalOutput: + """Deserializes the PrincipalOutput from a dictionary.""" return cls(display_name=d.get('display_name', None), group_name=d.get('group_name', None), principal_id=d.get('principal_id', None), @@ -661,38 +851,50 @@ def from_dict(cls, d: Dict[str, any]) -> 'PrincipalOutput': @dataclass class ResourceMeta: resource_type: Optional[str] = None + """Identifier for group type. Can be local workspace group (`WorkspaceGroup`) or account group + (`Group`).""" def as_dict(self) -> dict: + """Serializes the ResourceMeta into a dictionary suitable for use as a JSON request body.""" body = {} if self.resource_type is not None: body['resourceType'] = self.resource_type return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResourceMeta': + def from_dict(cls, d: Dict[str, any]) -> ResourceMeta: + """Deserializes the ResourceMeta from a dictionary.""" return cls(resource_type=d.get('resourceType', None)) @dataclass class Role: name: str + """Role to assign to a principal or a list of principals on a resource.""" def as_dict(self) -> dict: + """Serializes the Role into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Role': + def from_dict(cls, d: Dict[str, any]) -> Role: + """Deserializes the Role from a dictionary.""" return cls(name=d.get('name', None)) @dataclass class RuleSetResponse: etag: Optional[str] = None - grant_rules: Optional['List[GrantRule]'] = None + """Identifies the version of the rule set returned.""" + + grant_rules: Optional[List[GrantRule]] = None + name: Optional[str] = None + """Name of the rule set.""" def as_dict(self) -> dict: + """Serializes the RuleSetResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag if self.grant_rules: body['grant_rules'] = [v.as_dict() for v in self.grant_rules] @@ -700,7 +902,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RuleSetResponse': + def from_dict(cls, d: Dict[str, any]) -> RuleSetResponse: + """Deserializes the RuleSetResponse from a dictionary.""" return cls(etag=d.get('etag', None), grant_rules=_repeated_dict(d, 'grant_rules', GrantRule), name=d.get('name', None)) @@ -709,10 +912,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'RuleSetResponse': @dataclass class RuleSetUpdateRequest: name: str + """Name of the rule set.""" + etag: str - grant_rules: Optional['List[GrantRule]'] = None + """The expected etag of the rule set to update. The update will fail if the value does not match + the value that is stored in account access control service.""" + + grant_rules: Optional[List[GrantRule]] = None def as_dict(self) -> dict: + """Serializes the RuleSetUpdateRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag if self.grant_rules: body['grant_rules'] = [v.as_dict() for v in self.grant_rules] @@ -720,7 +929,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RuleSetUpdateRequest': + def from_dict(cls, d: Dict[str, any]) -> RuleSetUpdateRequest: + """Deserializes the RuleSetUpdateRequest from a dictionary.""" return cls(etag=d.get('etag', None), grant_rules=_repeated_dict(d, 'grant_rules', GrantRule), name=d.get('name', None)) @@ -729,16 +939,35 @@ def from_dict(cls, d: Dict[str, any]) -> 'RuleSetUpdateRequest': @dataclass class ServicePrincipal: active: Optional[bool] = None + """If this user is active""" + application_id: Optional[str] = None + """UUID relating to the service principal""" + display_name: Optional[str] = None - entitlements: Optional['List[ComplexValue]'] = None + """String that represents a concatenation of given and family names.""" + + entitlements: Optional[List[ComplexValue]] = None + """Entitlements assigned to the service principal. See [assigning entitlements] for a full list of + supported values. + + [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements""" + external_id: Optional[str] = None - groups: Optional['List[ComplexValue]'] = None + + groups: Optional[List[ComplexValue]] = None + id: Optional[str] = None - roles: Optional['List[ComplexValue]'] = None - schemas: Optional['List[ServicePrincipalSchema]'] = None + """Databricks service principal ID.""" + + roles: Optional[List[ComplexValue]] = None + """Corresponds to AWS instance profile/arn role.""" + + schemas: Optional[List[ServicePrincipalSchema]] = None + """The schema of the List response.""" def as_dict(self) -> dict: + """Serializes the ServicePrincipal into a dictionary suitable for use as a JSON request body.""" body = {} if self.active is not None: body['active'] = self.active if self.application_id is not None: body['applicationId'] = self.application_id @@ -752,7 +981,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServicePrincipal': + def from_dict(cls, d: Dict[str, any]) -> ServicePrincipal: + """Deserializes the ServicePrincipal from a dictionary.""" return cls(active=d.get('active', None), application_id=d.get('applicationId', None), display_name=d.get('displayName', None), @@ -772,26 +1002,36 @@ class ServicePrincipalSchema(Enum): @dataclass class UpdateRuleSetRequest: name: str - rule_set: 'RuleSetUpdateRequest' + """Name of the rule set.""" + + rule_set: RuleSetUpdateRequest def as_dict(self) -> dict: + """Serializes the UpdateRuleSetRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.rule_set: body['rule_set'] = self.rule_set.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRuleSetRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateRuleSetRequest: + """Deserializes the UpdateRuleSetRequest from a dictionary.""" return cls(name=d.get('name', None), rule_set=_from_dict(d, 'rule_set', RuleSetUpdateRequest)) @dataclass class UpdateWorkspaceAssignments: - permissions: 'List[WorkspacePermission]' + permissions: List[WorkspacePermission] + """Array of permissions assignments to update on the workspace.""" + principal_id: Optional[int] = None + """The ID of the user, service principal, or group.""" + workspace_id: Optional[int] = None + """The workspace ID.""" def as_dict(self) -> dict: + """Serializes the UpdateWorkspaceAssignments into a dictionary suitable for use as a JSON request body.""" body = {} if self.permissions: body['permissions'] = [v.value for v in self.permissions] if self.principal_id is not None: body['principal_id'] = self.principal_id @@ -799,7 +1039,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceAssignments': + def from_dict(cls, d: Dict[str, any]) -> UpdateWorkspaceAssignments: + """Deserializes the UpdateWorkspaceAssignments from a dictionary.""" return cls(permissions=_repeated_enum(d, 'permissions', WorkspacePermission), principal_id=d.get('principal_id', None), workspace_id=d.get('workspace_id', None)) @@ -808,18 +1049,46 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceAssignments': @dataclass class User: active: Optional[bool] = None + """If this user is active""" + display_name: Optional[str] = None - emails: Optional['List[ComplexValue]'] = None - entitlements: Optional['List[ComplexValue]'] = None + """String that represents a concatenation of given and family names. For example `John Smith`. This + field cannot be updated through the Workspace SCIM APIs when [identity federation is enabled]. + Use Account SCIM APIs to update `displayName`. + + [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation""" + + emails: Optional[List[ComplexValue]] = None + """All the emails associated with the Databricks user.""" + + entitlements: Optional[List[ComplexValue]] = None + """Entitlements assigned to the user. See [assigning entitlements] for a full list of supported + values. + + [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements""" + external_id: Optional[str] = None - groups: Optional['List[ComplexValue]'] = None + """External ID is not currently supported. It is reserved for future use.""" + + groups: Optional[List[ComplexValue]] = None + id: Optional[str] = None - name: Optional['Name'] = None - roles: Optional['List[ComplexValue]'] = None - schemas: Optional['List[UserSchema]'] = None + """Databricks user ID. This is automatically set by Databricks. Any value provided by the client + will be ignored.""" + + name: Optional[Name] = None + + roles: Optional[List[ComplexValue]] = None + """Corresponds to AWS instance profile/arn role.""" + + schemas: Optional[List[UserSchema]] = None + """The schema of the user.""" + user_name: Optional[str] = None + """Email address of the Databricks user.""" def as_dict(self) -> dict: + """Serializes the User into a dictionary suitable for use as a JSON request body.""" body = {} if self.active is not None: body['active'] = self.active if self.display_name is not None: body['displayName'] = self.display_name @@ -835,7 +1104,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'User': + def from_dict(cls, d: Dict[str, any]) -> User: + """Deserializes the User from a dictionary.""" return cls(active=d.get('active', None), display_name=d.get('displayName', None), emails=_repeated_dict(d, 'emails', ComplexValue), @@ -863,15 +1133,18 @@ class WorkspacePermission(Enum): @dataclass class WorkspacePermissions: - permissions: Optional['List[PermissionOutput]'] = None + permissions: Optional[List[PermissionOutput]] = None + """Array of permissions defined for a workspace.""" def as_dict(self) -> dict: + """Serializes the WorkspacePermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.permissions: body['permissions'] = [v.as_dict() for v in self.permissions] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspacePermissions': + def from_dict(cls, d: Dict[str, any]) -> WorkspacePermissions: + """Deserializes the WorkspacePermissions from a dictionary.""" return cls(permissions=_repeated_dict(d, 'permissions', PermissionOutput)) @@ -1143,7 +1416,7 @@ def list(self, filter: Optional[str] = None, sort_by: Optional[str] = None, sort_order: Optional[ListSortOrder] = None, - start_index: Optional[int] = None) -> Iterator['Group']: + start_index: Optional[int] = None) -> Iterator[Group]: """List group details. Gets all details of the groups associated with the Databricks account. @@ -1383,7 +1656,7 @@ def list(self, filter: Optional[str] = None, sort_by: Optional[str] = None, sort_order: Optional[ListSortOrder] = None, - start_index: Optional[int] = None) -> Iterator['ServicePrincipal']: + start_index: Optional[int] = None) -> Iterator[ServicePrincipal]: """List service principals. Gets the set of service principals associated with a Databricks account. @@ -1682,7 +1955,7 @@ def list(self, filter: Optional[str] = None, sort_by: Optional[str] = None, sort_order: Optional[ListSortOrder] = None, - start_index: Optional[int] = None) -> Iterator['User']: + start_index: Optional[int] = None) -> Iterator[User]: """List users. Gets details for all the users associated with a Databricks account. @@ -1948,7 +2221,7 @@ def list(self, filter: Optional[str] = None, sort_by: Optional[str] = None, sort_order: Optional[ListSortOrder] = None, - start_index: Optional[int] = None) -> Iterator['Group']: + start_index: Optional[int] = None) -> Iterator[Group]: """List group details. Gets all details of the groups associated with the Databricks workspace. @@ -2315,7 +2588,7 @@ def list(self, filter: Optional[str] = None, sort_by: Optional[str] = None, sort_order: Optional[ListSortOrder] = None, - start_index: Optional[int] = None) -> Iterator['ServicePrincipal']: + start_index: Optional[int] = None) -> Iterator[ServicePrincipal]: """List service principals. Gets the set of service principals associated with a Databricks workspace. @@ -2626,7 +2899,7 @@ def list(self, filter: Optional[str] = None, sort_by: Optional[str] = None, sort_order: Optional[ListSortOrder] = None, - start_index: Optional[int] = None) -> Iterator['User']: + start_index: Optional[int] = None) -> Iterator[User]: """List users. Gets details for all the users associated with a Databricks workspace. @@ -2852,7 +3125,7 @@ def get(self, workspace_id: int) -> WorkspacePermissions: headers=headers) return WorkspacePermissions.from_dict(res) - def list(self, workspace_id: int) -> Iterator['PermissionAssignment']: + def list(self, workspace_id: int) -> Iterator[PermissionAssignment]: """Get permission assignments. Get the permission assignments for the specified Databricks account and Databricks workspace. diff --git a/databricks/sdk/service/jobs.py b/databricks/sdk/service/jobs.py index 218c1410a..8e3d9ec6e 100755 --- a/databricks/sdk/service/jobs.py +++ b/databricks/sdk/service/jobs.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging import random import time @@ -21,11 +23,21 @@ @dataclass class BaseJob: created_time: Optional[int] = None + """The time at which this job was created in epoch milliseconds (milliseconds since 1/1/1970 UTC).""" + creator_user_name: Optional[str] = None + """The creator user name. This field won’t be included in the response if the user has already + been deleted.""" + job_id: Optional[int] = None - settings: Optional['JobSettings'] = None + """The canonical identifier for this job.""" + + settings: Optional[JobSettings] = None + """Settings for this job and all of its runs. These settings can be updated using the `resetJob` + method.""" def as_dict(self) -> dict: + """Serializes the BaseJob into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_time is not None: body['created_time'] = self.created_time if self.creator_user_name is not None: body['creator_user_name'] = self.creator_user_name @@ -34,7 +46,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BaseJob': + def from_dict(cls, d: Dict[str, any]) -> BaseJob: + """Deserializes the BaseJob from a dictionary.""" return cls(created_time=d.get('created_time', None), creator_user_name=d.get('creator_user_name', None), job_id=d.get('job_id', None), @@ -44,34 +57,130 @@ def from_dict(cls, d: Dict[str, any]) -> 'BaseJob': @dataclass class BaseRun: attempt_number: Optional[int] = None + """The sequence number of this run attempt for a triggered job run. The initial attempt of a run + has an attempt_number of 0\. If the initial run attempt fails, and the job has a retry policy + (`max_retries` \> 0), subsequent runs are created with an `original_attempt_run_id` of the + original attempt’s ID and an incrementing `attempt_number`. Runs are retried only until they + succeed, and the maximum `attempt_number` is the same as the `max_retries` value for the job.""" + cleanup_duration: Optional[int] = None - cluster_instance: Optional['ClusterInstance'] = None - cluster_spec: Optional['ClusterSpec'] = None - continuous: Optional['Continuous'] = None + """The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. + The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the + `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + + cluster_instance: Optional[ClusterInstance] = None + """The cluster used for this run. If the run is specified to use a new cluster, this field is set + once the Jobs service has requested a cluster for the run.""" + + cluster_spec: Optional[ClusterSpec] = None + """A snapshot of the job’s cluster specification when this run was created.""" + + continuous: Optional[Continuous] = None + """The continuous trigger that triggered this run.""" + creator_user_name: Optional[str] = None + """The creator user name. This field won’t be included in the response if the user has already + been deleted.""" + end_time: Optional[int] = None + """The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This + field is set to 0 if the job is still running.""" + execution_duration: Optional[int] = None - git_source: Optional['GitSource'] = None - job_clusters: Optional['List[JobCluster]'] = None + """The time in milliseconds it took to execute the commands in the JAR or notebook until they + completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration + of a task run is the sum of the `setup_duration`, `execution_duration`, and the + `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + + git_source: Optional[GitSource] = None + """An optional specification for a remote Git repository containing the source code used by tasks. + Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. + + If `git_source` is set, these tasks retrieve the file from the remote repository by default. + However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. + + Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks + are used, `git_source` must be defined on the job.""" + + job_clusters: Optional[List[JobCluster]] = None + """A list of job cluster specifications that can be shared and reused by tasks of this job. + Libraries cannot be declared in a shared job cluster. You must declare dependent libraries in + task settings.""" + job_id: Optional[int] = None - job_parameters: Optional['List[JobParameter]'] = None + """The canonical identifier of the job that contains this run.""" + + job_parameters: Optional[List[JobParameter]] = None + """Job-level parameters used in the run""" + number_in_job: Optional[int] = None + """A unique identifier for this job run. This is set to the same value as `run_id`.""" + original_attempt_run_id: Optional[int] = None - overriding_parameters: Optional['RunParameters'] = None + """If this run is a retry of a prior run attempt, this field contains the run_id of the original + attempt; otherwise, it is the same as the run_id.""" + + overriding_parameters: Optional[RunParameters] = None + """The parameters used for this run.""" + run_duration: Optional[int] = None + """The time in milliseconds it took the job run and all of its repairs to finish.""" + run_id: Optional[int] = None + """The canonical identifier of the run. This ID is unique across all runs of all jobs.""" + run_name: Optional[str] = None + """An optional name for the run. The maximum length is 4096 bytes in UTF-8 encoding.""" + run_page_url: Optional[str] = None - run_type: Optional['RunType'] = None - schedule: Optional['CronSchedule'] = None + """The URL to the detail page of the run.""" + + run_type: Optional[RunType] = None + """* `JOB_RUN`: Normal job run. A run created with :method:jobs/runNow. * `WORKFLOW_RUN`: Workflow + run. A run created with [dbutils.notebook.run]. * `SUBMIT_RUN`: Submit run. A run created with + :method:jobs/submit. + + [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow""" + + schedule: Optional[CronSchedule] = None + """The cron schedule that triggered this run if it was triggered by the periodic scheduler.""" + setup_duration: Optional[int] = None + """The time in milliseconds it took to set up the cluster. For runs that run on new clusters this + is the cluster creation time, for runs that run on existing clusters this time should be very + short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and + the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + start_time: Optional[int] = None - state: Optional['RunState'] = None - tasks: Optional['List[RunTask]'] = None - trigger: Optional['TriggerType'] = None - trigger_info: Optional['TriggerInfo'] = None + """The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). + This may not be the time when the job task starts executing, for example, if the job is + scheduled to run on a new cluster, this is the time the cluster creation call is issued.""" + + state: Optional[RunState] = None + """The current state of the run.""" + + tasks: Optional[List[RunTask]] = None + """The list of tasks performed by the run. Each task has its own `run_id` which you can use to call + `JobsGetOutput` to retrieve the run resutls.""" + + trigger: Optional[TriggerType] = None + """The type of trigger that fired this run. + + * `PERIODIC`: Schedules that periodically trigger runs, such as a cron scheduler. * `ONE_TIME`: + One time triggers that fire a single run. This occurs you triggered a single run on demand + through the UI or the API. * `RETRY`: Indicates a run that is triggered as a retry of a + previously failed run. This occurs when you request to re-run the job in case of failures. * + `RUN_JOB_TASK`: Indicates a run that is triggered using a Run Job task. + + * `FILE_ARRIVAL`: Indicates a run that is triggered by a file arrival.""" + + trigger_info: Optional[TriggerInfo] = None def as_dict(self) -> dict: + """Serializes the BaseRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.attempt_number is not None: body['attempt_number'] = self.attempt_number if self.cleanup_duration is not None: body['cleanup_duration'] = self.cleanup_duration @@ -104,7 +213,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BaseRun': + def from_dict(cls, d: Dict[str, any]) -> BaseRun: + """Deserializes the BaseRun from a dictionary.""" return cls(attempt_number=d.get('attempt_number', None), cleanup_duration=d.get('cleanup_duration', None), cluster_instance=_from_dict(d, 'cluster_instance', ClusterInstance), @@ -137,56 +247,90 @@ def from_dict(cls, d: Dict[str, any]) -> 'BaseRun': @dataclass class CancelAllRuns: all_queued_runs: Optional[bool] = None + """Optional boolean parameter to cancel all queued runs. If no job_id is provided, all queued runs + in the workspace are canceled.""" + job_id: Optional[int] = None + """The canonical identifier of the job to cancel all runs of.""" def as_dict(self) -> dict: + """Serializes the CancelAllRuns into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_queued_runs is not None: body['all_queued_runs'] = self.all_queued_runs if self.job_id is not None: body['job_id'] = self.job_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CancelAllRuns': + def from_dict(cls, d: Dict[str, any]) -> CancelAllRuns: + """Deserializes the CancelAllRuns from a dictionary.""" return cls(all_queued_runs=d.get('all_queued_runs', None), job_id=d.get('job_id', None)) @dataclass class CancelRun: run_id: int + """This field is required.""" def as_dict(self) -> dict: + """Serializes the CancelRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CancelRun': + def from_dict(cls, d: Dict[str, any]) -> CancelRun: + """Deserializes the CancelRun from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class ClusterInstance: cluster_id: Optional[str] = None + """The canonical identifier for the cluster used by a run. This field is always available for runs + on existing clusters. For runs on new clusters, it becomes available once the cluster is + created. This value can be used to view logs by browsing to + `/#setting/sparkui/$cluster_id/driver-logs`. The logs continue to be available after the run + completes. + + The response won’t include this field if the identifier is not available yet.""" + spark_context_id: Optional[str] = None + """The canonical identifier for the Spark context used by a run. This field is filled in once the + run begins execution. This value can be used to view the Spark UI by browsing to + `/#setting/sparkui/$cluster_id/$spark_context_id`. The Spark UI continues to be available after + the run has completed. + + The response won’t include this field if the identifier is not available yet.""" def as_dict(self) -> dict: + """Serializes the ClusterInstance into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.spark_context_id is not None: body['spark_context_id'] = self.spark_context_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterInstance': + def from_dict(cls, d: Dict[str, any]) -> ClusterInstance: + """Deserializes the ClusterInstance from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), spark_context_id=d.get('spark_context_id', None)) @dataclass class ClusterSpec: existing_cluster_id: Optional[str] = None - libraries: Optional['List[compute.Library]'] = None - new_cluster: Optional['compute.ClusterSpec'] = None + """If existing_cluster_id, the ID of an existing cluster that is used for all runs of this job. + When running jobs on an existing cluster, you may need to manually restart the cluster if it + stops responding. We suggest running jobs on new clusters for greater reliability""" + + libraries: Optional[List[compute.Library]] = None + """An optional list of libraries to be installed on the cluster that executes the job. The default + value is an empty list.""" + + new_cluster: Optional[compute.ClusterSpec] = None + """If new_cluster, a description of a cluster that is created for each run.""" def as_dict(self) -> dict: + """Serializes the ClusterSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.existing_cluster_id is not None: body['existing_cluster_id'] = self.existing_cluster_id if self.libraries: body['libraries'] = [v.as_dict() for v in self.libraries] @@ -194,7 +338,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ClusterSpec': + def from_dict(cls, d: Dict[str, any]) -> ClusterSpec: + """Deserializes the ClusterSpec from a dictionary.""" return cls(existing_cluster_id=d.get('existing_cluster_id', None), libraries=_repeated_dict(d, 'libraries', compute.Library), new_cluster=_from_dict(d, 'new_cluster', compute.ClusterSpec)) @@ -203,10 +348,26 @@ def from_dict(cls, d: Dict[str, any]) -> 'ClusterSpec': @dataclass class ConditionTask: left: Optional[str] = None - op: Optional['ConditionTaskOp'] = None + """The left operand of the condition task. Can be either a string value or a job state or parameter + reference.""" + + op: Optional[ConditionTaskOp] = None + """* `EQUAL_TO`, `NOT_EQUAL` operators perform string comparison of their operands. This means that + `“12.0” == “12”` will evaluate to `false`. * `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, + `LESS_THAN`, `LESS_THAN_OR_EQUAL` operators perform numeric comparison of their operands. + `“12.0” >= “12”` will evaluate to `true`, `“10.0” >= “12”` will evaluate to + `false`. + + The boolean comparison to task values can be implemented with operators `EQUAL_TO`, `NOT_EQUAL`. + If a task value was set to a boolean value, it will be serialized to `“true”` or + `“false”` for the comparison.""" + right: Optional[str] = None + """The right operand of the condition task. Can be either a string value or a job state or + parameter reference.""" def as_dict(self) -> dict: + """Serializes the ConditionTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.left is not None: body['left'] = self.left if self.op is not None: body['op'] = self.op.value @@ -214,7 +375,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ConditionTask': + def from_dict(cls, d: Dict[str, any]) -> ConditionTask: + """Deserializes the ConditionTask from a dictionary.""" return cls(left=d.get('left', None), op=_enum(d, 'op', ConditionTaskOp), right=d.get('right', None)) @@ -239,45 +401,131 @@ class ConditionTaskOp(Enum): @dataclass class Continuous: - pause_status: Optional['PauseStatus'] = None + pause_status: Optional[PauseStatus] = None + """Indicate whether the continuous execution of the job is paused or not. Defaults to UNPAUSED.""" def as_dict(self) -> dict: + """Serializes the Continuous into a dictionary suitable for use as a JSON request body.""" body = {} if self.pause_status is not None: body['pause_status'] = self.pause_status.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Continuous': + def from_dict(cls, d: Dict[str, any]) -> Continuous: + """Deserializes the Continuous from a dictionary.""" return cls(pause_status=_enum(d, 'pause_status', PauseStatus)) @dataclass class CreateJob: - access_control_list: Optional['List[iam.AccessControlRequest]'] = None - compute: Optional['List[JobCompute]'] = None - continuous: Optional['Continuous'] = None - deployment: Optional['JobDeployment'] = None + access_control_list: Optional[List[iam.AccessControlRequest]] = None + """List of permissions to set on the job.""" + + compute: Optional[List[JobCompute]] = None + """A list of compute requirements that can be referenced by tasks of this job.""" + + continuous: Optional[Continuous] = None + """An optional continuous property for this job. The continuous property will ensure that there is + always one run executing. Only one of `schedule` and `continuous` can be used.""" + + deployment: Optional[JobDeployment] = None + """Deployment information for jobs managed by external sources.""" + description: Optional[str] = None - edit_mode: Optional['CreateJobEditMode'] = None - email_notifications: Optional['JobEmailNotifications'] = None - format: Optional['Format'] = None - git_source: Optional['GitSource'] = None - health: Optional['JobsHealthRules'] = None - job_clusters: Optional['List[JobCluster]'] = None + """An optional description for the job. The maximum length is 1024 characters in UTF-8 encoding.""" + + edit_mode: Optional[CreateJobEditMode] = None + """Edit mode of the job. + + * `UI_LOCKED`: The job is in a locked UI state and cannot be modified. * `EDITABLE`: The job is + in an editable state and can be modified.""" + + email_notifications: Optional[JobEmailNotifications] = None + """An optional set of email addresses that is notified when runs of this job begin or complete as + well as when this job is deleted.""" + + format: Optional[Format] = None + """Used to tell what is the format of the job. This field is ignored in Create/Update/Reset calls. + When using the Jobs API 2.1 this value is always set to `"MULTI_TASK"`.""" + + git_source: Optional[GitSource] = None + """An optional specification for a remote Git repository containing the source code used by tasks. + Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. + + If `git_source` is set, these tasks retrieve the file from the remote repository by default. + However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. + + Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks + are used, `git_source` must be defined on the job.""" + + health: Optional[JobsHealthRules] = None + """An optional set of health rules that can be defined for this job.""" + + job_clusters: Optional[List[JobCluster]] = None + """A list of job cluster specifications that can be shared and reused by tasks of this job. + Libraries cannot be declared in a shared job cluster. You must declare dependent libraries in + task settings.""" + max_concurrent_runs: Optional[int] = None + """An optional maximum allowed number of concurrent runs of the job. + + Set this value if you want to be able to execute multiple runs of the same job concurrently. + This is useful for example if you trigger your job on a frequent schedule and want to allow + consecutive runs to overlap with each other, or if you want to trigger multiple runs which + differ by their input parameters. + + This setting affects only new runs. For example, suppose the job’s concurrency is 4 and there + are 4 concurrent active runs. Then setting the concurrency to 3 won’t kill any of the active + runs. However, from then on, new runs are skipped unless there are fewer than 3 active runs. + + This value cannot exceed 1000. Setting this value to `0` causes all new runs to be skipped.""" + name: Optional[str] = None - notification_settings: Optional['JobNotificationSettings'] = None - parameters: Optional['List[JobParameterDefinition]'] = None - queue: Optional['QueueSettings'] = None - run_as: Optional['JobRunAs'] = None - schedule: Optional['CronSchedule'] = None - tags: Optional['Dict[str,str]'] = None - tasks: Optional['List[Task]'] = None + """An optional name for the job. The maximum length is 4096 bytes in UTF-8 encoding.""" + + notification_settings: Optional[JobNotificationSettings] = None + """Optional notification settings that are used when sending notifications to each of the + `email_notifications` and `webhook_notifications` for this job.""" + + parameters: Optional[List[JobParameterDefinition]] = None + """Job-level parameter definitions""" + + queue: Optional[QueueSettings] = None + """The queue settings of the job.""" + + run_as: Optional[JobRunAs] = None + """Write-only setting, available only in Create/Update/Reset and Submit calls. Specifies the user + or service principal that the job runs as. If not specified, the job runs as the user who + created the job. + + Only `user_name` or `service_principal_name` can be specified. If both are specified, an error + is thrown.""" + + schedule: Optional[CronSchedule] = None + """An optional periodic schedule for this job. The default behavior is that the job only runs when + triggered by clicking “Run Now” in the Jobs UI or sending an API request to `runNow`.""" + + tags: Optional[Dict[str, str]] = None + """A map of tags associated with the job. These are forwarded to the cluster as cluster tags for + jobs clusters, and are subject to the same limitations as cluster tags. A maximum of 25 tags can + be added to the job.""" + + tasks: Optional[List[Task]] = None + """A list of task specifications to be executed by this job.""" + timeout_seconds: Optional[int] = None - trigger: Optional['TriggerSettings'] = None - webhook_notifications: Optional['WebhookNotifications'] = None + """An optional timeout applied to each run of this job. A value of `0` means no timeout.""" + + trigger: Optional[TriggerSettings] = None + """Trigger settings for the job. Can be used to trigger a run when new files arrive in an external + location. The default behavior is that the job runs only when triggered by clicking “Run + Now” in the Jobs UI or sending an API request to `runNow`.""" + + webhook_notifications: Optional[WebhookNotifications] = None + """A collection of system notification IDs to notify when runs of this job begin or complete.""" def as_dict(self) -> dict: + """Serializes the CreateJob into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -306,7 +554,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateJob': + def from_dict(cls, d: Dict[str, any]) -> CreateJob: + """Deserializes the CreateJob from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', iam.AccessControlRequest), compute=_repeated_dict(d, 'compute', JobCompute), continuous=_from_dict(d, 'continuous', Continuous), @@ -345,24 +594,39 @@ class CreateJobEditMode(Enum): @dataclass class CreateResponse: job_id: Optional[int] = None + """The canonical identifier for the newly created job.""" def as_dict(self) -> dict: + """Serializes the CreateResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.job_id is not None: body['job_id'] = self.job_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateResponse: + """Deserializes the CreateResponse from a dictionary.""" return cls(job_id=d.get('job_id', None)) @dataclass class CronSchedule: quartz_cron_expression: str + """A Cron expression using Quartz syntax that describes the schedule for a job. See [Cron Trigger] + for details. This field is required." + + [Cron Trigger]: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html""" + timezone_id: str - pause_status: Optional['PauseStatus'] = None + """A Java timezone ID. The schedule for a job is resolved with respect to this timezone. See [Java + TimeZone] for details. This field is required. + + [Java TimeZone]: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html""" + + pause_status: Optional[PauseStatus] = None + """Indicate whether this schedule is paused or not.""" def as_dict(self) -> dict: + """Serializes the CronSchedule into a dictionary suitable for use as a JSON request body.""" body = {} if self.pause_status is not None: body['pause_status'] = self.pause_status.value if self.quartz_cron_expression is not None: @@ -371,7 +635,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CronSchedule': + def from_dict(cls, d: Dict[str, any]) -> CronSchedule: + """Deserializes the CronSchedule from a dictionary.""" return cls(pause_status=_enum(d, 'pause_status', PauseStatus), quartz_cron_expression=d.get('quartz_cron_expression', None), timezone_id=d.get('timezone_id', None)) @@ -379,31 +644,57 @@ def from_dict(cls, d: Dict[str, any]) -> 'CronSchedule': @dataclass class DbtOutput: - artifacts_headers: Optional['Dict[str,str]'] = None + artifacts_headers: Optional[Dict[str, str]] = None + """An optional map of headers to send when retrieving the artifact from the `artifacts_link`.""" + artifacts_link: Optional[str] = None + """A pre-signed URL to download the (compressed) dbt artifacts. This link is valid for a limited + time (30 minutes). This information is only available after the run has finished.""" def as_dict(self) -> dict: + """Serializes the DbtOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifacts_headers: body['artifacts_headers'] = self.artifacts_headers if self.artifacts_link is not None: body['artifacts_link'] = self.artifacts_link return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DbtOutput': + def from_dict(cls, d: Dict[str, any]) -> DbtOutput: + """Deserializes the DbtOutput from a dictionary.""" return cls(artifacts_headers=d.get('artifacts_headers', None), artifacts_link=d.get('artifacts_link', None)) @dataclass class DbtTask: - commands: 'List[str]' + commands: List[str] + """A list of dbt commands to execute. All commands must start with `dbt`. This parameter must not + be empty. A maximum of up to 10 commands can be provided.""" + catalog: Optional[str] = None + """Optional name of the catalog to use. The value is the top level in the 3-level namespace of + Unity Catalog (catalog / schema / relation). The catalog value can only be specified if a + warehouse_id is specified. Requires dbt-databricks >= 1.1.1.""" + profiles_directory: Optional[str] = None + """Optional (relative) path to the profiles directory. Can only be specified if no warehouse_id is + specified. If no warehouse_id is specified and this folder is unset, the root directory is used.""" + project_directory: Optional[str] = None + """Optional (relative) path to the project directory, if no value is provided, the root of the git + repository is used.""" + schema: Optional[str] = None + """Optional schema to write to. This parameter is only used when a warehouse_id is also provided. + If not provided, the `default` schema is used.""" + warehouse_id: Optional[str] = None + """ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the + profile and connection details to dbt. It can be overridden on a per-command basis by using the + `--profiles-dir` command line argument.""" def as_dict(self) -> dict: + """Serializes the DbtTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog is not None: body['catalog'] = self.catalog if self.commands: body['commands'] = [v for v in self.commands] @@ -414,7 +705,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DbtTask': + def from_dict(cls, d: Dict[str, any]) -> DbtTask: + """Deserializes the DbtTask from a dictionary.""" return cls(catalog=d.get('catalog', None), commands=d.get('commands', None), profiles_directory=d.get('profiles_directory', None), @@ -426,52 +718,74 @@ def from_dict(cls, d: Dict[str, any]) -> 'DbtTask': @dataclass class DeleteJob: job_id: int + """The canonical identifier of the job to delete. This field is required.""" def as_dict(self) -> dict: + """Serializes the DeleteJob into a dictionary suitable for use as a JSON request body.""" body = {} if self.job_id is not None: body['job_id'] = self.job_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteJob': + def from_dict(cls, d: Dict[str, any]) -> DeleteJob: + """Deserializes the DeleteJob from a dictionary.""" return cls(job_id=d.get('job_id', None)) @dataclass class DeleteRun: run_id: int + """The canonical identifier of the run for which to retrieve the metadata.""" def as_dict(self) -> dict: + """Serializes the DeleteRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteRun': + def from_dict(cls, d: Dict[str, any]) -> DeleteRun: + """Deserializes the DeleteRun from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class ExportRunOutput: - views: Optional['List[ViewItem]'] = None + views: Optional[List[ViewItem]] = None + """The exported content in HTML format (one for every view item). To extract the HTML notebook from + the JSON response, download and run this [Python script]. + + [Python script]: https://docs.databricks.com/en/_static/examples/extract.py""" def as_dict(self) -> dict: + """Serializes the ExportRunOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.views: body['views'] = [v.as_dict() for v in self.views] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExportRunOutput': + def from_dict(cls, d: Dict[str, any]) -> ExportRunOutput: + """Deserializes the ExportRunOutput from a dictionary.""" return cls(views=_repeated_dict(d, 'views', ViewItem)) @dataclass class FileArrivalTriggerConfiguration: min_time_between_triggers_seconds: Optional[int] = None + """If set, the trigger starts a run only after the specified amount of time passed since the last + time the trigger fired. The minimum allowed value is 60 seconds""" + url: Optional[str] = None + """URL to be monitored for file arrivals. The path must point to the root or a subpath of the + external location.""" + wait_after_last_change_seconds: Optional[int] = None + """If set, the trigger starts a run only after no file activity has occurred for the specified + amount of time. This makes it possible to wait for a batch of incoming files to arrive before + triggering a run. The minimum allowed value is 60 seconds.""" def as_dict(self) -> dict: + """Serializes the FileArrivalTriggerConfiguration into a dictionary suitable for use as a JSON request body.""" body = {} if self.min_time_between_triggers_seconds is not None: body['min_time_between_triggers_seconds'] = self.min_time_between_triggers_seconds @@ -481,7 +795,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FileArrivalTriggerConfiguration': + def from_dict(cls, d: Dict[str, any]) -> FileArrivalTriggerConfiguration: + """Deserializes the FileArrivalTriggerConfiguration from a dictionary.""" return cls(min_time_between_triggers_seconds=d.get('min_time_between_triggers_seconds', None), url=d.get('url', None), wait_after_last_change_seconds=d.get('wait_after_last_change_seconds', None)) @@ -495,15 +810,18 @@ class Format(Enum): @dataclass class GetJobPermissionLevelsResponse: - permission_levels: Optional['List[JobPermissionsDescription]'] = None + permission_levels: Optional[List[JobPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetJobPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetJobPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetJobPermissionLevelsResponse: + """Deserializes the GetJobPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', JobPermissionsDescription)) @@ -525,14 +843,19 @@ class GitSnapshot: included on job runs.""" used_commit: Optional[str] = None + """Commit that was used to execute the run. If git_branch was specified, this points to the HEAD of + the branch at the time of the run; if git_tag was specified, this points to the commit the tag + points to.""" def as_dict(self) -> dict: + """Serializes the GitSnapshot into a dictionary suitable for use as a JSON request body.""" body = {} if self.used_commit is not None: body['used_commit'] = self.used_commit return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GitSnapshot': + def from_dict(cls, d: Dict[str, any]) -> GitSnapshot: + """Deserializes the GitSnapshot from a dictionary.""" return cls(used_commit=d.get('used_commit', None)) @@ -548,14 +871,32 @@ class GitSource: are used, `git_source` must be defined on the job.""" git_url: str - git_provider: 'GitProvider' + """URL of the repository to be cloned by this job.""" + + git_provider: GitProvider + """Unique identifier of the service used to host the Git repository. The value is case insensitive.""" + git_branch: Optional[str] = None + """Name of the branch to be checked out and used by this job. This field cannot be specified in + conjunction with git_tag or git_commit.""" + git_commit: Optional[str] = None - git_snapshot: Optional['GitSnapshot'] = None + """Commit to be checked out and used by this job. This field cannot be specified in conjunction + with git_branch or git_tag.""" + + git_snapshot: Optional[GitSnapshot] = None + """Read-only state of the remote repository at the time the job was run. This field is only + included on job runs.""" + git_tag: Optional[str] = None - job_source: Optional['JobSource'] = None + """Name of the tag to be checked out and used by this job. This field cannot be specified in + conjunction with git_branch or git_commit.""" + + job_source: Optional[JobSource] = None + """The source of the job specification in the remote repository when the job is source controlled.""" def as_dict(self) -> dict: + """Serializes the GitSource into a dictionary suitable for use as a JSON request body.""" body = {} if self.git_branch is not None: body['git_branch'] = self.git_branch if self.git_commit is not None: body['git_commit'] = self.git_commit @@ -567,7 +908,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GitSource': + def from_dict(cls, d: Dict[str, any]) -> GitSource: + """Deserializes the GitSource from a dictionary.""" return cls(git_branch=d.get('git_branch', None), git_commit=d.get('git_commit', None), git_provider=_enum(d, 'git_provider', GitProvider), @@ -580,13 +922,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'GitSource': @dataclass class Job: created_time: Optional[int] = None + """The time at which this job was created in epoch milliseconds (milliseconds since 1/1/1970 UTC).""" + creator_user_name: Optional[str] = None + """The creator user name. This field won’t be included in the response if the user has already + been deleted.""" + job_id: Optional[int] = None + """The canonical identifier for this job.""" + run_as_user_name: Optional[str] = None - settings: Optional['JobSettings'] = None - trigger_history: Optional['TriggerHistory'] = None + """The email of an active workspace user or the application ID of a service principal that the job + runs as. This value can be changed by setting the `run_as` field when creating or updating a + job. + + By default, `run_as_user_name` is based on the current job settings and is set to the creator of + the job if job access control is disabled or to the user with the `is_owner` permission if job + access control is enabled.""" + + settings: Optional[JobSettings] = None + """Settings for this job and all of its runs. These settings can be updated using the `resetJob` + method.""" + + trigger_history: Optional[TriggerHistory] = None + """History of the file arrival trigger associated with the job.""" def as_dict(self) -> dict: + """Serializes the Job into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_time is not None: body['created_time'] = self.created_time if self.creator_user_name is not None: body['creator_user_name'] = self.creator_user_name @@ -597,7 +959,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Job': + def from_dict(cls, d: Dict[str, any]) -> Job: + """Deserializes the Job from a dictionary.""" return cls(created_time=d.get('created_time', None), creator_user_name=d.get('creator_user_name', None), job_id=d.get('job_id', None), @@ -609,11 +972,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'Job': @dataclass class JobAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['JobPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[JobPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the JobAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -623,7 +995,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> JobAccessControlRequest: + """Deserializes the JobAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', JobPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -632,13 +1005,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobAccessControlRequest': @dataclass class JobAccessControlResponse: - all_permissions: Optional['List[JobPermission]'] = None + all_permissions: Optional[List[JobPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the JobAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -649,7 +1032,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> JobAccessControlResponse: + """Deserializes the JobAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', JobPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -660,16 +1044,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobAccessControlResponse': @dataclass class JobCluster: job_cluster_key: str - new_cluster: Optional['compute.ClusterSpec'] = None + """A unique name for the job cluster. This field is required and must be unique within the job. + `JobTaskSettings` may refer to this field to determine which cluster to launch for the task + execution.""" + + new_cluster: Optional[compute.ClusterSpec] = None + """If new_cluster, a description of a cluster that is created for each task.""" def as_dict(self) -> dict: + """Serializes the JobCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.job_cluster_key is not None: body['job_cluster_key'] = self.job_cluster_key if self.new_cluster: body['new_cluster'] = self.new_cluster.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobCluster': + def from_dict(cls, d: Dict[str, any]) -> JobCluster: + """Deserializes the JobCluster from a dictionary.""" return cls(job_cluster_key=d.get('job_cluster_key', None), new_cluster=_from_dict(d, 'new_cluster', compute.ClusterSpec)) @@ -677,32 +1068,45 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobCluster': @dataclass class JobCompute: compute_key: str - spec: 'compute.ComputeSpec' + """A unique name for the compute requirement. This field is required and must be unique within the + job. `JobTaskSettings` may refer to this field to determine the compute requirements for the + task execution.""" + + spec: compute.ComputeSpec def as_dict(self) -> dict: + """Serializes the JobCompute into a dictionary suitable for use as a JSON request body.""" body = {} if self.compute_key is not None: body['compute_key'] = self.compute_key if self.spec: body['spec'] = self.spec.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobCompute': + def from_dict(cls, d: Dict[str, any]) -> JobCompute: + """Deserializes the JobCompute from a dictionary.""" return cls(compute_key=d.get('compute_key', None), spec=_from_dict(d, 'spec', compute.ComputeSpec)) @dataclass class JobDeployment: - kind: 'JobDeploymentKind' + kind: JobDeploymentKind + """The kind of deployment that manages the job. + + * `BUNDLE`: The job is managed by Databricks Asset Bundle.""" + metadata_file_path: Optional[str] = None + """Path of the file that contains deployment metadata.""" def as_dict(self) -> dict: + """Serializes the JobDeployment into a dictionary suitable for use as a JSON request body.""" body = {} if self.kind is not None: body['kind'] = self.kind.value if self.metadata_file_path is not None: body['metadata_file_path'] = self.metadata_file_path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobDeployment': + def from_dict(cls, d: Dict[str, any]) -> JobDeployment: + """Deserializes the JobDeployment from a dictionary.""" return cls(kind=_enum(d, 'kind', JobDeploymentKind), metadata_file_path=d.get('metadata_file_path', None)) @@ -718,12 +1122,32 @@ class JobDeploymentKind(Enum): @dataclass class JobEmailNotifications: no_alert_for_skipped_runs: Optional[bool] = None - on_duration_warning_threshold_exceeded: Optional['List[str]'] = None - on_failure: Optional['List[str]'] = None - on_start: Optional['List[str]'] = None - on_success: Optional['List[str]'] = None + """If true, do not send email to recipients specified in `on_failure` if the run is skipped.""" + + on_duration_warning_threshold_exceeded: Optional[List[str]] = None + """A list of email addresses to be notified when the duration of a run exceeds the threshold + specified for the `RUN_DURATION_SECONDS` metric in the `health` field. If no rule for the + `RUN_DURATION_SECONDS` metric is specified in the `health` field for the job, notifications are + not sent.""" + + on_failure: Optional[List[str]] = None + """A list of email addresses to be notified when a run unsuccessfully completes. A run is + considered to have completed unsuccessfully if it ends with an `INTERNAL_ERROR` + `life_cycle_state` or a `FAILED`, or `TIMED_OUT` result_state. If this is not specified on job + creation, reset, or update the list is empty, and notifications are not sent.""" + + on_start: Optional[List[str]] = None + """A list of email addresses to be notified when a run begins. If not specified on job creation, + reset, or update, the list is empty, and notifications are not sent.""" + + on_success: Optional[List[str]] = None + """A list of email addresses to be notified when a run successfully completes. A run is considered + to have completed successfully if it ends with a `TERMINATED` `life_cycle_state` and a `SUCCESS` + result_state. If not specified on job creation, reset, or update, the list is empty, and + notifications are not sent.""" def as_dict(self) -> dict: + """Serializes the JobEmailNotifications into a dictionary suitable for use as a JSON request body.""" body = {} if self.no_alert_for_skipped_runs is not None: body['no_alert_for_skipped_runs'] = self.no_alert_for_skipped_runs @@ -737,7 +1161,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobEmailNotifications': + def from_dict(cls, d: Dict[str, any]) -> JobEmailNotifications: + """Deserializes the JobEmailNotifications from a dictionary.""" return cls(no_alert_for_skipped_runs=d.get('no_alert_for_skipped_runs', None), on_duration_warning_threshold_exceeded=d.get('on_duration_warning_threshold_exceeded', None), @@ -749,9 +1174,15 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobEmailNotifications': @dataclass class JobNotificationSettings: no_alert_for_canceled_runs: Optional[bool] = None + """If true, do not send notifications to recipients specified in `on_failure` if the run is + canceled.""" + no_alert_for_skipped_runs: Optional[bool] = None + """If true, do not send notifications to recipients specified in `on_failure` if the run is + skipped.""" def as_dict(self) -> dict: + """Serializes the JobNotificationSettings into a dictionary suitable for use as a JSON request body.""" body = {} if self.no_alert_for_canceled_runs is not None: body['no_alert_for_canceled_runs'] = self.no_alert_for_canceled_runs @@ -760,7 +1191,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobNotificationSettings': + def from_dict(cls, d: Dict[str, any]) -> JobNotificationSettings: + """Deserializes the JobNotificationSettings from a dictionary.""" return cls(no_alert_for_canceled_runs=d.get('no_alert_for_canceled_runs', None), no_alert_for_skipped_runs=d.get('no_alert_for_skipped_runs', None)) @@ -768,10 +1200,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobNotificationSettings': @dataclass class JobParameter: default: Optional[str] = None + """The optional default value of the parameter""" + name: Optional[str] = None + """The name of the parameter""" + value: Optional[str] = None + """The value used in the run""" def as_dict(self) -> dict: + """Serializes the JobParameter into a dictionary suitable for use as a JSON request body.""" body = {} if self.default is not None: body['default'] = self.default if self.name is not None: body['name'] = self.name @@ -779,33 +1217,43 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobParameter': + def from_dict(cls, d: Dict[str, any]) -> JobParameter: + """Deserializes the JobParameter from a dictionary.""" return cls(default=d.get('default', None), name=d.get('name', None), value=d.get('value', None)) @dataclass class JobParameterDefinition: name: str + """The name of the defined parameter. May only contain alphanumeric characters, `_`, `-`, and `.`""" + default: str + """Default value of the parameter.""" def as_dict(self) -> dict: + """Serializes the JobParameterDefinition into a dictionary suitable for use as a JSON request body.""" body = {} if self.default is not None: body['default'] = self.default if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobParameterDefinition': + def from_dict(cls, d: Dict[str, any]) -> JobParameterDefinition: + """Deserializes the JobParameterDefinition from a dictionary.""" return cls(default=d.get('default', None), name=d.get('name', None)) @dataclass class JobPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['JobPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[JobPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the JobPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -813,7 +1261,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobPermission': + def from_dict(cls, d: Dict[str, any]) -> JobPermission: + """Deserializes the JobPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', JobPermissionLevel)) @@ -830,11 +1279,14 @@ class JobPermissionLevel(Enum): @dataclass class JobPermissions: - access_control_list: Optional['List[JobAccessControlResponse]'] = None + access_control_list: Optional[List[JobAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the JobPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -843,7 +1295,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobPermissions': + def from_dict(cls, d: Dict[str, any]) -> JobPermissions: + """Deserializes the JobPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', JobAccessControlResponse), object_id=d.get('object_id', None), object_type=d.get('object_type', None)) @@ -852,26 +1305,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobPermissions': @dataclass class JobPermissionsDescription: description: Optional[str] = None - permission_level: Optional['JobPermissionLevel'] = None + + permission_level: Optional[JobPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the JobPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> JobPermissionsDescription: + """Deserializes the JobPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', JobPermissionLevel)) @dataclass class JobPermissionsRequest: - access_control_list: Optional['List[JobAccessControlRequest]'] = None + access_control_list: Optional[List[JobAccessControlRequest]] = None + job_id: Optional[str] = None + """The job for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the JobPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -879,7 +1339,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> JobPermissionsRequest: + """Deserializes the JobPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', JobAccessControlRequest), job_id=d.get('job_id', None)) @@ -894,9 +1355,15 @@ class JobRunAs: is thrown.""" service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """The email of an active workspace user. Non-admin users can only set this field to their own + email.""" def as_dict(self) -> dict: + """Serializes the JobRunAs into a dictionary suitable for use as a JSON request body.""" body = {} if self.service_principal_name is not None: body['service_principal_name'] = self.service_principal_name @@ -904,37 +1371,119 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobRunAs': + def from_dict(cls, d: Dict[str, any]) -> JobRunAs: + """Deserializes the JobRunAs from a dictionary.""" return cls(service_principal_name=d.get('service_principal_name', None), user_name=d.get('user_name', None)) @dataclass class JobSettings: - compute: Optional['List[JobCompute]'] = None - continuous: Optional['Continuous'] = None - deployment: Optional['JobDeployment'] = None + compute: Optional[List[JobCompute]] = None + """A list of compute requirements that can be referenced by tasks of this job.""" + + continuous: Optional[Continuous] = None + """An optional continuous property for this job. The continuous property will ensure that there is + always one run executing. Only one of `schedule` and `continuous` can be used.""" + + deployment: Optional[JobDeployment] = None + """Deployment information for jobs managed by external sources.""" + description: Optional[str] = None - edit_mode: Optional['JobSettingsEditMode'] = None - email_notifications: Optional['JobEmailNotifications'] = None - format: Optional['Format'] = None - git_source: Optional['GitSource'] = None - health: Optional['JobsHealthRules'] = None - job_clusters: Optional['List[JobCluster]'] = None + """An optional description for the job. The maximum length is 1024 characters in UTF-8 encoding.""" + + edit_mode: Optional[JobSettingsEditMode] = None + """Edit mode of the job. + + * `UI_LOCKED`: The job is in a locked UI state and cannot be modified. * `EDITABLE`: The job is + in an editable state and can be modified.""" + + email_notifications: Optional[JobEmailNotifications] = None + """An optional set of email addresses that is notified when runs of this job begin or complete as + well as when this job is deleted.""" + + format: Optional[Format] = None + """Used to tell what is the format of the job. This field is ignored in Create/Update/Reset calls. + When using the Jobs API 2.1 this value is always set to `"MULTI_TASK"`.""" + + git_source: Optional[GitSource] = None + """An optional specification for a remote Git repository containing the source code used by tasks. + Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. + + If `git_source` is set, these tasks retrieve the file from the remote repository by default. + However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. + + Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks + are used, `git_source` must be defined on the job.""" + + health: Optional[JobsHealthRules] = None + """An optional set of health rules that can be defined for this job.""" + + job_clusters: Optional[List[JobCluster]] = None + """A list of job cluster specifications that can be shared and reused by tasks of this job. + Libraries cannot be declared in a shared job cluster. You must declare dependent libraries in + task settings.""" + max_concurrent_runs: Optional[int] = None + """An optional maximum allowed number of concurrent runs of the job. + + Set this value if you want to be able to execute multiple runs of the same job concurrently. + This is useful for example if you trigger your job on a frequent schedule and want to allow + consecutive runs to overlap with each other, or if you want to trigger multiple runs which + differ by their input parameters. + + This setting affects only new runs. For example, suppose the job’s concurrency is 4 and there + are 4 concurrent active runs. Then setting the concurrency to 3 won’t kill any of the active + runs. However, from then on, new runs are skipped unless there are fewer than 3 active runs. + + This value cannot exceed 1000. Setting this value to `0` causes all new runs to be skipped.""" + name: Optional[str] = None - notification_settings: Optional['JobNotificationSettings'] = None - parameters: Optional['List[JobParameterDefinition]'] = None - queue: Optional['QueueSettings'] = None - run_as: Optional['JobRunAs'] = None - schedule: Optional['CronSchedule'] = None - tags: Optional['Dict[str,str]'] = None - tasks: Optional['List[Task]'] = None + """An optional name for the job. The maximum length is 4096 bytes in UTF-8 encoding.""" + + notification_settings: Optional[JobNotificationSettings] = None + """Optional notification settings that are used when sending notifications to each of the + `email_notifications` and `webhook_notifications` for this job.""" + + parameters: Optional[List[JobParameterDefinition]] = None + """Job-level parameter definitions""" + + queue: Optional[QueueSettings] = None + """The queue settings of the job.""" + + run_as: Optional[JobRunAs] = None + """Write-only setting, available only in Create/Update/Reset and Submit calls. Specifies the user + or service principal that the job runs as. If not specified, the job runs as the user who + created the job. + + Only `user_name` or `service_principal_name` can be specified. If both are specified, an error + is thrown.""" + + schedule: Optional[CronSchedule] = None + """An optional periodic schedule for this job. The default behavior is that the job only runs when + triggered by clicking “Run Now” in the Jobs UI or sending an API request to `runNow`.""" + + tags: Optional[Dict[str, str]] = None + """A map of tags associated with the job. These are forwarded to the cluster as cluster tags for + jobs clusters, and are subject to the same limitations as cluster tags. A maximum of 25 tags can + be added to the job.""" + + tasks: Optional[List[Task]] = None + """A list of task specifications to be executed by this job.""" + timeout_seconds: Optional[int] = None - trigger: Optional['TriggerSettings'] = None - webhook_notifications: Optional['WebhookNotifications'] = None + """An optional timeout applied to each run of this job. A value of `0` means no timeout.""" + + trigger: Optional[TriggerSettings] = None + """Trigger settings for the job. Can be used to trigger a run when new files arrive in an external + location. The default behavior is that the job runs only when triggered by clicking “Run + Now” in the Jobs UI or sending an API request to `runNow`.""" + + webhook_notifications: Optional[WebhookNotifications] = None + """A collection of system notification IDs to notify when runs of this job begin or complete.""" def as_dict(self) -> dict: + """Serializes the JobSettings into a dictionary suitable for use as a JSON request body.""" body = {} if self.compute: body['compute'] = [v.as_dict() for v in self.compute] if self.continuous: body['continuous'] = self.continuous.as_dict() @@ -961,7 +1510,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobSettings': + def from_dict(cls, d: Dict[str, any]) -> JobSettings: + """Deserializes the JobSettings from a dictionary.""" return cls(compute=_repeated_dict(d, 'compute', JobCompute), continuous=_from_dict(d, 'continuous', Continuous), deployment=_from_dict(d, 'deployment', JobDeployment), @@ -1001,10 +1551,23 @@ class JobSource: """The source of the job specification in the remote repository when the job is source controlled.""" job_config_path: str + """Path of the job YAML file that contains the job specification.""" + import_from_git_branch: str - dirty_state: Optional['JobSourceDirtyState'] = None + """Name of the branch which the job is imported from.""" + + dirty_state: Optional[JobSourceDirtyState] = None + """Dirty state indicates the job is not fully synced with the job specification in the remote + repository. + + Possible values are: * `NOT_SYNCED`: The job is not yet synced with the remote job + specification. Import the remote job specification from UI to make the job fully synced. * + `DISCONNECTED`: The job is temporary disconnected from the remote job specification and is + allowed for live edit. Import the remote job specification again from UI to make the job fully + synced.""" def as_dict(self) -> dict: + """Serializes the JobSource into a dictionary suitable for use as a JSON request body.""" body = {} if self.dirty_state is not None: body['dirty_state'] = self.dirty_state.value if self.import_from_git_branch is not None: @@ -1013,7 +1576,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobSource': + def from_dict(cls, d: Dict[str, any]) -> JobSource: + """Deserializes the JobSource from a dictionary.""" return cls(dirty_state=_enum(d, 'dirty_state', JobSourceDirtyState), import_from_git_branch=d.get('import_from_git_branch', None), job_config_path=d.get('job_config_path', None)) @@ -1047,11 +1611,17 @@ class JobsHealthOperator(Enum): @dataclass class JobsHealthRule: - metric: Optional['JobsHealthMetric'] = None - op: Optional['JobsHealthOperator'] = None + metric: Optional[JobsHealthMetric] = None + """Specifies the health metric that is being evaluated for a particular health rule.""" + + op: Optional[JobsHealthOperator] = None + """Specifies the operator used to compare the health metric value with the specified threshold.""" + value: Optional[int] = None + """Specifies the threshold value that the health metric should obey to satisfy the health rule.""" def as_dict(self) -> dict: + """Serializes the JobsHealthRule into a dictionary suitable for use as a JSON request body.""" body = {} if self.metric is not None: body['metric'] = self.metric.value if self.op is not None: body['op'] = self.op.value @@ -1059,7 +1629,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobsHealthRule': + def from_dict(cls, d: Dict[str, any]) -> JobsHealthRule: + """Deserializes the JobsHealthRule from a dictionary.""" return cls(metric=_enum(d, 'metric', JobsHealthMetric), op=_enum(d, 'op', JobsHealthOperator), value=d.get('value', None)) @@ -1069,26 +1640,36 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobsHealthRule': class JobsHealthRules: """An optional set of health rules that can be defined for this job.""" - rules: Optional['List[JobsHealthRule]'] = None + rules: Optional[List[JobsHealthRule]] = None def as_dict(self) -> dict: + """Serializes the JobsHealthRules into a dictionary suitable for use as a JSON request body.""" body = {} if self.rules: body['rules'] = [v.as_dict() for v in self.rules] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobsHealthRules': + def from_dict(cls, d: Dict[str, any]) -> JobsHealthRules: + """Deserializes the JobsHealthRules from a dictionary.""" return cls(rules=_repeated_dict(d, 'rules', JobsHealthRule)) @dataclass class ListJobsResponse: has_more: Optional[bool] = None - jobs: Optional['List[BaseJob]'] = None + """If true, additional jobs matching the provided filter are available for listing.""" + + jobs: Optional[List[BaseJob]] = None + """The list of jobs.""" + next_page_token: Optional[str] = None + """A token that can be used to list the next page of jobs.""" + prev_page_token: Optional[str] = None + """A token that can be used to list the previous page of jobs.""" def as_dict(self) -> dict: + """Serializes the ListJobsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.has_more is not None: body['has_more'] = self.has_more if self.jobs: body['jobs'] = [v.as_dict() for v in self.jobs] @@ -1097,7 +1678,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListJobsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListJobsResponse: + """Deserializes the ListJobsResponse from a dictionary.""" return cls(has_more=d.get('has_more', None), jobs=_repeated_dict(d, 'jobs', BaseJob), next_page_token=d.get('next_page_token', None), @@ -1107,11 +1689,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListJobsResponse': @dataclass class ListRunsResponse: has_more: Optional[bool] = None + """If true, additional runs matching the provided filter are available for listing.""" + next_page_token: Optional[str] = None + """A token that can be used to list the next page of runs.""" + prev_page_token: Optional[str] = None - runs: Optional['List[BaseRun]'] = None + """A token that can be used to list the previous page of runs.""" + + runs: Optional[List[BaseRun]] = None + """A list of runs, from most recently started to least.""" def as_dict(self) -> dict: + """Serializes the ListRunsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.has_more is not None: body['has_more'] = self.has_more if self.next_page_token is not None: body['next_page_token'] = self.next_page_token @@ -1120,7 +1710,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListRunsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListRunsResponse: + """Deserializes the ListRunsResponse from a dictionary.""" return cls(has_more=d.get('has_more', None), next_page_token=d.get('next_page_token', None), prev_page_token=d.get('prev_page_token', None), @@ -1142,26 +1733,63 @@ class ListRunsRunType(Enum): @dataclass class NotebookOutput: result: Optional[str] = None + """The value passed to + [dbutils.notebook.exit()](/notebooks/notebook-workflows.html#notebook-workflows-exit). + Databricks restricts this API to return the first 5 MB of the value. For a larger result, your + job can store the results in a cloud storage service. This field is absent if + `dbutils.notebook.exit()` was never called.""" + truncated: Optional[bool] = None + """Whether or not the result was truncated.""" def as_dict(self) -> dict: + """Serializes the NotebookOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.result is not None: body['result'] = self.result if self.truncated is not None: body['truncated'] = self.truncated return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NotebookOutput': + def from_dict(cls, d: Dict[str, any]) -> NotebookOutput: + """Deserializes the NotebookOutput from a dictionary.""" return cls(result=d.get('result', None), truncated=d.get('truncated', None)) @dataclass class NotebookTask: notebook_path: str - base_parameters: Optional['Dict[str,str]'] = None - source: Optional['Source'] = None + """The path of the notebook to be run in the Databricks workspace or remote repository. For + notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash. + For notebooks stored in a remote repository, the path must be relative. This field is required.""" + + base_parameters: Optional[Dict[str, str]] = None + """Base parameters to be used for each run of this job. If the run is initiated by a call to + :method:jobs/runNow with parameters specified, the two parameters maps are merged. If the same + key is specified in `base_parameters` and in `run-now`, the value from `run-now` is used. + + Use [Task parameter variables] to set parameters containing information about job runs. + + If the notebook takes a parameter that is not specified in the job’s `base_parameters` or the + `run-now` override parameters, the default value from the notebook is used. + + Retrieve these parameters in a notebook using [dbutils.widgets.get]. + + The JSON representation of this field cannot exceed 1MB. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-widgets""" + + source: Optional[Source] = None + """Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved + from the local workspace. When set to `GIT`, the notebook 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`: Notebook is located in workspace. * `GIT`: Notebook is located in + cloud Git provider.""" def as_dict(self) -> dict: + """Serializes the NotebookTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.base_parameters: body['base_parameters'] = self.base_parameters if self.notebook_path is not None: body['notebook_path'] = self.notebook_path @@ -1169,7 +1797,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NotebookTask': + def from_dict(cls, d: Dict[str, any]) -> NotebookTask: + """Deserializes the NotebookTask from a dictionary.""" return cls(base_parameters=d.get('base_parameters', None), notebook_path=d.get('notebook_path', None), source=_enum(d, 'source', Source)) @@ -1187,41 +1816,60 @@ class PauseStatus(Enum): @dataclass class PipelineParams: full_refresh: Optional[bool] = None + """If true, triggers a full refresh on the delta live table.""" def as_dict(self) -> dict: + """Serializes the PipelineParams into a dictionary suitable for use as a JSON request body.""" body = {} if self.full_refresh is not None: body['full_refresh'] = self.full_refresh return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineParams': + def from_dict(cls, d: Dict[str, any]) -> PipelineParams: + """Deserializes the PipelineParams from a dictionary.""" return cls(full_refresh=d.get('full_refresh', None)) @dataclass class PipelineTask: full_refresh: Optional[bool] = None + """If true, a full refresh will be triggered on the delta live table.""" + pipeline_id: Optional[str] = None + """The full name of the pipeline task to execute.""" def as_dict(self) -> dict: + """Serializes the PipelineTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.full_refresh is not None: body['full_refresh'] = self.full_refresh if self.pipeline_id is not None: body['pipeline_id'] = self.pipeline_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineTask': + def from_dict(cls, d: Dict[str, any]) -> PipelineTask: + """Deserializes the PipelineTask from a dictionary.""" return cls(full_refresh=d.get('full_refresh', None), pipeline_id=d.get('pipeline_id', None)) @dataclass class PythonWheelTask: entry_point: Optional[str] = None - named_parameters: Optional['Dict[str,str]'] = None + """Named entry point to use, if it does not exist in the metadata of the package it executes the + function from the package directly using `$packageName.$entryPoint()`""" + + named_parameters: Optional[Dict[str, str]] = None + """Command-line parameters passed to Python wheel task in the form of `["--name=task", + "--data=dbfs:/path/to/data.json"]`. Leave it empty if `parameters` is not null.""" + package_name: Optional[str] = None - parameters: Optional['List[str]'] = None + """Name of the package to execute""" + + parameters: Optional[List[str]] = None + """Command-line parameters passed to Python wheel task. Leave it empty if `named_parameters` is not + null.""" def as_dict(self) -> dict: + """Serializes the PythonWheelTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.entry_point is not None: body['entry_point'] = self.entry_point if self.named_parameters: body['named_parameters'] = self.named_parameters @@ -1230,7 +1878,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PythonWheelTask': + def from_dict(cls, d: Dict[str, any]) -> PythonWheelTask: + """Deserializes the PythonWheelTask from a dictionary.""" return cls(entry_point=d.get('entry_point', None), named_parameters=d.get('named_parameters', None), package_name=d.get('package_name', None), @@ -1240,27 +1889,42 @@ def from_dict(cls, d: Dict[str, any]) -> 'PythonWheelTask': @dataclass class QueueSettings: enabled: bool + """If true, enable queueing for the job. This is a required field.""" def as_dict(self) -> dict: + """Serializes the QueueSettings into a dictionary suitable for use as a JSON request body.""" body = {} if self.enabled is not None: body['enabled'] = self.enabled return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueueSettings': + def from_dict(cls, d: Dict[str, any]) -> QueueSettings: + """Deserializes the QueueSettings from a dictionary.""" return cls(enabled=d.get('enabled', None)) @dataclass class RepairHistoryItem: end_time: Optional[int] = None + """The end time of the (repaired) run.""" + id: Optional[int] = None + """The ID of the repair. Only returned for the items that represent a repair in `repair_history`.""" + start_time: Optional[int] = None - state: Optional['RunState'] = None - task_run_ids: Optional['List[int]'] = None - type: Optional['RepairHistoryItemType'] = None + """The start time of the (repaired) run.""" + + state: Optional[RunState] = None + """The current state of the run.""" + + task_run_ids: Optional[List[int]] = None + """The run IDs of the task runs that ran as part of this repair history item.""" + + type: Optional[RepairHistoryItemType] = None + """The repair history item type. Indicates whether a run is the original run or a repair run.""" def as_dict(self) -> dict: + """Serializes the RepairHistoryItem into a dictionary suitable for use as a JSON request body.""" body = {} if self.end_time is not None: body['end_time'] = self.end_time if self.id is not None: body['id'] = self.id @@ -1271,7 +1935,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepairHistoryItem': + def from_dict(cls, d: Dict[str, any]) -> RepairHistoryItem: + """Deserializes the RepairHistoryItem from a dictionary.""" return cls(end_time=d.get('end_time', None), id=d.get('id', None), start_time=d.get('start_time', None), @@ -1290,21 +1955,102 @@ class RepairHistoryItemType(Enum): @dataclass class RepairRun: run_id: int - dbt_commands: Optional['List[str]'] = None - jar_params: Optional['List[str]'] = None - job_parameters: Optional['Dict[str,str]'] = None + """The job run ID of the run to repair. The run must not be in progress.""" + + dbt_commands: Optional[List[str]] = None + """An array of commands to execute for jobs with the dbt task, for example `"dbt_commands": ["dbt + deps", "dbt seed", "dbt run"]`""" + + jar_params: Optional[List[str]] = None + """A list of parameters for jobs with Spark JAR tasks, for example `"jar_params": ["john doe", + "35"]`. The parameters are used to invoke the main function of the main class specified in the + Spark JAR task. If not specified upon `run-now`, it defaults to an empty list. jar_params cannot + be specified in conjunction with notebook_params. The JSON representation of this field (for + example `{"jar_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables](/jobs.html"#parameter-variables") to set parameters containing + information about job runs.""" + + job_parameters: Optional[Dict[str, str]] = None + """Job-level parameters used in the run. for example `"param": "overriding_val"`""" + latest_repair_id: Optional[int] = None - notebook_params: Optional['Dict[str,str]'] = None - pipeline_params: Optional['PipelineParams'] = None - python_named_params: Optional['Dict[str,str]'] = None - python_params: Optional['List[str]'] = None - rerun_all_failed_tasks: Optional[bool] = None - rerun_dependent_tasks: Optional[bool] = None - rerun_tasks: Optional['List[str]'] = None - spark_submit_params: Optional['List[str]'] = None - sql_params: Optional['Dict[str,str]'] = None + """The ID of the latest repair. This parameter is not required when repairing a run for the first + time, but must be provided on subsequent requests to repair the same run.""" - def as_dict(self) -> dict: + notebook_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with notebook task, for example `"notebook_params": {"name": + "john doe", "age": "35"}`. The map is passed to the notebook and is accessible through the + [dbutils.widgets.get] function. + + If not specified upon `run-now`, the triggered run uses the job’s base parameters. + + notebook_params cannot be specified in conjunction with jar_params. + + Use [Task parameter variables] to set parameters containing information about job runs. + + The JSON representation of this field (for example `{"notebook_params":{"name":"john + doe","age":"35"}}`) cannot exceed 10,000 bytes. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html""" + + pipeline_params: Optional[PipelineParams] = None + + python_named_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with Python wheel task, for example `"python_named_params": + {"name": "task", "data": "dbfs:/path/to/data.json"}`.""" + + python_params: Optional[List[str]] = None + """A list of parameters for jobs with Python tasks, for example `"python_params": ["john doe", + "35"]`. The parameters are passed to Python file as command-line parameters. If specified upon + `run-now`, it would overwrite the parameters specified in job setting. The JSON representation + of this field (for example `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables] to set parameters containing information about job runs. + + Important + + These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters + returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and + emojis. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + rerun_all_failed_tasks: Optional[bool] = None + """If true, repair all failed tasks. Only one of `rerun_tasks` or `rerun_all_failed_tasks` can be + used.""" + + rerun_dependent_tasks: Optional[bool] = None + """If true, repair all tasks that depend on the tasks in `rerun_tasks`, even if they were + previously successful. Can be also used in combination with `rerun_all_failed_tasks`.""" + + rerun_tasks: Optional[List[str]] = None + """The task keys of the task runs to repair.""" + + spark_submit_params: Optional[List[str]] = None + """A list of parameters for jobs with spark submit task, for example `"spark_submit_params": + ["--class", "org.apache.spark.examples.SparkPi"]`. The parameters are passed to spark-submit + script as command-line parameters. If specified upon `run-now`, it would overwrite the + parameters specified in job setting. The JSON representation of this field (for example + `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables] to set parameters containing information about job runs + + Important + + These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters + returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and + emojis. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + sql_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with SQL task, for example `"sql_params": {"name": "john + doe", "age": "35"}`. The SQL alert task does not support custom parameters.""" + + def as_dict(self) -> dict: + """Serializes the RepairRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbt_commands: body['dbt_commands'] = [v for v in self.dbt_commands] if self.jar_params: body['jar_params'] = [v for v in self.jar_params] @@ -1324,7 +2070,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepairRun': + def from_dict(cls, d: Dict[str, any]) -> RepairRun: + """Deserializes the RepairRun from a dictionary.""" return cls(dbt_commands=d.get('dbt_commands', None), jar_params=d.get('jar_params', None), job_parameters=d.get('job_parameters', None), @@ -1344,151 +2091,190 @@ def from_dict(cls, d: Dict[str, any]) -> 'RepairRun': @dataclass class RepairRunResponse: repair_id: Optional[int] = None + """The ID of the repair. Must be provided in subsequent repairs using the `latest_repair_id` field + to ensure sequential repairs.""" def as_dict(self) -> dict: + """Serializes the RepairRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.repair_id is not None: body['repair_id'] = self.repair_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepairRunResponse': + def from_dict(cls, d: Dict[str, any]) -> RepairRunResponse: + """Deserializes the RepairRunResponse from a dictionary.""" return cls(repair_id=d.get('repair_id', None)) @dataclass class ResetJob: job_id: int - new_settings: 'JobSettings' + """The canonical identifier of the job to reset. This field is required.""" + + new_settings: JobSettings + """The new settings of the job. These settings completely replace the old settings. + + Changes to the field `JobBaseSettings.timeout_seconds` are applied to active runs. Changes to + other fields are applied to future runs only.""" def as_dict(self) -> dict: + """Serializes the ResetJob into a dictionary suitable for use as a JSON request body.""" body = {} if self.job_id is not None: body['job_id'] = self.job_id if self.new_settings: body['new_settings'] = self.new_settings.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResetJob': + def from_dict(cls, d: Dict[str, any]) -> ResetJob: + """Deserializes the ResetJob from a dictionary.""" return cls(job_id=d.get('job_id', None), new_settings=_from_dict(d, 'new_settings', JobSettings)) @dataclass class ResolvedConditionTaskValues: left: Optional[str] = None + right: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ResolvedConditionTaskValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.left is not None: body['left'] = self.left if self.right is not None: body['right'] = self.right return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedConditionTaskValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedConditionTaskValues: + """Deserializes the ResolvedConditionTaskValues from a dictionary.""" return cls(left=d.get('left', None), right=d.get('right', None)) @dataclass class ResolvedDbtTaskValues: - commands: Optional['List[str]'] = None + commands: Optional[List[str]] = None def as_dict(self) -> dict: + """Serializes the ResolvedDbtTaskValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.commands: body['commands'] = [v for v in self.commands] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedDbtTaskValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedDbtTaskValues: + """Deserializes the ResolvedDbtTaskValues from a dictionary.""" return cls(commands=d.get('commands', None)) @dataclass class ResolvedNotebookTaskValues: - base_parameters: Optional['Dict[str,str]'] = None + base_parameters: Optional[Dict[str, str]] = None def as_dict(self) -> dict: + """Serializes the ResolvedNotebookTaskValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.base_parameters: body['base_parameters'] = self.base_parameters return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedNotebookTaskValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedNotebookTaskValues: + """Deserializes the ResolvedNotebookTaskValues from a dictionary.""" return cls(base_parameters=d.get('base_parameters', None)) @dataclass class ResolvedParamPairValues: - parameters: Optional['Dict[str,str]'] = None + parameters: Optional[Dict[str, str]] = None def as_dict(self) -> dict: + """Serializes the ResolvedParamPairValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.parameters: body['parameters'] = self.parameters return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedParamPairValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedParamPairValues: + """Deserializes the ResolvedParamPairValues from a dictionary.""" return cls(parameters=d.get('parameters', None)) @dataclass class ResolvedPythonWheelTaskValues: - named_parameters: Optional['Dict[str,str]'] = None - parameters: Optional['List[str]'] = None + named_parameters: Optional[Dict[str, str]] = None + + parameters: Optional[List[str]] = None def as_dict(self) -> dict: + """Serializes the ResolvedPythonWheelTaskValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.named_parameters: body['named_parameters'] = self.named_parameters if self.parameters: body['parameters'] = [v for v in self.parameters] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedPythonWheelTaskValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedPythonWheelTaskValues: + """Deserializes the ResolvedPythonWheelTaskValues from a dictionary.""" return cls(named_parameters=d.get('named_parameters', None), parameters=d.get('parameters', None)) @dataclass class ResolvedRunJobTaskValues: - named_parameters: Optional['Dict[str,str]'] = None - parameters: Optional['Dict[str,str]'] = None + named_parameters: Optional[Dict[str, str]] = None + + parameters: Optional[Dict[str, str]] = None def as_dict(self) -> dict: + """Serializes the ResolvedRunJobTaskValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.named_parameters: body['named_parameters'] = self.named_parameters if self.parameters: body['parameters'] = self.parameters return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedRunJobTaskValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedRunJobTaskValues: + """Deserializes the ResolvedRunJobTaskValues from a dictionary.""" return cls(named_parameters=d.get('named_parameters', None), parameters=d.get('parameters', None)) @dataclass class ResolvedStringParamsValues: - parameters: Optional['List[str]'] = None + parameters: Optional[List[str]] = None def as_dict(self) -> dict: + """Serializes the ResolvedStringParamsValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.parameters: body['parameters'] = [v for v in self.parameters] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedStringParamsValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedStringParamsValues: + """Deserializes the ResolvedStringParamsValues from a dictionary.""" return cls(parameters=d.get('parameters', None)) @dataclass class ResolvedValues: - condition_task: Optional['ResolvedConditionTaskValues'] = None - dbt_task: Optional['ResolvedDbtTaskValues'] = None - notebook_task: Optional['ResolvedNotebookTaskValues'] = None - python_wheel_task: Optional['ResolvedPythonWheelTaskValues'] = None - run_job_task: Optional['ResolvedRunJobTaskValues'] = None - simulation_task: Optional['ResolvedParamPairValues'] = None - spark_jar_task: Optional['ResolvedStringParamsValues'] = None - spark_python_task: Optional['ResolvedStringParamsValues'] = None - spark_submit_task: Optional['ResolvedStringParamsValues'] = None - sql_task: Optional['ResolvedParamPairValues'] = None + condition_task: Optional[ResolvedConditionTaskValues] = None + + dbt_task: Optional[ResolvedDbtTaskValues] = None + + notebook_task: Optional[ResolvedNotebookTaskValues] = None + + python_wheel_task: Optional[ResolvedPythonWheelTaskValues] = None + + run_job_task: Optional[ResolvedRunJobTaskValues] = None + + simulation_task: Optional[ResolvedParamPairValues] = None + + spark_jar_task: Optional[ResolvedStringParamsValues] = None + + spark_python_task: Optional[ResolvedStringParamsValues] = None + + spark_submit_task: Optional[ResolvedStringParamsValues] = None + + sql_task: Optional[ResolvedParamPairValues] = None def as_dict(self) -> dict: + """Serializes the ResolvedValues into a dictionary suitable for use as a JSON request body.""" body = {} if self.condition_task: body['condition_task'] = self.condition_task.as_dict() if self.dbt_task: body['dbt_task'] = self.dbt_task.as_dict() @@ -1503,7 +2289,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResolvedValues': + def from_dict(cls, d: Dict[str, any]) -> ResolvedValues: + """Deserializes the ResolvedValues from a dictionary.""" return cls(condition_task=_from_dict(d, 'condition_task', ResolvedConditionTaskValues), dbt_task=_from_dict(d, 'dbt_task', ResolvedDbtTaskValues), notebook_task=_from_dict(d, 'notebook_task', ResolvedNotebookTaskValues), @@ -1519,35 +2306,133 @@ def from_dict(cls, d: Dict[str, any]) -> 'ResolvedValues': @dataclass class Run: attempt_number: Optional[int] = None + """The sequence number of this run attempt for a triggered job run. The initial attempt of a run + has an attempt_number of 0\. If the initial run attempt fails, and the job has a retry policy + (`max_retries` \> 0), subsequent runs are created with an `original_attempt_run_id` of the + original attempt’s ID and an incrementing `attempt_number`. Runs are retried only until they + succeed, and the maximum `attempt_number` is the same as the `max_retries` value for the job.""" + cleanup_duration: Optional[int] = None - cluster_instance: Optional['ClusterInstance'] = None - cluster_spec: Optional['ClusterSpec'] = None - continuous: Optional['Continuous'] = None + """The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. + The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the + `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + + cluster_instance: Optional[ClusterInstance] = None + """The cluster used for this run. If the run is specified to use a new cluster, this field is set + once the Jobs service has requested a cluster for the run.""" + + cluster_spec: Optional[ClusterSpec] = None + """A snapshot of the job’s cluster specification when this run was created.""" + + continuous: Optional[Continuous] = None + """The continuous trigger that triggered this run.""" + creator_user_name: Optional[str] = None + """The creator user name. This field won’t be included in the response if the user has already + been deleted.""" + end_time: Optional[int] = None + """The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This + field is set to 0 if the job is still running.""" + execution_duration: Optional[int] = None - git_source: Optional['GitSource'] = None - job_clusters: Optional['List[JobCluster]'] = None + """The time in milliseconds it took to execute the commands in the JAR or notebook until they + completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration + of a task run is the sum of the `setup_duration`, `execution_duration`, and the + `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + + git_source: Optional[GitSource] = None + """An optional specification for a remote Git repository containing the source code used by tasks. + Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. + + If `git_source` is set, these tasks retrieve the file from the remote repository by default. + However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. + + Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks + are used, `git_source` must be defined on the job.""" + + job_clusters: Optional[List[JobCluster]] = None + """A list of job cluster specifications that can be shared and reused by tasks of this job. + Libraries cannot be declared in a shared job cluster. You must declare dependent libraries in + task settings.""" + job_id: Optional[int] = None - job_parameters: Optional['List[JobParameter]'] = None + """The canonical identifier of the job that contains this run.""" + + job_parameters: Optional[List[JobParameter]] = None + """Job-level parameters used in the run""" + number_in_job: Optional[int] = None + """A unique identifier for this job run. This is set to the same value as `run_id`.""" + original_attempt_run_id: Optional[int] = None - overriding_parameters: Optional['RunParameters'] = None - repair_history: Optional['List[RepairHistoryItem]'] = None + """If this run is a retry of a prior run attempt, this field contains the run_id of the original + attempt; otherwise, it is the same as the run_id.""" + + overriding_parameters: Optional[RunParameters] = None + """The parameters used for this run.""" + + repair_history: Optional[List[RepairHistoryItem]] = None + """The repair history of the run.""" + run_duration: Optional[int] = None + """The time in milliseconds it took the job run and all of its repairs to finish.""" + run_id: Optional[int] = None + """The canonical identifier of the run. This ID is unique across all runs of all jobs.""" + run_name: Optional[str] = None + """An optional name for the run. The maximum length is 4096 bytes in UTF-8 encoding.""" + run_page_url: Optional[str] = None - run_type: Optional['RunType'] = None - schedule: Optional['CronSchedule'] = None + """The URL to the detail page of the run.""" + + run_type: Optional[RunType] = None + """* `JOB_RUN`: Normal job run. A run created with :method:jobs/runNow. * `WORKFLOW_RUN`: Workflow + run. A run created with [dbutils.notebook.run]. * `SUBMIT_RUN`: Submit run. A run created with + :method:jobs/submit. + + [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow""" + + schedule: Optional[CronSchedule] = None + """The cron schedule that triggered this run if it was triggered by the periodic scheduler.""" + setup_duration: Optional[int] = None + """The time in milliseconds it took to set up the cluster. For runs that run on new clusters this + is the cluster creation time, for runs that run on existing clusters this time should be very + short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and + the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + start_time: Optional[int] = None - state: Optional['RunState'] = None - tasks: Optional['List[RunTask]'] = None - trigger: Optional['TriggerType'] = None - trigger_info: Optional['TriggerInfo'] = None + """The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). + This may not be the time when the job task starts executing, for example, if the job is + scheduled to run on a new cluster, this is the time the cluster creation call is issued.""" + + state: Optional[RunState] = None + """The current state of the run.""" + + tasks: Optional[List[RunTask]] = None + """The list of tasks performed by the run. Each task has its own `run_id` which you can use to call + `JobsGetOutput` to retrieve the run resutls.""" + + trigger: Optional[TriggerType] = None + """The type of trigger that fired this run. + + * `PERIODIC`: Schedules that periodically trigger runs, such as a cron scheduler. * `ONE_TIME`: + One time triggers that fire a single run. This occurs you triggered a single run on demand + through the UI or the API. * `RETRY`: Indicates a run that is triggered as a retry of a + previously failed run. This occurs when you request to re-run the job in case of failures. * + `RUN_JOB_TASK`: Indicates a run that is triggered using a Run Job task. + + * `FILE_ARRIVAL`: Indicates a run that is triggered by a file arrival.""" + + trigger_info: Optional[TriggerInfo] = None def as_dict(self) -> dict: + """Serializes the Run into a dictionary suitable for use as a JSON request body.""" body = {} if self.attempt_number is not None: body['attempt_number'] = self.attempt_number if self.cleanup_duration is not None: body['cleanup_duration'] = self.cleanup_duration @@ -1581,7 +2466,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Run': + def from_dict(cls, d: Dict[str, any]) -> Run: + """Deserializes the Run from a dictionary.""" return cls(attempt_number=d.get('attempt_number', None), cleanup_duration=d.get('cleanup_duration', None), cluster_instance=_from_dict(d, 'cluster_instance', ClusterInstance), @@ -1615,11 +2501,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'Run': @dataclass class RunConditionTask: left: str + """The left operand of the condition task.""" + right: str - op: 'RunConditionTaskOp' + """The right operand of the condition task.""" + + op: RunConditionTaskOp + """The condtion task operator.""" + outcome: Optional[str] = None + """The condition expression evaluation result. Filled in if the task was successfully completed. + Can be `"true"` or `"false"`""" def as_dict(self) -> dict: + """Serializes the RunConditionTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.left is not None: body['left'] = self.left if self.op is not None: body['op'] = self.op.value @@ -1628,7 +2523,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunConditionTask': + def from_dict(cls, d: Dict[str, any]) -> RunConditionTask: + """Deserializes the RunConditionTask from a dictionary.""" return cls(left=d.get('left', None), op=_enum(d, 'op', RunConditionTaskOp), outcome=d.get('outcome', None), @@ -1667,30 +2563,38 @@ class RunIf(Enum): @dataclass class RunJobOutput: run_id: Optional[int] = None + """The run id of the triggered job run""" def as_dict(self) -> dict: + """Serializes the RunJobOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunJobOutput': + def from_dict(cls, d: Dict[str, any]) -> RunJobOutput: + """Deserializes the RunJobOutput from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class RunJobTask: job_id: int + """ID of the job to trigger.""" + job_parameters: Optional[Any] = None + """Job-level parameters used to trigger the job.""" def as_dict(self) -> dict: + """Serializes the RunJobTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.job_id is not None: body['job_id'] = self.job_id if self.job_parameters: body['job_parameters'] = self.job_parameters return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunJobTask': + def from_dict(cls, d: Dict[str, any]) -> RunJobTask: + """Deserializes the RunJobTask from a dictionary.""" return cls(job_id=d.get('job_id', None), job_parameters=d.get('job_parameters', None)) @@ -1721,19 +2625,104 @@ class RunLifeCycleState(Enum): @dataclass class RunNow: job_id: int - dbt_commands: Optional['List[str]'] = None + """The ID of the job to be executed""" + + dbt_commands: Optional[List[str]] = None + """An array of commands to execute for jobs with the dbt task, for example `"dbt_commands": ["dbt + deps", "dbt seed", "dbt run"]`""" + idempotency_token: Optional[str] = None - jar_params: Optional['List[str]'] = None - job_parameters: Optional['Dict[str,str]'] = None - notebook_params: Optional['Dict[str,str]'] = None - pipeline_params: Optional['PipelineParams'] = None - python_named_params: Optional['Dict[str,str]'] = None - python_params: Optional['List[str]'] = None - queue: Optional['QueueSettings'] = None - spark_submit_params: Optional['List[str]'] = None - sql_params: Optional['Dict[str,str]'] = None + """An optional token to guarantee the idempotency of job run requests. If a run with the provided + token already exists, the request does not create a new run but returns the ID of the existing + run instead. If a run with the provided token is deleted, an error is returned. + + If you specify the idempotency token, upon failure you can retry until the request succeeds. + Databricks guarantees that exactly one run is launched with that idempotency token. + + This token must have at most 64 characters. + + For more information, see [How to ensure idempotency for jobs]. + + [How to ensure idempotency for jobs]: https://kb.databricks.com/jobs/jobs-idempotency.html""" + + jar_params: Optional[List[str]] = None + """A list of parameters for jobs with Spark JAR tasks, for example `"jar_params": ["john doe", + "35"]`. The parameters are used to invoke the main function of the main class specified in the + Spark JAR task. If not specified upon `run-now`, it defaults to an empty list. jar_params cannot + be specified in conjunction with notebook_params. The JSON representation of this field (for + example `{"jar_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables](/jobs.html"#parameter-variables") to set parameters containing + information about job runs.""" + + job_parameters: Optional[Dict[str, str]] = None + """Job-level parameters used in the run. for example `"param": "overriding_val"`""" + + notebook_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with notebook task, for example `"notebook_params": {"name": + "john doe", "age": "35"}`. The map is passed to the notebook and is accessible through the + [dbutils.widgets.get] function. + + If not specified upon `run-now`, the triggered run uses the job’s base parameters. + + notebook_params cannot be specified in conjunction with jar_params. + + Use [Task parameter variables] to set parameters containing information about job runs. + + The JSON representation of this field (for example `{"notebook_params":{"name":"john + doe","age":"35"}}`) cannot exceed 10,000 bytes. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html""" + + pipeline_params: Optional[PipelineParams] = None + + python_named_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with Python wheel task, for example `"python_named_params": + {"name": "task", "data": "dbfs:/path/to/data.json"}`.""" + + python_params: Optional[List[str]] = None + """A list of parameters for jobs with Python tasks, for example `"python_params": ["john doe", + "35"]`. The parameters are passed to Python file as command-line parameters. If specified upon + `run-now`, it would overwrite the parameters specified in job setting. The JSON representation + of this field (for example `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables] to set parameters containing information about job runs. + + Important + + These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters + returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and + emojis. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + queue: Optional[QueueSettings] = None + """The queue settings of the run.""" + + spark_submit_params: Optional[List[str]] = None + """A list of parameters for jobs with spark submit task, for example `"spark_submit_params": + ["--class", "org.apache.spark.examples.SparkPi"]`. The parameters are passed to spark-submit + script as command-line parameters. If specified upon `run-now`, it would overwrite the + parameters specified in job setting. The JSON representation of this field (for example + `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables] to set parameters containing information about job runs + + Important + + These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters + returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and + emojis. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + sql_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with SQL task, for example `"sql_params": {"name": "john + doe", "age": "35"}`. The SQL alert task does not support custom parameters.""" def as_dict(self) -> dict: + """Serializes the RunNow into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbt_commands: body['dbt_commands'] = [v for v in self.dbt_commands] if self.idempotency_token is not None: body['idempotency_token'] = self.idempotency_token @@ -1750,7 +2739,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunNow': + def from_dict(cls, d: Dict[str, any]) -> RunNow: + """Deserializes the RunNow from a dictionary.""" return cls(dbt_commands=d.get('dbt_commands', None), idempotency_token=d.get('idempotency_token', None), jar_params=d.get('jar_params', None), @@ -1768,32 +2758,66 @@ def from_dict(cls, d: Dict[str, any]) -> 'RunNow': @dataclass class RunNowResponse: number_in_job: Optional[int] = None + """A unique identifier for this job run. This is set to the same value as `run_id`.""" + run_id: Optional[int] = None + """The globally unique ID of the newly triggered run.""" def as_dict(self) -> dict: + """Serializes the RunNowResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.number_in_job is not None: body['number_in_job'] = self.number_in_job if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunNowResponse': + def from_dict(cls, d: Dict[str, any]) -> RunNowResponse: + """Deserializes the RunNowResponse from a dictionary.""" return cls(number_in_job=d.get('number_in_job', None), run_id=d.get('run_id', None)) @dataclass class RunOutput: - dbt_output: Optional['DbtOutput'] = None + dbt_output: Optional[DbtOutput] = None + """The output of a dbt task, if available.""" + error: Optional[str] = None + """An error message indicating why a task failed or why output is not available. The message is + unstructured, and its exact format is subject to change.""" + error_trace: Optional[str] = None + """If there was an error executing the run, this field contains any available stack traces.""" + logs: Optional[str] = None + """The output from tasks that write to standard streams (stdout/stderr) such as spark_jar_task, + spark_python_task, python_wheel_task. + + It's not supported for the notebook_task, pipeline_task or spark_submit_task. + + Databricks restricts this API to return the last 5 MB of these logs.""" + logs_truncated: Optional[bool] = None - metadata: Optional['Run'] = None - notebook_output: Optional['NotebookOutput'] = None - run_job_output: Optional['RunJobOutput'] = None - sql_output: Optional['SqlOutput'] = None + """Whether the logs are truncated.""" + + metadata: Optional[Run] = None + """All details of the run except for its output.""" + + notebook_output: Optional[NotebookOutput] = None + """The output of a notebook task, if available. A notebook task that terminates (either + successfully or with a failure) without calling `dbutils.notebook.exit()` is considered to have + an empty output. This field is set but its result value is empty. restricts this + API to return the first 5 MB of the output. To return a larger result, use the + [ClusterLogConf](/dev-tools/api/latest/clusters.html#clusterlogconf) field to configure log + storage for the job cluster.""" + + run_job_output: Optional[RunJobOutput] = None + """The output of a run job task, if available""" + + sql_output: Optional[SqlOutput] = None + """The output of a SQL task, if available.""" def as_dict(self) -> dict: + """Serializes the RunOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbt_output: body['dbt_output'] = self.dbt_output.as_dict() if self.error is not None: body['error'] = self.error @@ -1807,7 +2831,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunOutput': + def from_dict(cls, d: Dict[str, any]) -> RunOutput: + """Deserializes the RunOutput from a dictionary.""" return cls(dbt_output=_from_dict(d, 'dbt_output', DbtOutput), error=d.get('error', None), error_trace=d.get('error_trace', None), @@ -1821,17 +2846,85 @@ def from_dict(cls, d: Dict[str, any]) -> 'RunOutput': @dataclass class RunParameters: - dbt_commands: Optional['List[str]'] = None - jar_params: Optional['List[str]'] = None - job_parameters: Optional['Dict[str,str]'] = None - notebook_params: Optional['Dict[str,str]'] = None - pipeline_params: Optional['PipelineParams'] = None - python_named_params: Optional['Dict[str,str]'] = None - python_params: Optional['List[str]'] = None - spark_submit_params: Optional['List[str]'] = None - sql_params: Optional['Dict[str,str]'] = None + dbt_commands: Optional[List[str]] = None + """An array of commands to execute for jobs with the dbt task, for example `"dbt_commands": ["dbt + deps", "dbt seed", "dbt run"]`""" + + jar_params: Optional[List[str]] = None + """A list of parameters for jobs with Spark JAR tasks, for example `"jar_params": ["john doe", + "35"]`. The parameters are used to invoke the main function of the main class specified in the + Spark JAR task. If not specified upon `run-now`, it defaults to an empty list. jar_params cannot + be specified in conjunction with notebook_params. The JSON representation of this field (for + example `{"jar_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables](/jobs.html"#parameter-variables") to set parameters containing + information about job runs.""" + + job_parameters: Optional[Dict[str, str]] = None + """Job-level parameters used in the run. for example `"param": "overriding_val"`""" + + notebook_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with notebook task, for example `"notebook_params": {"name": + "john doe", "age": "35"}`. The map is passed to the notebook and is accessible through the + [dbutils.widgets.get] function. + + If not specified upon `run-now`, the triggered run uses the job’s base parameters. + + notebook_params cannot be specified in conjunction with jar_params. + + Use [Task parameter variables] to set parameters containing information about job runs. + + The JSON representation of this field (for example `{"notebook_params":{"name":"john + doe","age":"35"}}`) cannot exceed 10,000 bytes. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables + [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html""" + + pipeline_params: Optional[PipelineParams] = None + + python_named_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with Python wheel task, for example `"python_named_params": + {"name": "task", "data": "dbfs:/path/to/data.json"}`.""" + + python_params: Optional[List[str]] = None + """A list of parameters for jobs with Python tasks, for example `"python_params": ["john doe", + "35"]`. The parameters are passed to Python file as command-line parameters. If specified upon + `run-now`, it would overwrite the parameters specified in job setting. The JSON representation + of this field (for example `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables] to set parameters containing information about job runs. + + Important + + These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters + returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and + emojis. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + spark_submit_params: Optional[List[str]] = None + """A list of parameters for jobs with spark submit task, for example `"spark_submit_params": + ["--class", "org.apache.spark.examples.SparkPi"]`. The parameters are passed to spark-submit + script as command-line parameters. If specified upon `run-now`, it would overwrite the + parameters specified in job setting. The JSON representation of this field (for example + `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. + + Use [Task parameter variables] to set parameters containing information about job runs + + Important + + These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters + returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and + emojis. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + sql_params: Optional[Dict[str, str]] = None + """A map from keys to values for jobs with SQL task, for example `"sql_params": {"name": "john + doe", "age": "35"}`. The SQL alert task does not support custom parameters.""" def as_dict(self) -> dict: + """Serializes the RunParameters into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbt_commands: body['dbt_commands'] = [v for v in self.dbt_commands] if self.jar_params: body['jar_params'] = [v for v in self.jar_params] @@ -1845,7 +2938,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunParameters': + def from_dict(cls, d: Dict[str, any]) -> RunParameters: + """Deserializes the RunParameters from a dictionary.""" return cls(dbt_commands=d.get('dbt_commands', None), jar_params=d.get('jar_params', None), job_parameters=d.get('job_parameters', None), @@ -1882,13 +2976,26 @@ class RunResultState(Enum): class RunState: """The current state of the run.""" - life_cycle_state: Optional['RunLifeCycleState'] = None + life_cycle_state: Optional[RunLifeCycleState] = None + """A value indicating the run's current lifecycle state. This field is always available in the + response.""" + queue_reason: Optional[str] = None - result_state: Optional['RunResultState'] = None + """The reason indicating why the run was queued.""" + + result_state: Optional[RunResultState] = None + """A value indicating the run's result. This field is only available for terminal lifecycle states.""" + state_message: Optional[str] = None + """A descriptive message for the current state. This field is unstructured, and its exact format is + subject to change.""" + user_cancelled_or_timedout: Optional[bool] = None + """A value indicating whether a run was canceled manually by a user or by the scheduler because the + run timed out.""" def as_dict(self) -> dict: + """Serializes the RunState into a dictionary suitable for use as a JSON request body.""" body = {} if self.life_cycle_state is not None: body['life_cycle_state'] = self.life_cycle_state.value if self.queue_reason is not None: body['queue_reason'] = self.queue_reason @@ -1899,7 +3006,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunState': + def from_dict(cls, d: Dict[str, any]) -> RunState: + """Deserializes the RunState from a dictionary.""" return cls(life_cycle_state=_enum(d, 'life_cycle_state', RunLifeCycleState), queue_reason=d.get('queue_reason', None), result_state=_enum(d, 'result_state', RunResultState), @@ -1910,36 +3018,147 @@ def from_dict(cls, d: Dict[str, any]) -> 'RunState': @dataclass class RunTask: attempt_number: Optional[int] = None + """The sequence number of this run attempt for a triggered job run. The initial attempt of a run + has an attempt_number of 0\. If the initial run attempt fails, and the job has a retry policy + (`max_retries` \> 0), subsequent runs are created with an `original_attempt_run_id` of the + original attempt’s ID and an incrementing `attempt_number`. Runs are retried only until they + succeed, and the maximum `attempt_number` is the same as the `max_retries` value for the job.""" + cleanup_duration: Optional[int] = None - cluster_instance: Optional['ClusterInstance'] = None - condition_task: Optional['RunConditionTask'] = None - dbt_task: Optional['DbtTask'] = None - depends_on: Optional['List[TaskDependency]'] = None + """The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. + The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the + `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + + cluster_instance: Optional[ClusterInstance] = None + """The cluster used for this run. If the run is specified to use a new cluster, this field is set + once the Jobs service has requested a cluster for the run.""" + + condition_task: Optional[RunConditionTask] = None + """If condition_task, specifies a condition with an outcome that can be used to control the + execution of other tasks. Does not require a cluster to execute and does not support retries or + notifications.""" + + dbt_task: Optional[DbtTask] = None + """If dbt_task, indicates that this must execute a dbt task. It requires both Databricks SQL and + the ability to use a serverless or a pro SQL warehouse.""" + + depends_on: Optional[List[TaskDependency]] = None + """An optional array of objects specifying the dependency graph of the task. All tasks specified in + this field must complete successfully before executing this task. The key is `task_key`, and the + value is the name assigned to the dependent task.""" + description: Optional[str] = None + """An optional description for this task.""" + end_time: Optional[int] = None + """The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This + field is set to 0 if the job is still running.""" + execution_duration: Optional[int] = None + """The time in milliseconds it took to execute the commands in the JAR or notebook until they + completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration + of a task run is the sum of the `setup_duration`, `execution_duration`, and the + `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + existing_cluster_id: Optional[str] = None - git_source: Optional['GitSource'] = None - libraries: Optional['List[compute.Library]'] = None - new_cluster: Optional['compute.ClusterSpec'] = None - notebook_task: Optional['NotebookTask'] = None - pipeline_task: Optional['PipelineTask'] = None - python_wheel_task: Optional['PythonWheelTask'] = None + """If existing_cluster_id, the ID of an existing cluster that is used for all runs of this job. + When running jobs on an existing cluster, you may need to manually restart the cluster if it + stops responding. We suggest running jobs on new clusters for greater reliability.""" + + git_source: Optional[GitSource] = None + """An optional specification for a remote Git repository containing the source code used by tasks. + Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. + + If `git_source` is set, these tasks retrieve the file from the remote repository by default. + However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. + + Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks + are used, `git_source` must be defined on the job.""" + + libraries: Optional[List[compute.Library]] = None + """An optional list of libraries to be installed on the cluster that executes the job. The default + value is an empty list.""" + + new_cluster: Optional[compute.ClusterSpec] = None + """If new_cluster, a description of a new cluster that is created only for this task.""" + + notebook_task: Optional[NotebookTask] = None + """If notebook_task, indicates that this job must run a notebook. This field may not be specified + in conjunction with spark_jar_task.""" + + pipeline_task: Optional[PipelineTask] = None + """If pipeline_task, indicates that this job must execute a Pipeline.""" + + python_wheel_task: Optional[PythonWheelTask] = None + """If python_wheel_task, indicates that this job must execute a PythonWheel.""" + queue_duration: Optional[int] = None - resolved_values: Optional['ResolvedValues'] = None + """The time in milliseconds that the run has spent in the queue.""" + + resolved_values: Optional[ResolvedValues] = None + """Parameter values including resolved references""" + run_id: Optional[int] = None - run_if: Optional['RunIf'] = None - run_job_task: Optional['RunJobTask'] = None + """The ID of the task run.""" + + run_if: Optional[RunIf] = None + """An optional value indicating the condition that determines whether the task should be run once + its dependencies have been completed. When omitted, defaults to `ALL_SUCCESS`. See + :method:jobs/create for a list of possible values.""" + + run_job_task: Optional[RunJobTask] = None + """If run_job_task, indicates that this task must execute another job.""" + setup_duration: Optional[int] = None - spark_jar_task: Optional['SparkJarTask'] = None - spark_python_task: Optional['SparkPythonTask'] = None - spark_submit_task: Optional['SparkSubmitTask'] = None - sql_task: Optional['SqlTask'] = None + """The time in milliseconds it took to set up the cluster. For runs that run on new clusters this + is the cluster creation time, for runs that run on existing clusters this time should be very + short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and + the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total + duration of a multitask job run is the value of the `run_duration` field.""" + + spark_jar_task: Optional[SparkJarTask] = None + """If spark_jar_task, indicates that this job must run a JAR.""" + + spark_python_task: Optional[SparkPythonTask] = None + """If spark_python_task, indicates that this job must run a Python file.""" + + spark_submit_task: Optional[SparkSubmitTask] = None + """If `spark_submit_task`, indicates that this task must be launched by the spark submit script. + This task can run only on new clusters. + + In the `new_cluster` specification, `libraries` and `spark_conf` are not supported. Instead, use + `--jars` and `--py-files` to add Java and Python libraries and `--conf` to set the Spark + configurations. + + `master`, `deploy-mode`, and `executor-cores` are automatically configured by Databricks; you + _cannot_ specify them in parameters. + + By default, the Spark submit job uses all available memory (excluding reserved memory for + Databricks services). You can set `--driver-memory`, and `--executor-memory` to a smaller value + to leave some room for off-heap usage. + + The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 paths.""" + + sql_task: Optional[SqlTask] = None + """If sql_task, indicates that this job must execute a SQL.""" + start_time: Optional[int] = None - state: Optional['RunState'] = None + """The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). + This may not be the time when the job task starts executing, for example, if the job is + scheduled to run on a new cluster, this is the time the cluster creation call is issued.""" + + state: Optional[RunState] = None + """The current state of the run.""" + task_key: Optional[str] = None + """A unique name for the task. This field is used to refer to this task from other tasks. This + field is required and must be unique within its parent job. On Update or Reset, this field is + used to reference the tasks to be updated or reset.""" def as_dict(self) -> dict: + """Serializes the RunTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.attempt_number is not None: body['attempt_number'] = self.attempt_number if self.cleanup_duration is not None: body['cleanup_duration'] = self.cleanup_duration @@ -1973,7 +3192,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunTask': + def from_dict(cls, d: Dict[str, any]) -> RunTask: + """Deserializes the RunTask from a dictionary.""" return cls(attempt_number=d.get('attempt_number', None), cleanup_duration=d.get('cleanup_duration', None), cluster_instance=_from_dict(d, 'cluster_instance', ClusterInstance), @@ -2026,10 +3246,25 @@ class Source(Enum): @dataclass class SparkJarTask: jar_uri: Optional[str] = None + """Deprecated since 04/2016. Provide a `jar` through the `libraries` field instead. For an example, + see :method:jobs/create.""" + main_class_name: Optional[str] = None - parameters: Optional['List[str]'] = None + """The full name of the class containing the main method to be executed. This class must be + contained in a JAR provided as a library. + + The code must use `SparkContext.getOrCreate` to obtain a Spark context; otherwise, runs of the + job fail.""" + + parameters: Optional[List[str]] = None + """Parameters passed to the main method. + + Use [Task parameter variables] to set parameters containing information about job runs. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" def as_dict(self) -> dict: + """Serializes the SparkJarTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.jar_uri is not None: body['jar_uri'] = self.jar_uri if self.main_class_name is not None: body['main_class_name'] = self.main_class_name @@ -2037,7 +3272,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparkJarTask': + def from_dict(cls, d: Dict[str, any]) -> SparkJarTask: + """Deserializes the SparkJarTask from a dictionary.""" return cls(jar_uri=d.get('jar_uri', None), main_class_name=d.get('main_class_name', None), parameters=d.get('parameters', None)) @@ -2046,10 +3282,29 @@ def from_dict(cls, d: Dict[str, any]) -> 'SparkJarTask': @dataclass class SparkPythonTask: python_file: str - parameters: Optional['List[str]'] = None - source: Optional['Source'] = None + """The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and + workspace paths are supported. For python files stored in the Databricks workspace, the path + must be absolute and begin with `/`. For files stored in a remote repository, the path must be + relative. This field is required.""" + + parameters: Optional[List[str]] = None + """Command line parameters passed to the Python file. + + Use [Task parameter variables] to set parameters containing information about job runs. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" + + source: Optional[Source] = None + """Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file + will be retrieved from the local workspace or cloud location (if the `python_file` + has a URI format). When set to `GIT`, the Python file will be retrieved from a Git repository + defined in `git_source`. + + * `WORKSPACE`: The Python file is located in a workspace or at a cloud filesystem + URI. * `GIT`: The Python file is located in a remote Git repository.""" def as_dict(self) -> dict: + """Serializes the SparkPythonTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.parameters: body['parameters'] = [v for v in self.parameters] if self.python_file is not None: body['python_file'] = self.python_file @@ -2057,7 +3312,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparkPythonTask': + def from_dict(cls, d: Dict[str, any]) -> SparkPythonTask: + """Deserializes the SparkPythonTask from a dictionary.""" return cls(parameters=d.get('parameters', None), python_file=d.get('python_file', None), source=_enum(d, 'source', Source)) @@ -2065,27 +3321,48 @@ def from_dict(cls, d: Dict[str, any]) -> 'SparkPythonTask': @dataclass class SparkSubmitTask: - parameters: Optional['List[str]'] = None + parameters: Optional[List[str]] = None + """Command-line parameters passed to spark submit. + + Use [Task parameter variables] to set parameters containing information about job runs. + + [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables""" def as_dict(self) -> dict: + """Serializes the SparkSubmitTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.parameters: body['parameters'] = [v for v in self.parameters] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparkSubmitTask': + def from_dict(cls, d: Dict[str, any]) -> SparkSubmitTask: + """Deserializes the SparkSubmitTask from a dictionary.""" return cls(parameters=d.get('parameters', None)) @dataclass class SqlAlertOutput: - alert_state: Optional['SqlAlertState'] = None + alert_state: Optional[SqlAlertState] = None + """The state of the SQL alert. + + * UNKNOWN: alert yet to be evaluated * OK: alert evaluated and did not fulfill trigger + conditions * TRIGGERED: alert evaluated and fulfilled trigger conditions""" + output_link: Optional[str] = None + """The link to find the output results.""" + query_text: Optional[str] = None - sql_statements: Optional['List[SqlStatementOutput]'] = None + """The text of the SQL query. Can Run permission of the SQL query associated with the SQL alert is + required to view this field.""" + + sql_statements: Optional[List[SqlStatementOutput]] = None + """Information about SQL statements executed in the run.""" + warehouse_id: Optional[str] = None + """The canonical identifier of the SQL warehouse.""" def as_dict(self) -> dict: + """Serializes the SqlAlertOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.alert_state is not None: body['alert_state'] = self.alert_state.value if self.output_link is not None: body['output_link'] = self.output_link @@ -2095,7 +3372,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlAlertOutput': + def from_dict(cls, d: Dict[str, any]) -> SqlAlertOutput: + """Deserializes the SqlAlertOutput from a dictionary.""" return cls(alert_state=_enum(d, 'alert_state', SqlAlertState), output_link=d.get('output_link', None), query_text=d.get('query_text', None), @@ -2117,16 +3395,21 @@ class SqlAlertState(Enum): @dataclass class SqlDashboardOutput: warehouse_id: Optional[str] = None - widgets: Optional['List[SqlDashboardWidgetOutput]'] = None + """The canonical identifier of the SQL warehouse.""" + + widgets: Optional[List[SqlDashboardWidgetOutput]] = None + """Widgets executed in the run. Only SQL query based widgets are listed.""" def as_dict(self) -> dict: + """Serializes the SqlDashboardOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.warehouse_id is not None: body['warehouse_id'] = self.warehouse_id if self.widgets: body['widgets'] = [v.as_dict() for v in self.widgets] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlDashboardOutput': + def from_dict(cls, d: Dict[str, any]) -> SqlDashboardOutput: + """Deserializes the SqlDashboardOutput from a dictionary.""" return cls(warehouse_id=d.get('warehouse_id', None), widgets=_repeated_dict(d, 'widgets', SqlDashboardWidgetOutput)) @@ -2134,14 +3417,28 @@ def from_dict(cls, d: Dict[str, any]) -> 'SqlDashboardOutput': @dataclass class SqlDashboardWidgetOutput: end_time: Optional[int] = None - error: Optional['SqlOutputError'] = None + """Time (in epoch milliseconds) when execution of the SQL widget ends.""" + + error: Optional[SqlOutputError] = None + """The information about the error when execution fails.""" + output_link: Optional[str] = None + """The link to find the output results.""" + start_time: Optional[int] = None - status: Optional['SqlDashboardWidgetOutputStatus'] = None + """Time (in epoch milliseconds) when execution of the SQL widget starts.""" + + status: Optional[SqlDashboardWidgetOutputStatus] = None + """The execution status of the SQL widget.""" + widget_id: Optional[str] = None + """The canonical identifier of the SQL widget.""" + widget_title: Optional[str] = None + """The title of the SQL widget.""" def as_dict(self) -> dict: + """Serializes the SqlDashboardWidgetOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.end_time is not None: body['end_time'] = self.end_time if self.error: body['error'] = self.error.as_dict() @@ -2153,7 +3450,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlDashboardWidgetOutput': + def from_dict(cls, d: Dict[str, any]) -> SqlDashboardWidgetOutput: + """Deserializes the SqlDashboardWidgetOutput from a dictionary.""" return cls(end_time=d.get('end_time', None), error=_from_dict(d, 'error', SqlOutputError), output_link=d.get('output_link', None), @@ -2175,11 +3473,17 @@ class SqlDashboardWidgetOutputStatus(Enum): @dataclass class SqlOutput: - alert_output: Optional['SqlAlertOutput'] = None - dashboard_output: Optional['SqlDashboardOutput'] = None - query_output: Optional['SqlQueryOutput'] = None + alert_output: Optional[SqlAlertOutput] = None + """The output of a SQL alert task, if available.""" + + dashboard_output: Optional[SqlDashboardOutput] = None + """The output of a SQL dashboard task, if available.""" + + query_output: Optional[SqlQueryOutput] = None + """The output of a SQL query task, if available.""" def as_dict(self) -> dict: + """Serializes the SqlOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.alert_output: body['alert_output'] = self.alert_output.as_dict() if self.dashboard_output: body['dashboard_output'] = self.dashboard_output.as_dict() @@ -2187,7 +3491,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlOutput': + def from_dict(cls, d: Dict[str, any]) -> SqlOutput: + """Deserializes the SqlOutput from a dictionary.""" return cls(alert_output=_from_dict(d, 'alert_output', SqlAlertOutput), dashboard_output=_from_dict(d, 'dashboard_output', SqlDashboardOutput), query_output=_from_dict(d, 'query_output', SqlQueryOutput)) @@ -2196,25 +3501,36 @@ def from_dict(cls, d: Dict[str, any]) -> 'SqlOutput': @dataclass class SqlOutputError: message: Optional[str] = None + """The error message when execution fails.""" def as_dict(self) -> dict: + """Serializes the SqlOutputError into a dictionary suitable for use as a JSON request body.""" body = {} if self.message is not None: body['message'] = self.message return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlOutputError': + def from_dict(cls, d: Dict[str, any]) -> SqlOutputError: + """Deserializes the SqlOutputError from a dictionary.""" return cls(message=d.get('message', None)) @dataclass class SqlQueryOutput: output_link: Optional[str] = None + """The link to find the output results.""" + query_text: Optional[str] = None - sql_statements: Optional['List[SqlStatementOutput]'] = None + """The text of the SQL query. Can Run permission of the SQL query is required to view this field.""" + + sql_statements: Optional[List[SqlStatementOutput]] = None + """Information about SQL statements executed in the run.""" + warehouse_id: Optional[str] = None + """The canonical identifier of the SQL warehouse.""" def as_dict(self) -> dict: + """Serializes the SqlQueryOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.output_link is not None: body['output_link'] = self.output_link if self.query_text is not None: body['query_text'] = self.query_text @@ -2223,7 +3539,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlQueryOutput': + def from_dict(cls, d: Dict[str, any]) -> SqlQueryOutput: + """Deserializes the SqlQueryOutput from a dictionary.""" return cls(output_link=d.get('output_link', None), query_text=d.get('query_text', None), sql_statements=_repeated_dict(d, 'sql_statements', SqlStatementOutput), @@ -2233,27 +3550,47 @@ def from_dict(cls, d: Dict[str, any]) -> 'SqlQueryOutput': @dataclass class SqlStatementOutput: lookup_key: Optional[str] = None + """A key that can be used to look up query details.""" def as_dict(self) -> dict: + """Serializes the SqlStatementOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.lookup_key is not None: body['lookup_key'] = self.lookup_key return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlStatementOutput': + def from_dict(cls, d: Dict[str, any]) -> SqlStatementOutput: + """Deserializes the SqlStatementOutput from a dictionary.""" return cls(lookup_key=d.get('lookup_key', None)) @dataclass class SqlTask: warehouse_id: str - alert: Optional['SqlTaskAlert'] = None - dashboard: Optional['SqlTaskDashboard'] = None - file: Optional['SqlTaskFile'] = None - parameters: Optional['Dict[str,str]'] = None - query: Optional['SqlTaskQuery'] = None + """The canonical identifier of the SQL warehouse. Recommended to use with serverless or pro SQL + warehouses. Classic SQL warehouses are only supported for SQL alert, dashboard and query tasks + and are limited to scheduled single-task jobs.""" + + alert: Optional[SqlTaskAlert] = None + """If alert, indicates that this job must refresh a SQL alert.""" + + dashboard: Optional[SqlTaskDashboard] = None + """If dashboard, indicates that this job must refresh a SQL dashboard.""" + + file: Optional[SqlTaskFile] = None + """If file, indicates that this job runs a SQL file in a remote Git repository. Only one SQL + statement is supported in a file. Multiple SQL statements separated by semicolons (;) are not + permitted.""" + + parameters: Optional[Dict[str, str]] = None + """Parameters to be used for each run of this job. The SQL alert task does not support custom + parameters.""" + + query: Optional[SqlTaskQuery] = None + """If query, indicates that this job must execute a SQL query.""" def as_dict(self) -> dict: + """Serializes the SqlTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.alert: body['alert'] = self.alert.as_dict() if self.dashboard: body['dashboard'] = self.dashboard.as_dict() @@ -2264,7 +3601,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlTask': + def from_dict(cls, d: Dict[str, any]) -> SqlTask: + """Deserializes the SqlTask from a dictionary.""" return cls(alert=_from_dict(d, 'alert', SqlTaskAlert), dashboard=_from_dict(d, 'dashboard', SqlTaskDashboard), file=_from_dict(d, 'file', SqlTaskFile), @@ -2276,10 +3614,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'SqlTask': @dataclass class SqlTaskAlert: alert_id: str + """The canonical identifier of the SQL alert.""" + pause_subscriptions: Optional[bool] = None - subscriptions: Optional['List[SqlTaskSubscription]'] = None + """If true, the alert notifications are not sent to subscribers.""" + + subscriptions: Optional[List[SqlTaskSubscription]] = None + """If specified, alert notifications are sent to subscribers.""" def as_dict(self) -> dict: + """Serializes the SqlTaskAlert into a dictionary suitable for use as a JSON request body.""" body = {} if self.alert_id is not None: body['alert_id'] = self.alert_id if self.pause_subscriptions is not None: body['pause_subscriptions'] = self.pause_subscriptions @@ -2287,7 +3631,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskAlert': + def from_dict(cls, d: Dict[str, any]) -> SqlTaskAlert: + """Deserializes the SqlTaskAlert from a dictionary.""" return cls(alert_id=d.get('alert_id', None), pause_subscriptions=d.get('pause_subscriptions', None), subscriptions=_repeated_dict(d, 'subscriptions', SqlTaskSubscription)) @@ -2296,11 +3641,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskAlert': @dataclass class SqlTaskDashboard: dashboard_id: str + """The canonical identifier of the SQL dashboard.""" + custom_subject: Optional[str] = None + """Subject of the email sent to subscribers of this task.""" + pause_subscriptions: Optional[bool] = None - subscriptions: Optional['List[SqlTaskSubscription]'] = None + """If true, the dashboard snapshot is not taken, and emails are not sent to subscribers.""" + + subscriptions: Optional[List[SqlTaskSubscription]] = None + """If specified, dashboard snapshots are sent to subscriptions.""" def as_dict(self) -> dict: + """Serializes the SqlTaskDashboard into a dictionary suitable for use as a JSON request body.""" body = {} if self.custom_subject is not None: body['custom_subject'] = self.custom_subject if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id @@ -2309,7 +3662,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskDashboard': + def from_dict(cls, d: Dict[str, any]) -> SqlTaskDashboard: + """Deserializes the SqlTaskDashboard from a dictionary.""" return cls(custom_subject=d.get('custom_subject', None), dashboard_id=d.get('dashboard_id', None), pause_subscriptions=d.get('pause_subscriptions', None), @@ -2319,62 +3673,116 @@ def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskDashboard': @dataclass class SqlTaskFile: path: str + """Relative path of the SQL file in the remote Git repository.""" def as_dict(self) -> dict: + """Serializes the SqlTaskFile into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskFile': + def from_dict(cls, d: Dict[str, any]) -> SqlTaskFile: + """Deserializes the SqlTaskFile from a dictionary.""" return cls(path=d.get('path', None)) @dataclass class SqlTaskQuery: query_id: str + """The canonical identifier of the SQL query.""" def as_dict(self) -> dict: + """Serializes the SqlTaskQuery into a dictionary suitable for use as a JSON request body.""" body = {} if self.query_id is not None: body['query_id'] = self.query_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskQuery': + def from_dict(cls, d: Dict[str, any]) -> SqlTaskQuery: + """Deserializes the SqlTaskQuery from a dictionary.""" return cls(query_id=d.get('query_id', None)) @dataclass class SqlTaskSubscription: destination_id: Optional[str] = None + """The canonical identifier of the destination to receive email notification. This parameter is + mutually exclusive with user_name. You cannot set both destination_id and user_name for + subscription notifications.""" + user_name: Optional[str] = None + """The user name to receive the subscription email. This parameter is mutually exclusive with + destination_id. You cannot set both destination_id and user_name for subscription notifications.""" def as_dict(self) -> dict: + """Serializes the SqlTaskSubscription into a dictionary suitable for use as a JSON request body.""" body = {} if self.destination_id is not None: body['destination_id'] = self.destination_id if self.user_name is not None: body['user_name'] = self.user_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SqlTaskSubscription': + def from_dict(cls, d: Dict[str, any]) -> SqlTaskSubscription: + """Deserializes the SqlTaskSubscription from a dictionary.""" return cls(destination_id=d.get('destination_id', None), user_name=d.get('user_name', None)) @dataclass class SubmitRun: - access_control_list: Optional['List[iam.AccessControlRequest]'] = None - email_notifications: Optional['JobEmailNotifications'] = None - git_source: Optional['GitSource'] = None - health: Optional['JobsHealthRules'] = None + access_control_list: Optional[List[iam.AccessControlRequest]] = None + """List of permissions to set on the job.""" + + email_notifications: Optional[JobEmailNotifications] = None + """An optional set of email addresses notified when the run begins or completes.""" + + git_source: Optional[GitSource] = None + """An optional specification for a remote Git repository containing the source code used by tasks. + Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. + + If `git_source` is set, these tasks retrieve the file from the remote repository by default. + However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. + + Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks + are used, `git_source` must be defined on the job.""" + + health: Optional[JobsHealthRules] = None + """An optional set of health rules that can be defined for this job.""" + idempotency_token: Optional[str] = None - notification_settings: Optional['JobNotificationSettings'] = None - queue: Optional['QueueSettings'] = None + """An optional token that can be used to guarantee the idempotency of job run requests. If a run + with the provided token already exists, the request does not create a new run but returns the ID + of the existing run instead. If a run with the provided token is deleted, an error is returned. + + If you specify the idempotency token, upon failure you can retry until the request succeeds. + Databricks guarantees that exactly one run is launched with that idempotency token. + + This token must have at most 64 characters. + + For more information, see [How to ensure idempotency for jobs]. + + [How to ensure idempotency for jobs]: https://kb.databricks.com/jobs/jobs-idempotency.html""" + + notification_settings: Optional[JobNotificationSettings] = None + """Optional notification settings that are used when sending notifications to each of the + `email_notifications` and `webhook_notifications` for this run.""" + + queue: Optional[QueueSettings] = None + """The queue settings of the one-time run.""" + run_name: Optional[str] = None - tasks: Optional['List[SubmitTask]'] = None + """An optional name for the run. The default value is `Untitled`.""" + + tasks: Optional[List[SubmitTask]] = None + timeout_seconds: Optional[int] = None - webhook_notifications: Optional['WebhookNotifications'] = None + """An optional timeout applied to each run of this job. A value of `0` means no timeout.""" + + webhook_notifications: Optional[WebhookNotifications] = None + """A collection of system notification IDs to notify when the run begins or completes.""" def as_dict(self) -> dict: + """Serializes the SubmitRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -2391,7 +3799,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SubmitRun': + def from_dict(cls, d: Dict[str, any]) -> SubmitRun: + """Deserializes the SubmitRun from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', iam.AccessControlRequest), email_notifications=_from_dict(d, 'email_notifications', JobEmailNotifications), git_source=_from_dict(d, 'git_source', GitSource), @@ -2408,39 +3817,106 @@ def from_dict(cls, d: Dict[str, any]) -> 'SubmitRun': @dataclass class SubmitRunResponse: run_id: Optional[int] = None + """The canonical identifier for the newly submitted run.""" def as_dict(self) -> dict: + """Serializes the SubmitRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SubmitRunResponse': + def from_dict(cls, d: Dict[str, any]) -> SubmitRunResponse: + """Deserializes the SubmitRunResponse from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class SubmitTask: task_key: str - condition_task: Optional['ConditionTask'] = None - depends_on: Optional['List[TaskDependency]'] = None - email_notifications: Optional['JobEmailNotifications'] = None + """A unique name for the task. This field is used to refer to this task from other tasks. This + field is required and must be unique within its parent job. On Update or Reset, this field is + used to reference the tasks to be updated or reset.""" + + condition_task: Optional[ConditionTask] = None + """If condition_task, specifies a condition with an outcome that can be used to control the + execution of other tasks. Does not require a cluster to execute and does not support retries or + notifications.""" + + depends_on: Optional[List[TaskDependency]] = None + """An optional array of objects specifying the dependency graph of the task. All tasks specified in + this field must complete successfully before executing this task. The key is `task_key`, and the + value is the name assigned to the dependent task.""" + + email_notifications: Optional[JobEmailNotifications] = None + """An optional set of email addresses notified when the task run begins or completes. The default + behavior is to not send any emails.""" + existing_cluster_id: Optional[str] = None - health: Optional['JobsHealthRules'] = None - libraries: Optional['List[compute.Library]'] = None - new_cluster: Optional['compute.ClusterSpec'] = None - notebook_task: Optional['NotebookTask'] = None - notification_settings: Optional['TaskNotificationSettings'] = None - pipeline_task: Optional['PipelineTask'] = None - python_wheel_task: Optional['PythonWheelTask'] = None - spark_jar_task: Optional['SparkJarTask'] = None - spark_python_task: Optional['SparkPythonTask'] = None - spark_submit_task: Optional['SparkSubmitTask'] = None - sql_task: Optional['SqlTask'] = None + """If existing_cluster_id, the ID of an existing cluster that is used for all runs of this task. + When running tasks on an existing cluster, you may need to manually restart the cluster if it + stops responding. We suggest running jobs on new clusters for greater reliability.""" + + health: Optional[JobsHealthRules] = None + """An optional set of health rules that can be defined for this job.""" + + libraries: Optional[List[compute.Library]] = None + """An optional list of libraries to be installed on the cluster that executes the task. The default + value is an empty list.""" + + new_cluster: Optional[compute.ClusterSpec] = None + """If new_cluster, a description of a cluster that is created for each run.""" + + notebook_task: Optional[NotebookTask] = None + """If notebook_task, indicates that this task must run a notebook. This field may not be specified + in conjunction with spark_jar_task.""" + + notification_settings: Optional[TaskNotificationSettings] = None + """Optional notification settings that are used when sending notifications to each of the + `email_notifications` and `webhook_notifications` for this task run.""" + + pipeline_task: Optional[PipelineTask] = None + """If pipeline_task, indicates that this task must execute a Pipeline.""" + + python_wheel_task: Optional[PythonWheelTask] = None + """If python_wheel_task, indicates that this job must execute a PythonWheel.""" + + spark_jar_task: Optional[SparkJarTask] = None + """If spark_jar_task, indicates that this task must run a JAR.""" + + spark_python_task: Optional[SparkPythonTask] = None + """If spark_python_task, indicates that this task must run a Python file.""" + + spark_submit_task: Optional[SparkSubmitTask] = None + """If `spark_submit_task`, indicates that this task must be launched by the spark submit script. + This task can run only on new clusters. + + In the `new_cluster` specification, `libraries` and `spark_conf` are not supported. Instead, use + `--jars` and `--py-files` to add Java and Python libraries and `--conf` to set the Spark + configurations. + + `master`, `deploy-mode`, and `executor-cores` are automatically configured by Databricks; you + _cannot_ specify them in parameters. + + By default, the Spark submit job uses all available memory (excluding reserved memory for + Databricks services). You can set `--driver-memory`, and `--executor-memory` to a smaller value + to leave some room for off-heap usage. + + The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 paths.""" + + sql_task: Optional[SqlTask] = None + """If sql_task, indicates that this job must execute a SQL.""" + timeout_seconds: Optional[int] = None - webhook_notifications: Optional['WebhookNotifications'] = None + """An optional timeout applied to each run of this job task. A value of `0` means no timeout.""" + + webhook_notifications: Optional[WebhookNotifications] = None + """A collection of system notification IDs to notify when the run begins or completes. The default + behavior is to not send any system notifications. Task webhooks respect the task notification + settings.""" def as_dict(self) -> dict: + """Serializes the SubmitTask into a dictionary suitable for use as a JSON request body.""" body = {} if self.condition_task: body['condition_task'] = self.condition_task.as_dict() if self.depends_on: body['depends_on'] = [v.as_dict() for v in self.depends_on] @@ -2463,7 +3939,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SubmitTask': + def from_dict(cls, d: Dict[str, any]) -> SubmitTask: + """Deserializes the SubmitTask from a dictionary.""" return cls(condition_task=_from_dict(d, 'condition_task', ConditionTask), depends_on=_repeated_dict(d, 'depends_on', TaskDependency), email_notifications=_from_dict(d, 'email_notifications', JobEmailNotifications), @@ -2487,34 +3964,129 @@ def from_dict(cls, d: Dict[str, any]) -> 'SubmitTask': @dataclass class Task: task_key: str + """A unique name for the task. This field is used to refer to this task from other tasks. This + field is required and must be unique within its parent job. On Update or Reset, this field is + used to reference the tasks to be updated or reset.""" + compute_key: Optional[str] = None - condition_task: Optional['ConditionTask'] = None - dbt_task: Optional['DbtTask'] = None - depends_on: Optional['List[TaskDependency]'] = None + """The key of the compute requirement, specified in `job.settings.compute`, to use for execution of + this task.""" + + condition_task: Optional[ConditionTask] = None + """If condition_task, specifies a condition with an outcome that can be used to control the + execution of other tasks. Does not require a cluster to execute and does not support retries or + notifications.""" + + dbt_task: Optional[DbtTask] = None + """If dbt_task, indicates that this must execute a dbt task. It requires both Databricks SQL and + the ability to use a serverless or a pro SQL warehouse.""" + + depends_on: Optional[List[TaskDependency]] = None + """An optional array of objects specifying the dependency graph of the task. All tasks specified in + this field must complete before executing this task. The task will run only if the `run_if` + condition is true. The key is `task_key`, and the value is the name assigned to the dependent + task.""" + description: Optional[str] = None - email_notifications: Optional['TaskEmailNotifications'] = None + """An optional description for this task.""" + + email_notifications: Optional[TaskEmailNotifications] = None + """An optional set of email addresses that is notified when runs of this task begin or complete as + well as when this task is deleted. The default behavior is to not send any emails.""" + existing_cluster_id: Optional[str] = None - health: Optional['JobsHealthRules'] = None + """If existing_cluster_id, the ID of an existing cluster that is used for all runs of this task. + When running tasks on an existing cluster, you may need to manually restart the cluster if it + stops responding. We suggest running jobs on new clusters for greater reliability.""" + + health: Optional[JobsHealthRules] = None + """An optional set of health rules that can be defined for this job.""" + job_cluster_key: Optional[str] = None - libraries: Optional['List[compute.Library]'] = None + """If job_cluster_key, this task is executed reusing the cluster specified in + `job.settings.job_clusters`.""" + + libraries: Optional[List[compute.Library]] = None + """An optional list of libraries to be installed on the cluster that executes the task. The default + value is an empty list.""" + max_retries: Optional[int] = None + """An optional maximum number of times to retry an unsuccessful run. A run is considered to be + unsuccessful if it completes with the `FAILED` result_state or `INTERNAL_ERROR` + `life_cycle_state`. The value `-1` means to retry indefinitely and the value `0` means to never + retry.""" + min_retry_interval_millis: Optional[int] = None - new_cluster: Optional['compute.ClusterSpec'] = None - notebook_task: Optional['NotebookTask'] = None - notification_settings: Optional['TaskNotificationSettings'] = None - pipeline_task: Optional['PipelineTask'] = None - python_wheel_task: Optional['PythonWheelTask'] = None + """An optional minimal interval in milliseconds between the start of the failed run and the + subsequent retry run. The default behavior is that unsuccessful runs are immediately retried.""" + + new_cluster: Optional[compute.ClusterSpec] = None + """If new_cluster, a description of a cluster that is created for only for this task.""" + + notebook_task: Optional[NotebookTask] = None + """If notebook_task, indicates that this task must run a notebook. This field may not be specified + in conjunction with spark_jar_task.""" + + notification_settings: Optional[TaskNotificationSettings] = None + """Optional notification settings that are used when sending notifications to each of the + `email_notifications` and `webhook_notifications` for this task.""" + + pipeline_task: Optional[PipelineTask] = None + """If pipeline_task, indicates that this task must execute a Pipeline.""" + + python_wheel_task: Optional[PythonWheelTask] = None + """If python_wheel_task, indicates that this job must execute a PythonWheel.""" + retry_on_timeout: Optional[bool] = None - run_if: Optional['RunIf'] = None - run_job_task: Optional['RunJobTask'] = None - spark_jar_task: Optional['SparkJarTask'] = None - spark_python_task: Optional['SparkPythonTask'] = None - spark_submit_task: Optional['SparkSubmitTask'] = None - sql_task: Optional['SqlTask'] = None + """An optional policy to specify whether to retry a task when it times out.""" + + run_if: Optional[RunIf] = None + """An optional value specifying the condition determining whether the task is run once its + dependencies have been completed. + + * `ALL_SUCCESS`: All dependencies have executed and succeeded * `AT_LEAST_ONE_SUCCESS`: At least + one dependency has succeeded * `NONE_FAILED`: None of the dependencies have failed and at least + one was executed * `ALL_DONE`: All dependencies have been completed * `AT_LEAST_ONE_FAILED`: At + least one dependency failed * `ALL_FAILED`: ALl dependencies have failed""" + + run_job_task: Optional[RunJobTask] = None + """If run_job_task, indicates that this task must execute another job.""" + + spark_jar_task: Optional[SparkJarTask] = None + """If spark_jar_task, indicates that this task must run a JAR.""" + + spark_python_task: Optional[SparkPythonTask] = None + """If spark_python_task, indicates that this task must run a Python file.""" + + spark_submit_task: Optional[SparkSubmitTask] = None + """If `spark_submit_task`, indicates that this task must be launched by the spark submit script. + This task can run only on new clusters. + + In the `new_cluster` specification, `libraries` and `spark_conf` are not supported. Instead, use + `--jars` and `--py-files` to add Java and Python libraries and `--conf` to set the Spark + configurations. + + `master`, `deploy-mode`, and `executor-cores` are automatically configured by Databricks; you + _cannot_ specify them in parameters. + + By default, the Spark submit job uses all available memory (excluding reserved memory for + Databricks services). You can set `--driver-memory`, and `--executor-memory` to a smaller value + to leave some room for off-heap usage. + + The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 paths.""" + + sql_task: Optional[SqlTask] = None + """If sql_task, indicates that this job must execute a SQL task.""" + timeout_seconds: Optional[int] = None - webhook_notifications: Optional['WebhookNotifications'] = None + """An optional timeout applied to each run of this job task. A value of `0` means no timeout.""" + + webhook_notifications: Optional[WebhookNotifications] = None + """A collection of system notification IDs to notify when runs of this task begin or complete. The + default behavior is to not send any system notifications.""" def as_dict(self) -> dict: + """Serializes the Task into a dictionary suitable for use as a JSON request body.""" body = {} if self.compute_key is not None: body['compute_key'] = self.compute_key if self.condition_task: body['condition_task'] = self.condition_task.as_dict() @@ -2547,7 +4119,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Task': + def from_dict(cls, d: Dict[str, any]) -> Task: + """Deserializes the Task from a dictionary.""" return cls(compute_key=d.get('compute_key', None), condition_task=_from_dict(d, 'condition_task', ConditionTask), dbt_task=_from_dict(d, 'dbt_task', DbtTask), @@ -2580,27 +4153,51 @@ def from_dict(cls, d: Dict[str, any]) -> 'Task': @dataclass class TaskDependency: task_key: str + """The name of the task this task depends on.""" + outcome: Optional[str] = None + """Can only be specified on condition task dependencies. The outcome of the dependent task that + must be met for this task to run.""" def as_dict(self) -> dict: + """Serializes the TaskDependency into a dictionary suitable for use as a JSON request body.""" body = {} if self.outcome is not None: body['outcome'] = self.outcome if self.task_key is not None: body['task_key'] = self.task_key return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TaskDependency': + def from_dict(cls, d: Dict[str, any]) -> TaskDependency: + """Deserializes the TaskDependency from a dictionary.""" return cls(outcome=d.get('outcome', None), task_key=d.get('task_key', None)) @dataclass class TaskEmailNotifications: - on_duration_warning_threshold_exceeded: Optional['List[str]'] = None - on_failure: Optional['List[str]'] = None - on_start: Optional['List[str]'] = None - on_success: Optional['List[str]'] = None + on_duration_warning_threshold_exceeded: Optional[List[str]] = None + """A list of email addresses to be notified when the duration of a run exceeds the threshold + specified for the `RUN_DURATION_SECONDS` metric in the `health` field. If no rule for the + `RUN_DURATION_SECONDS` metric is specified in the `health` field for the job, notifications are + not sent.""" + + on_failure: Optional[List[str]] = None + """A list of email addresses to be notified when a run unsuccessfully completes. A run is + considered to have completed unsuccessfully if it ends with an `INTERNAL_ERROR` + `life_cycle_state` or a `FAILED`, or `TIMED_OUT` result_state. If this is not specified on job + creation, reset, or update the list is empty, and notifications are not sent.""" + + on_start: Optional[List[str]] = None + """A list of email addresses to be notified when a run begins. If not specified on job creation, + reset, or update, the list is empty, and notifications are not sent.""" + + on_success: Optional[List[str]] = None + """A list of email addresses to be notified when a run successfully completes. A run is considered + to have completed successfully if it ends with a `TERMINATED` `life_cycle_state` and a `SUCCESS` + result_state. If not specified on job creation, reset, or update, the list is empty, and + notifications are not sent.""" def as_dict(self) -> dict: + """Serializes the TaskEmailNotifications into a dictionary suitable for use as a JSON request body.""" body = {} if self.on_duration_warning_threshold_exceeded: body['on_duration_warning_threshold_exceeded'] = [ @@ -2612,7 +4209,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TaskEmailNotifications': + def from_dict(cls, d: Dict[str, any]) -> TaskEmailNotifications: + """Deserializes the TaskEmailNotifications from a dictionary.""" return cls(on_duration_warning_threshold_exceeded=d.get('on_duration_warning_threshold_exceeded', None), on_failure=d.get('on_failure', None), @@ -2623,10 +4221,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'TaskEmailNotifications': @dataclass class TaskNotificationSettings: alert_on_last_attempt: Optional[bool] = None + """If true, do not send notifications to recipients specified in `on_start` for the retried runs + and do not send notifications to recipients specified in `on_failure` until the last retry of + the run.""" + no_alert_for_canceled_runs: Optional[bool] = None + """If true, do not send notifications to recipients specified in `on_failure` if the run is + canceled.""" + no_alert_for_skipped_runs: Optional[bool] = None + """If true, do not send notifications to recipients specified in `on_failure` if the run is + skipped.""" def as_dict(self) -> dict: + """Serializes the TaskNotificationSettings into a dictionary suitable for use as a JSON request body.""" body = {} if self.alert_on_last_attempt is not None: body['alert_on_last_attempt'] = self.alert_on_last_attempt if self.no_alert_for_canceled_runs is not None: @@ -2636,7 +4244,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TaskNotificationSettings': + def from_dict(cls, d: Dict[str, any]) -> TaskNotificationSettings: + """Deserializes the TaskNotificationSettings from a dictionary.""" return cls(alert_on_last_attempt=d.get('alert_on_last_attempt', None), no_alert_for_canceled_runs=d.get('no_alert_for_canceled_runs', None), no_alert_for_skipped_runs=d.get('no_alert_for_skipped_runs', None)) @@ -2645,10 +4254,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'TaskNotificationSettings': @dataclass class TriggerEvaluation: description: Optional[str] = None + """Human-readable description of the the trigger evaluation result. Explains why the trigger + evaluation triggered or did not trigger a run, or failed.""" + run_id: Optional[int] = None + """The ID of the run that was triggered by the trigger evaluation. Only returned if a run was + triggered.""" + timestamp: Optional[int] = None + """Timestamp at which the trigger was evaluated.""" def as_dict(self) -> dict: + """Serializes the TriggerEvaluation into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.run_id is not None: body['run_id'] = self.run_id @@ -2656,7 +4273,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TriggerEvaluation': + def from_dict(cls, d: Dict[str, any]) -> TriggerEvaluation: + """Deserializes the TriggerEvaluation from a dictionary.""" return cls(description=d.get('description', None), run_id=d.get('run_id', None), timestamp=d.get('timestamp', None)) @@ -2664,11 +4282,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'TriggerEvaluation': @dataclass class TriggerHistory: - last_failed: Optional['TriggerEvaluation'] = None - last_not_triggered: Optional['TriggerEvaluation'] = None - last_triggered: Optional['TriggerEvaluation'] = None + last_failed: Optional[TriggerEvaluation] = None + """The last time the trigger failed to evaluate.""" + + last_not_triggered: Optional[TriggerEvaluation] = None + """The last time the trigger was evaluated but did not trigger a run.""" + + last_triggered: Optional[TriggerEvaluation] = None + """The last time the run was triggered due to a file arrival.""" def as_dict(self) -> dict: + """Serializes the TriggerHistory into a dictionary suitable for use as a JSON request body.""" body = {} if self.last_failed: body['last_failed'] = self.last_failed.as_dict() if self.last_not_triggered: body['last_not_triggered'] = self.last_not_triggered.as_dict() @@ -2676,7 +4300,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TriggerHistory': + def from_dict(cls, d: Dict[str, any]) -> TriggerHistory: + """Deserializes the TriggerHistory from a dictionary.""" return cls(last_failed=_from_dict(d, 'last_failed', TriggerEvaluation), last_not_triggered=_from_dict(d, 'last_not_triggered', TriggerEvaluation), last_triggered=_from_dict(d, 'last_triggered', TriggerEvaluation)) @@ -2685,30 +4310,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'TriggerHistory': @dataclass class TriggerInfo: run_id: Optional[int] = None + """The run id of the Run Job task run""" def as_dict(self) -> dict: + """Serializes the TriggerInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TriggerInfo': + def from_dict(cls, d: Dict[str, any]) -> TriggerInfo: + """Deserializes the TriggerInfo from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class TriggerSettings: - file_arrival: Optional['FileArrivalTriggerConfiguration'] = None - pause_status: Optional['PauseStatus'] = None + file_arrival: Optional[FileArrivalTriggerConfiguration] = None + """File arrival trigger settings.""" + + pause_status: Optional[PauseStatus] = None + """Whether this trigger is paused or not.""" def as_dict(self) -> dict: + """Serializes the TriggerSettings into a dictionary suitable for use as a JSON request body.""" body = {} if self.file_arrival: body['file_arrival'] = self.file_arrival.as_dict() if self.pause_status is not None: body['pause_status'] = self.pause_status.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TriggerSettings': + def from_dict(cls, d: Dict[str, any]) -> TriggerSettings: + """Deserializes the TriggerSettings from a dictionary.""" return cls(file_arrival=_from_dict(d, 'file_arrival', FileArrivalTriggerConfiguration), pause_status=_enum(d, 'pause_status', PauseStatus)) @@ -2734,10 +4367,26 @@ class TriggerType(Enum): @dataclass class UpdateJob: job_id: int - fields_to_remove: Optional['List[str]'] = None - new_settings: Optional['JobSettings'] = None + """The canonical identifier of the job to update. This field is required.""" + + fields_to_remove: Optional[List[str]] = None + """Remove top-level fields in the job settings. Removing nested fields is not supported, except for + tasks and job clusters (`tasks/task_1`). This field is optional.""" + + new_settings: Optional[JobSettings] = None + """The new settings for the job. + + Top-level fields specified in `new_settings` are completely replaced, except for arrays which + are merged. That is, new and existing entries are completely replaced based on the respective + key fields, i.e. `task_key` or `job_cluster_key`, while previous entries are kept. + + Partially updating nested fields is not supported. + + Changes to the field `JobSettings.timeout_seconds` are applied to active runs. Changes to other + fields are applied to future runs only.""" def as_dict(self) -> dict: + """Serializes the UpdateJob into a dictionary suitable for use as a JSON request body.""" body = {} if self.fields_to_remove: body['fields_to_remove'] = [v for v in self.fields_to_remove] if self.job_id is not None: body['job_id'] = self.job_id @@ -2745,7 +4394,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateJob': + def from_dict(cls, d: Dict[str, any]) -> UpdateJob: + """Deserializes the UpdateJob from a dictionary.""" return cls(fields_to_remove=d.get('fields_to_remove', None), job_id=d.get('job_id', None), new_settings=_from_dict(d, 'new_settings', JobSettings)) @@ -2754,10 +4404,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateJob': @dataclass class ViewItem: content: Optional[str] = None + """Content of the view.""" + name: Optional[str] = None - type: Optional['ViewType'] = None + """Name of the view item. In the case of code view, it would be the notebook’s name. In the case + of dashboard view, it would be the dashboard’s name.""" + + type: Optional[ViewType] = None + """Type of the view item.""" def as_dict(self) -> dict: + """Serializes the ViewItem into a dictionary suitable for use as a JSON request body.""" body = {} if self.content is not None: body['content'] = self.content if self.name is not None: body['name'] = self.name @@ -2765,7 +4422,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ViewItem': + def from_dict(cls, d: Dict[str, any]) -> ViewItem: + """Deserializes the ViewItem from a dictionary.""" return cls(content=d.get('content', None), name=d.get('name', None), type=_enum(d, 'type', ViewType)) @@ -2790,24 +4448,39 @@ class Webhook: id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the Webhook into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Webhook': + def from_dict(cls, d: Dict[str, any]) -> Webhook: + """Deserializes the Webhook from a dictionary.""" return cls(id=d.get('id', None)) @dataclass class WebhookNotifications: on_duration_warning_threshold_exceeded: Optional[ - 'List[WebhookNotificationsOnDurationWarningThresholdExceededItem]'] = None - on_failure: Optional['List[Webhook]'] = None - on_start: Optional['List[Webhook]'] = None - on_success: Optional['List[Webhook]'] = None + List[WebhookNotificationsOnDurationWarningThresholdExceededItem]] = None + """An optional list of system notification IDs to call when the duration of a run exceeds the + threshold specified for the `RUN_DURATION_SECONDS` metric in the `health` field. A maximum of 3 + destinations can be specified for the `on_duration_warning_threshold_exceeded` property.""" + + on_failure: Optional[List[Webhook]] = None + """An optional list of system notification IDs to call when the run fails. A maximum of 3 + destinations can be specified for the `on_failure` property.""" + + on_start: Optional[List[Webhook]] = None + """An optional list of system notification IDs to call when the run starts. A maximum of 3 + destinations can be specified for the `on_start` property.""" + + on_success: Optional[List[Webhook]] = None + """An optional list of system notification IDs to call when the run completes successfully. A + maximum of 3 destinations can be specified for the `on_success` property.""" def as_dict(self) -> dict: + """Serializes the WebhookNotifications into a dictionary suitable for use as a JSON request body.""" body = {} if self.on_duration_warning_threshold_exceeded: body['on_duration_warning_threshold_exceeded'] = [ @@ -2819,7 +4492,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WebhookNotifications': + def from_dict(cls, d: Dict[str, any]) -> WebhookNotifications: + """Deserializes the WebhookNotifications from a dictionary.""" return cls(on_duration_warning_threshold_exceeded=_repeated_dict( d, 'on_duration_warning_threshold_exceeded', WebhookNotificationsOnDurationWarningThresholdExceededItem), @@ -2833,12 +4507,14 @@ class WebhookNotificationsOnDurationWarningThresholdExceededItem: id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the WebhookNotificationsOnDurationWarningThresholdExceededItem into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WebhookNotificationsOnDurationWarningThresholdExceededItem': + def from_dict(cls, d: Dict[str, any]) -> WebhookNotificationsOnDurationWarningThresholdExceededItem: + """Deserializes the WebhookNotificationsOnDurationWarningThresholdExceededItem from a dictionary.""" return cls(id=d.get('id', None)) @@ -3233,7 +4909,7 @@ def list(self, limit: Optional[int] = None, name: Optional[str] = None, offset: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['BaseJob']: + page_token: Optional[str] = None) -> Iterator[BaseJob]: """List jobs. Retrieves a list of jobs. @@ -3285,7 +4961,7 @@ def list_runs(self, page_token: Optional[str] = None, run_type: Optional[ListRunsRunType] = None, start_time_from: Optional[int] = None, - start_time_to: Optional[int] = None) -> Iterator['BaseRun']: + start_time_to: Optional[int] = None) -> Iterator[BaseRun]: """List job runs. List runs in descending order by start time. diff --git a/databricks/sdk/service/ml.py b/databricks/sdk/service/ml.py index 5b8804ff7..58410ac9e 100755 --- a/databricks/sdk/service/ml.py +++ b/databricks/sdk/service/ml.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -16,17 +18,65 @@ class Activity: """Activity recorded for the action.""" - activity_type: Optional['ActivityType'] = None + activity_type: Optional[ActivityType] = None + """Type of activity. Valid values are: * `APPLIED_TRANSITION`: User applied the corresponding stage + transition. + + * `REQUESTED_TRANSITION`: User requested the corresponding stage transition. + + * `CANCELLED_REQUEST`: User cancelled an existing transition request. + + * `APPROVED_REQUEST`: User approved the corresponding stage transition. + + * `REJECTED_REQUEST`: User rejected the coressponding stage transition. + + * `SYSTEM_TRANSITION`: For events performed as a side effect, such as archiving existing model + versions in a stage.""" + comment: Optional[str] = None + """User-provided comment associated with the activity.""" + creation_timestamp: Optional[int] = None - from_stage: Optional['Stage'] = None + """Creation time of the object, as a Unix timestamp in milliseconds.""" + + from_stage: Optional[Stage] = None + """Source stage of the transition (if the activity is stage transition related). Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + id: Optional[str] = None + """Unique identifier for the object.""" + last_updated_timestamp: Optional[int] = None + """Time of the object at last update, as a Unix timestamp in milliseconds.""" + system_comment: Optional[str] = None - to_stage: Optional['Stage'] = None + """Comment made by system, for example explaining an activity of type `SYSTEM_TRANSITION`. It + usually describes a side effect, such as a version being archived as part of another version's + stage transition, and may not be returned for some activity types.""" + + to_stage: Optional[Stage] = None + """Target stage of the transition (if the activity is stage transition related). Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + user_id: Optional[str] = None + """The username of the user that created the object.""" def as_dict(self) -> dict: + """Serializes the Activity into a dictionary suitable for use as a JSON request body.""" body = {} if self.activity_type is not None: body['activity_type'] = self.activity_type.value if self.comment is not None: body['comment'] = self.comment @@ -41,7 +91,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Activity': + def from_dict(cls, d: Dict[str, any]) -> Activity: + """Deserializes the Activity from a dictionary.""" return cls(activity_type=_enum(d, 'activity_type', ActivityType), comment=d.get('comment', None), creation_timestamp=d.get('creation_timestamp', None), @@ -93,12 +144,30 @@ class ActivityType(Enum): @dataclass class ApproveTransitionRequest: name: str + """Name of the model.""" + version: str - stage: 'Stage' + """Version of the model.""" + + stage: Stage + """Target stage of the transition. Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + archive_existing_versions: bool + """Specifies whether to archive all current model versions in the target stage.""" + comment: Optional[str] = None + """User-provided comment on the action.""" def as_dict(self) -> dict: + """Serializes the ApproveTransitionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.archive_existing_versions is not None: body['archive_existing_versions'] = self.archive_existing_versions @@ -109,7 +178,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ApproveTransitionRequest': + def from_dict(cls, d: Dict[str, any]) -> ApproveTransitionRequest: + """Deserializes the ApproveTransitionRequest from a dictionary.""" return cls(archive_existing_versions=d.get('archive_existing_versions', None), comment=d.get('comment', None), name=d.get('name', None), @@ -119,15 +189,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'ApproveTransitionRequest': @dataclass class ApproveTransitionRequestResponse: - activity: Optional['Activity'] = None + activity: Optional[Activity] = None + """Activity recorded for the action.""" def as_dict(self) -> dict: + """Serializes the ApproveTransitionRequestResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.activity: body['activity'] = self.activity.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ApproveTransitionRequestResponse': + def from_dict(cls, d: Dict[str, any]) -> ApproveTransitionRequestResponse: + """Deserializes the ApproveTransitionRequestResponse from a dictionary.""" return cls(activity=_from_dict(d, 'activity', Activity)) @@ -145,14 +218,26 @@ class CommentActivityAction(Enum): class CommentObject: """Comment details.""" - available_actions: Optional['List[CommentActivityAction]'] = None + available_actions: Optional[List[CommentActivityAction]] = None + """Array of actions on the activity allowed for the current viewer.""" + comment: Optional[str] = None + """User-provided comment on the action.""" + creation_timestamp: Optional[int] = None + """Creation time of the object, as a Unix timestamp in milliseconds.""" + id: Optional[str] = None + """Comment ID""" + last_updated_timestamp: Optional[int] = None + """Time of the object at last update, as a Unix timestamp in milliseconds.""" + user_id: Optional[str] = None + """The username of the user that created the object.""" def as_dict(self) -> dict: + """Serializes the CommentObject into a dictionary suitable for use as a JSON request body.""" body = {} if self.available_actions: body['available_actions'] = [v.value for v in self.available_actions] if self.comment is not None: body['comment'] = self.comment @@ -164,7 +249,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CommentObject': + def from_dict(cls, d: Dict[str, any]) -> CommentObject: + """Deserializes the CommentObject from a dictionary.""" return cls(available_actions=_repeated_enum(d, 'available_actions', CommentActivityAction), comment=d.get('comment', None), creation_timestamp=d.get('creation_timestamp', None), @@ -176,10 +262,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'CommentObject': @dataclass class CreateComment: name: str + """Name of the model.""" + version: str + """Version of the model.""" + comment: str + """User-provided comment on the action.""" def as_dict(self) -> dict: + """Serializes the CreateComment into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -187,31 +279,45 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateComment': + def from_dict(cls, d: Dict[str, any]) -> CreateComment: + """Deserializes the CreateComment from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), version=d.get('version', None)) @dataclass class CreateCommentResponse: - comment: Optional['CommentObject'] = None + comment: Optional[CommentObject] = None + """Comment details.""" def as_dict(self) -> dict: + """Serializes the CreateCommentResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment: body['comment'] = self.comment.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCommentResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateCommentResponse: + """Deserializes the CreateCommentResponse from a dictionary.""" return cls(comment=_from_dict(d, 'comment', CommentObject)) @dataclass class CreateExperiment: name: str + """Experiment name.""" + artifact_location: Optional[str] = None - tags: Optional['List[ExperimentTag]'] = None + """Location where all artifacts for the experiment are stored. If not provided, the remote server + will select an appropriate default.""" + + tags: Optional[List[ExperimentTag]] = None + """A collection of tags to set on the experiment. Maximum tag size and number of tags per request + depends on the storage backend. All storage backends are guaranteed to support tag keys up to + 250 bytes in size and tag values up to 5000 bytes in size. All storage backends are also + guaranteed to support up to 20 tags per request.""" def as_dict(self) -> dict: + """Serializes the CreateExperiment into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact_location is not None: body['artifact_location'] = self.artifact_location if self.name is not None: body['name'] = self.name @@ -219,7 +325,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateExperiment': + def from_dict(cls, d: Dict[str, any]) -> CreateExperiment: + """Deserializes the CreateExperiment from a dictionary.""" return cls(artifact_location=d.get('artifact_location', None), name=d.get('name', None), tags=_repeated_dict(d, 'tags', ExperimentTag)) @@ -228,24 +335,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateExperiment': @dataclass class CreateExperimentResponse: experiment_id: Optional[str] = None + """Unique identifier for the experiment.""" def as_dict(self) -> dict: + """Serializes the CreateExperimentResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateExperimentResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateExperimentResponse: + """Deserializes the CreateExperimentResponse from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None)) @dataclass class CreateModelRequest: name: str + """Register models under this name""" + description: Optional[str] = None - tags: Optional['List[ModelTag]'] = None + """Optional description for registered model.""" + + tags: Optional[List[ModelTag]] = None + """Additional metadata for registered model.""" def as_dict(self) -> dict: + """Serializes the CreateModelRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.name is not None: body['name'] = self.name @@ -253,7 +369,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateModelRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateModelRequest: + """Deserializes the CreateModelRequest from a dictionary.""" return cls(description=d.get('description', None), name=d.get('name', None), tags=_repeated_dict(d, 'tags', ModelTag)) @@ -261,28 +378,44 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateModelRequest': @dataclass class CreateModelResponse: - registered_model: Optional['Model'] = None + registered_model: Optional[Model] = None def as_dict(self) -> dict: + """Serializes the CreateModelResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.registered_model: body['registered_model'] = self.registered_model.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateModelResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateModelResponse: + """Deserializes the CreateModelResponse from a dictionary.""" return cls(registered_model=_from_dict(d, 'registered_model', Model)) @dataclass class CreateModelVersionRequest: name: str + """Register model under this name""" + source: str + """URI indicating the location of the model artifacts.""" + description: Optional[str] = None + """Optional description for model version.""" + run_id: Optional[str] = None + """MLflow run ID for correlation, if `source` was generated by an experiment run in MLflow tracking + server""" + run_link: Optional[str] = None - tags: Optional['List[ModelVersionTag]'] = None + """MLflow run link - this is the exact link of the run that generated this model version, + potentially hosted at another instance of MLflow.""" + + tags: Optional[List[ModelVersionTag]] = None + """Additional metadata for model version.""" def as_dict(self) -> dict: + """Serializes the CreateModelVersionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.name is not None: body['name'] = self.name @@ -293,7 +426,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateModelVersionRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateModelVersionRequest: + """Deserializes the CreateModelVersionRequest from a dictionary.""" return cls(description=d.get('description', None), name=d.get('name', None), run_id=d.get('run_id', None), @@ -304,28 +438,74 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateModelVersionRequest': @dataclass class CreateModelVersionResponse: - model_version: Optional['ModelVersion'] = None + model_version: Optional[ModelVersion] = None + """Return new version number generated for this model in registry.""" def as_dict(self) -> dict: + """Serializes the CreateModelVersionResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_version: body['model_version'] = self.model_version.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateModelVersionResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateModelVersionResponse: + """Deserializes the CreateModelVersionResponse from a dictionary.""" return cls(model_version=_from_dict(d, 'model_version', ModelVersion)) @dataclass class CreateRegistryWebhook: - events: 'List[RegistryWebhookEvent]' + events: List[RegistryWebhookEvent] + """Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A new model version was + created for the associated model. + + * `MODEL_VERSION_TRANSITIONED_STAGE`: A model version’s stage was changed. + + * `TRANSITION_REQUEST_CREATED`: A user requested a model version’s stage be transitioned. + + * `COMMENT_CREATED`: A user wrote a comment on a registered model. + + * `REGISTERED_MODEL_CREATED`: A new registered model was created. This event type can only be + specified for a registry-wide webhook, which can be created by not specifying a model name in + the create request. + + * `MODEL_VERSION_TAG_SET`: A user set a tag on the model version. + + * `MODEL_VERSION_TRANSITIONED_TO_STAGING`: A model version was transitioned to staging. + + * `MODEL_VERSION_TRANSITIONED_TO_PRODUCTION`: A model version was transitioned to production. + + * `MODEL_VERSION_TRANSITIONED_TO_ARCHIVED`: A model version was archived. + + * `TRANSITION_REQUEST_TO_STAGING_CREATED`: A user requested a model version be transitioned to + staging. + + * `TRANSITION_REQUEST_TO_PRODUCTION_CREATED`: A user requested a model version be transitioned + to production. + + * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model version be archived.""" + description: Optional[str] = None - http_url_spec: Optional['HttpUrlSpec'] = None - job_spec: Optional['JobSpec'] = None + """User-specified description for the webhook.""" + + http_url_spec: Optional[HttpUrlSpec] = None + + job_spec: Optional[JobSpec] = None + model_name: Optional[str] = None - status: Optional['RegistryWebhookStatus'] = None + """Name of the model whose events would trigger this webhook.""" + + status: Optional[RegistryWebhookStatus] = None + """Enable or disable triggering the webhook, or put the webhook into test mode. The default is + `ACTIVE`: * `ACTIVE`: Webhook is triggered when an associated event happens. + + * `DISABLED`: Webhook is not triggered. + + * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is not triggered on a + real event.""" def as_dict(self) -> dict: + """Serializes the CreateRegistryWebhook into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.events: body['events'] = [v.value for v in self.events] @@ -336,7 +516,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateRegistryWebhook': + def from_dict(cls, d: Dict[str, any]) -> CreateRegistryWebhook: + """Deserializes the CreateRegistryWebhook from a dictionary.""" return cls(description=d.get('description', None), events=_repeated_enum(d, 'events', RegistryWebhookEvent), http_url_spec=_from_dict(d, 'http_url_spec', HttpUrlSpec), @@ -348,11 +529,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateRegistryWebhook': @dataclass class CreateRun: experiment_id: Optional[str] = None + """ID of the associated experiment.""" + start_time: Optional[int] = None - tags: Optional['List[RunTag]'] = None + """Unix timestamp in milliseconds of when the run started.""" + + tags: Optional[List[RunTag]] = None + """Additional metadata for run.""" + user_id: Optional[str] = None + """ID of the user executing the run. This field is deprecated as of MLflow 1.0, and will be removed + in a future MLflow release. Use 'mlflow.user' tag instead.""" def as_dict(self) -> dict: + """Serializes the CreateRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id if self.start_time is not None: body['start_time'] = self.start_time @@ -361,7 +551,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateRun': + def from_dict(cls, d: Dict[str, any]) -> CreateRun: + """Deserializes the CreateRun from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None), start_time=d.get('start_time', None), tags=_repeated_dict(d, 'tags', RunTag), @@ -370,26 +561,45 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateRun': @dataclass class CreateRunResponse: - run: Optional['Run'] = None + run: Optional[Run] = None + """The newly created run.""" def as_dict(self) -> dict: + """Serializes the CreateRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.run: body['run'] = self.run.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateRunResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateRunResponse: + """Deserializes the CreateRunResponse from a dictionary.""" return cls(run=_from_dict(d, 'run', Run)) @dataclass class CreateTransitionRequest: name: str + """Name of the model.""" + version: str - stage: 'Stage' + """Version of the model.""" + + stage: Stage + """Target stage of the transition. Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + comment: Optional[str] = None + """User-provided comment on the action.""" def as_dict(self) -> dict: + """Serializes the CreateTransitionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -398,7 +608,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateTransitionRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateTransitionRequest: + """Deserializes the CreateTransitionRequest from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), stage=_enum(d, 'stage', Stage), @@ -407,42 +618,63 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateTransitionRequest': @dataclass class CreateTransitionRequestResponse: - request: Optional['TransitionRequest'] = None + request: Optional[TransitionRequest] = None + """Transition request details.""" def as_dict(self) -> dict: + """Serializes the CreateTransitionRequestResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.request: body['request'] = self.request.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateTransitionRequestResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateTransitionRequestResponse: + """Deserializes the CreateTransitionRequestResponse from a dictionary.""" return cls(request=_from_dict(d, 'request', TransitionRequest)) @dataclass class CreateWebhookResponse: - webhook: Optional['RegistryWebhook'] = None + webhook: Optional[RegistryWebhook] = None def as_dict(self) -> dict: + """Serializes the CreateWebhookResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.webhook: body['webhook'] = self.webhook.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateWebhookResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateWebhookResponse: + """Deserializes the CreateWebhookResponse from a dictionary.""" return cls(webhook=_from_dict(d, 'webhook', RegistryWebhook)) @dataclass class Dataset: digest: Optional[str] = None + """Dataset digest, e.g. an md5 hash of the dataset that uniquely identifies it within datasets of + the same name.""" + name: Optional[str] = None + """The name of the dataset. E.g. “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3”""" + profile: Optional[str] = None + """The profile of the dataset. Summary statistics for the dataset, such as the number of rows in a + table, the mean / std / mode of each column in a table, or the number of elements in an array.""" + schema: Optional[str] = None + """The schema of the dataset. E.g., MLflow ColSpec JSON for a dataframe, MLflow TensorSpec JSON for + an ndarray, or another schema format.""" + source: Optional[str] = None + """The type of the dataset source, e.g. ‘databricks-uc-table’, ‘DBFS’, ‘S3’, ...""" + source_type: Optional[str] = None + """Source information for the dataset. Note that the source may not exactly reproduce the dataset + if it was transformed / modified before use with MLflow.""" def as_dict(self) -> dict: + """Serializes the Dataset into a dictionary suitable for use as a JSON request body.""" body = {} if self.digest is not None: body['digest'] = self.digest if self.name is not None: body['name'] = self.name @@ -453,7 +685,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Dataset': + def from_dict(cls, d: Dict[str, any]) -> Dataset: + """Deserializes the Dataset from a dictionary.""" return cls(digest=d.get('digest', None), name=d.get('name', None), profile=d.get('profile', None), @@ -464,55 +697,74 @@ def from_dict(cls, d: Dict[str, any]) -> 'Dataset': @dataclass class DatasetInput: - dataset: Optional['Dataset'] = None - tags: Optional['List[InputTag]'] = None + dataset: Optional[Dataset] = None + """The dataset being used as a Run input.""" + + tags: Optional[List[InputTag]] = None + """A list of tags for the dataset input, e.g. a “context” tag with value “training”""" def as_dict(self) -> dict: + """Serializes the DatasetInput into a dictionary suitable for use as a JSON request body.""" body = {} if self.dataset: body['dataset'] = self.dataset.as_dict() if self.tags: body['tags'] = [v.as_dict() for v in self.tags] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DatasetInput': + def from_dict(cls, d: Dict[str, any]) -> DatasetInput: + """Deserializes the DatasetInput from a dictionary.""" return cls(dataset=_from_dict(d, 'dataset', Dataset), tags=_repeated_dict(d, 'tags', InputTag)) @dataclass class DeleteExperiment: experiment_id: str + """ID of the associated experiment.""" def as_dict(self) -> dict: + """Serializes the DeleteExperiment into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteExperiment': + def from_dict(cls, d: Dict[str, any]) -> DeleteExperiment: + """Deserializes the DeleteExperiment from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None)) @dataclass class DeleteRun: run_id: str + """ID of the run to delete.""" def as_dict(self) -> dict: + """Serializes the DeleteRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteRun': + def from_dict(cls, d: Dict[str, any]) -> DeleteRun: + """Deserializes the DeleteRun from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class DeleteRuns: experiment_id: str + """The ID of the experiment containing the runs to delete.""" + max_timestamp_millis: int + """The maximum creation timestamp in milliseconds since the UNIX epoch for deleting runs. Only runs + created prior to or at this timestamp are deleted.""" + max_runs: Optional[int] = None + """An optional positive integer indicating the maximum number of runs to delete. The maximum + allowed value for max_runs is 10000.""" def as_dict(self) -> dict: + """Serializes the DeleteRuns into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id if self.max_runs is not None: body['max_runs'] = self.max_runs @@ -520,7 +772,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteRuns': + def from_dict(cls, d: Dict[str, any]) -> DeleteRuns: + """Deserializes the DeleteRuns from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None), max_runs=d.get('max_runs', None), max_timestamp_millis=d.get('max_timestamp_millis', None)) @@ -529,30 +782,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'DeleteRuns': @dataclass class DeleteRunsResponse: runs_deleted: Optional[int] = None + """The number of runs deleted.""" def as_dict(self) -> dict: + """Serializes the DeleteRunsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.runs_deleted is not None: body['runs_deleted'] = self.runs_deleted return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteRunsResponse': + def from_dict(cls, d: Dict[str, any]) -> DeleteRunsResponse: + """Deserializes the DeleteRunsResponse from a dictionary.""" return cls(runs_deleted=d.get('runs_deleted', None)) @dataclass class DeleteTag: run_id: str + """ID of the run that the tag was logged under. Must be provided.""" + key: str + """Name of the tag. Maximum size is 255 bytes. Must be provided.""" def as_dict(self) -> dict: + """Serializes the DeleteTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteTag': + def from_dict(cls, d: Dict[str, any]) -> DeleteTag: + """Deserializes the DeleteTag from a dictionary.""" return cls(key=d.get('key', None), run_id=d.get('run_id', None)) @@ -567,14 +828,29 @@ class DeleteTransitionRequestStage(Enum): @dataclass class Experiment: artifact_location: Optional[str] = None + """Location where artifacts for the experiment are stored.""" + creation_time: Optional[int] = None + """Creation time""" + experiment_id: Optional[str] = None + """Unique identifier for the experiment.""" + last_update_time: Optional[int] = None + """Last update time""" + lifecycle_stage: Optional[str] = None + """Current life cycle stage of the experiment: "active" or "deleted". Deleted experiments are not + returned by APIs.""" + name: Optional[str] = None - tags: Optional['List[ExperimentTag]'] = None + """Human readable name that identifies the experiment.""" + + tags: Optional[List[ExperimentTag]] = None + """Tags: Additional metadata key-value pairs.""" def as_dict(self) -> dict: + """Serializes the Experiment into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact_location is not None: body['artifact_location'] = self.artifact_location if self.creation_time is not None: body['creation_time'] = self.creation_time @@ -586,7 +862,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Experiment': + def from_dict(cls, d: Dict[str, any]) -> Experiment: + """Deserializes the Experiment from a dictionary.""" return cls(artifact_location=d.get('artifact_location', None), creation_time=d.get('creation_time', None), experiment_id=d.get('experiment_id', None), @@ -599,11 +876,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'Experiment': @dataclass class ExperimentAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['ExperimentPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[ExperimentPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ExperimentAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -613,7 +899,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> ExperimentAccessControlRequest: + """Deserializes the ExperimentAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', ExperimentPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -622,13 +909,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExperimentAccessControlRequest': @dataclass class ExperimentAccessControlResponse: - all_permissions: Optional['List[ExperimentPermission]'] = None + all_permissions: Optional[List[ExperimentPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ExperimentAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -639,7 +936,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> ExperimentAccessControlResponse: + """Deserializes the ExperimentAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', ExperimentPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -650,10 +948,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExperimentAccessControlResponse': @dataclass class ExperimentPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['ExperimentPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[ExperimentPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ExperimentPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -661,7 +963,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentPermission': + def from_dict(cls, d: Dict[str, any]) -> ExperimentPermission: + """Deserializes the ExperimentPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', ExperimentPermissionLevel)) @@ -677,11 +980,14 @@ class ExperimentPermissionLevel(Enum): @dataclass class ExperimentPermissions: - access_control_list: Optional['List[ExperimentAccessControlResponse]'] = None + access_control_list: Optional[List[ExperimentAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ExperimentPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -690,7 +996,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentPermissions': + def from_dict(cls, d: Dict[str, any]) -> ExperimentPermissions: + """Deserializes the ExperimentPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ExperimentAccessControlResponse), object_id=d.get('object_id', None), @@ -700,26 +1007,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExperimentPermissions': @dataclass class ExperimentPermissionsDescription: description: Optional[str] = None - permission_level: Optional['ExperimentPermissionLevel'] = None + + permission_level: Optional[ExperimentPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ExperimentPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> ExperimentPermissionsDescription: + """Deserializes the ExperimentPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', ExperimentPermissionLevel)) @dataclass class ExperimentPermissionsRequest: - access_control_list: Optional['List[ExperimentAccessControlRequest]'] = None + access_control_list: Optional[List[ExperimentAccessControlRequest]] = None + experiment_id: Optional[str] = None + """The experiment for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the ExperimentPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -727,7 +1041,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> ExperimentPermissionsRequest: + """Deserializes the ExperimentPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ExperimentAccessControlRequest), experiment_id=d.get('experiment_id', None)) @@ -736,26 +1051,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExperimentPermissionsRequest': @dataclass class ExperimentTag: key: Optional[str] = None + """The tag key.""" + value: Optional[str] = None + """The tag value.""" def as_dict(self) -> dict: + """Serializes the ExperimentTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExperimentTag': + def from_dict(cls, d: Dict[str, any]) -> ExperimentTag: + """Deserializes the ExperimentTag from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class FileInfo: file_size: Optional[int] = None + """Size in bytes. Unset for directories.""" + is_dir: Optional[bool] = None + """Whether the path is a directory.""" + path: Optional[str] = None + """Path relative to the root artifact directory run.""" def as_dict(self) -> dict: + """Serializes the FileInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.file_size is not None: body['file_size'] = self.file_size if self.is_dir is not None: body['is_dir'] = self.is_dir @@ -763,165 +1089,214 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FileInfo': + def from_dict(cls, d: Dict[str, any]) -> FileInfo: + """Deserializes the FileInfo from a dictionary.""" return cls(file_size=d.get('file_size', None), is_dir=d.get('is_dir', None), path=d.get('path', None)) @dataclass class GetExperimentPermissionLevelsResponse: - permission_levels: Optional['List[ExperimentPermissionsDescription]'] = None + permission_levels: Optional[List[ExperimentPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetExperimentPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetExperimentPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetExperimentPermissionLevelsResponse: + """Deserializes the GetExperimentPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', ExperimentPermissionsDescription)) @dataclass class GetExperimentResponse: - experiment: Optional['Experiment'] = None + experiment: Optional[Experiment] = None + """Experiment details.""" def as_dict(self) -> dict: + """Serializes the GetExperimentResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment: body['experiment'] = self.experiment.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetExperimentResponse': + def from_dict(cls, d: Dict[str, any]) -> GetExperimentResponse: + """Deserializes the GetExperimentResponse from a dictionary.""" return cls(experiment=_from_dict(d, 'experiment', Experiment)) @dataclass class GetLatestVersionsRequest: name: str - stages: Optional['List[str]'] = None + """Registered model unique name identifier.""" + + stages: Optional[List[str]] = None + """List of stages.""" def as_dict(self) -> dict: + """Serializes the GetLatestVersionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.stages: body['stages'] = [v for v in self.stages] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetLatestVersionsRequest': + def from_dict(cls, d: Dict[str, any]) -> GetLatestVersionsRequest: + """Deserializes the GetLatestVersionsRequest from a dictionary.""" return cls(name=d.get('name', None), stages=d.get('stages', None)) @dataclass class GetLatestVersionsResponse: - model_versions: Optional['List[ModelVersion]'] = None + model_versions: Optional[List[ModelVersion]] = None + """Latest version models for each requests stage. Only return models with current `READY` status. + If no `stages` provided, returns the latest version for each stage, including `"None"`.""" def as_dict(self) -> dict: + """Serializes the GetLatestVersionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_versions: body['model_versions'] = [v.as_dict() for v in self.model_versions] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetLatestVersionsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetLatestVersionsResponse: + """Deserializes the GetLatestVersionsResponse from a dictionary.""" return cls(model_versions=_repeated_dict(d, 'model_versions', ModelVersion)) @dataclass class GetMetricHistoryResponse: - metrics: Optional['List[Metric]'] = None + metrics: Optional[List[Metric]] = None + """All logged values for this metric.""" + next_page_token: Optional[str] = None + """Token that can be used to retrieve the next page of metric history results""" def as_dict(self) -> dict: + """Serializes the GetMetricHistoryResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.metrics: body['metrics'] = [v.as_dict() for v in self.metrics] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetMetricHistoryResponse': + def from_dict(cls, d: Dict[str, any]) -> GetMetricHistoryResponse: + """Deserializes the GetMetricHistoryResponse from a dictionary.""" return cls(metrics=_repeated_dict(d, 'metrics', Metric), next_page_token=d.get('next_page_token', None)) @dataclass class GetModelResponse: - registered_model_databricks: Optional['ModelDatabricks'] = None + registered_model_databricks: Optional[ModelDatabricks] = None def as_dict(self) -> dict: + """Serializes the GetModelResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.registered_model_databricks: body['registered_model_databricks'] = self.registered_model_databricks.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetModelResponse': + def from_dict(cls, d: Dict[str, any]) -> GetModelResponse: + """Deserializes the GetModelResponse from a dictionary.""" return cls(registered_model_databricks=_from_dict(d, 'registered_model_databricks', ModelDatabricks)) @dataclass class GetModelVersionDownloadUriResponse: artifact_uri: Optional[str] = None + """URI corresponding to where artifacts for this model version are stored.""" def as_dict(self) -> dict: + """Serializes the GetModelVersionDownloadUriResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact_uri is not None: body['artifact_uri'] = self.artifact_uri return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetModelVersionDownloadUriResponse': + def from_dict(cls, d: Dict[str, any]) -> GetModelVersionDownloadUriResponse: + """Deserializes the GetModelVersionDownloadUriResponse from a dictionary.""" return cls(artifact_uri=d.get('artifact_uri', None)) @dataclass class GetModelVersionResponse: - model_version: Optional['ModelVersion'] = None + model_version: Optional[ModelVersion] = None def as_dict(self) -> dict: + """Serializes the GetModelVersionResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_version: body['model_version'] = self.model_version.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetModelVersionResponse': + def from_dict(cls, d: Dict[str, any]) -> GetModelVersionResponse: + """Deserializes the GetModelVersionResponse from a dictionary.""" return cls(model_version=_from_dict(d, 'model_version', ModelVersion)) @dataclass class GetRegisteredModelPermissionLevelsResponse: - permission_levels: Optional['List[RegisteredModelPermissionsDescription]'] = None + permission_levels: Optional[List[RegisteredModelPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetRegisteredModelPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetRegisteredModelPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetRegisteredModelPermissionLevelsResponse: + """Deserializes the GetRegisteredModelPermissionLevelsResponse from a dictionary.""" return cls( permission_levels=_repeated_dict(d, 'permission_levels', RegisteredModelPermissionsDescription)) @dataclass class GetRunResponse: - run: Optional['Run'] = None + run: Optional[Run] = None + """Run metadata (name, start time, etc) and data (metrics, params, and tags).""" def as_dict(self) -> dict: + """Serializes the GetRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.run: body['run'] = self.run.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetRunResponse': + def from_dict(cls, d: Dict[str, any]) -> GetRunResponse: + """Deserializes the GetRunResponse from a dictionary.""" return cls(run=_from_dict(d, 'run', Run)) @dataclass class HttpUrlSpec: url: str + """External HTTPS URL called on event trigger (by using a POST request).""" + authorization: Optional[str] = None + """Value of the authorization header that should be sent in the request sent by the wehbook. It + should be of the form `" "`. If set to an empty string, no authorization + header will be included in the request.""" + enable_ssl_verification: Optional[bool] = None + """Enable/disable SSL certificate validation. Default is true. For self-signed certificates, this + field must be false AND the destination server must disable certificate validation as well. For + security purposes, it is encouraged to perform secret validation with the HMAC-encoded portion + of the payload and acknowledge the risk associated with disabling hostname validation whereby it + becomes more likely that requests can be maliciously routed to an unintended host.""" + secret: Optional[str] = None + """Shared secret required for HMAC encoding payload. The HMAC-encoded payload will be sent in the + header as: { "X-Databricks-Signature": $encoded_payload }.""" def as_dict(self) -> dict: + """Serializes the HttpUrlSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.authorization is not None: body['authorization'] = self.authorization if self.enable_ssl_verification is not None: @@ -931,7 +1306,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'HttpUrlSpec': + def from_dict(cls, d: Dict[str, any]) -> HttpUrlSpec: + """Deserializes the HttpUrlSpec from a dictionary.""" return cls(authorization=d.get('authorization', None), enable_ssl_verification=d.get('enable_ssl_verification', None), secret=d.get('secret', None), @@ -941,9 +1317,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'HttpUrlSpec': @dataclass class HttpUrlSpecWithoutSecret: enable_ssl_verification: Optional[bool] = None + """Enable/disable SSL certificate validation. Default is true. For self-signed certificates, this + field must be false AND the destination server must disable certificate validation as well. For + security purposes, it is encouraged to perform secret validation with the HMAC-encoded portion + of the payload and acknowledge the risk associated with disabling hostname validation whereby it + becomes more likely that requests can be maliciously routed to an unintended host.""" + url: Optional[str] = None + """External HTTPS URL called on event trigger (by using a POST request).""" def as_dict(self) -> dict: + """Serializes the HttpUrlSpecWithoutSecret into a dictionary suitable for use as a JSON request body.""" body = {} if self.enable_ssl_verification is not None: body['enable_ssl_verification'] = self.enable_ssl_verification @@ -951,33 +1335,46 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'HttpUrlSpecWithoutSecret': + def from_dict(cls, d: Dict[str, any]) -> HttpUrlSpecWithoutSecret: + """Deserializes the HttpUrlSpecWithoutSecret from a dictionary.""" return cls(enable_ssl_verification=d.get('enable_ssl_verification', None), url=d.get('url', None)) @dataclass class InputTag: key: Optional[str] = None + """The tag key.""" + value: Optional[str] = None + """The tag value.""" def as_dict(self) -> dict: + """Serializes the InputTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'InputTag': + def from_dict(cls, d: Dict[str, any]) -> InputTag: + """Deserializes the InputTag from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class JobSpec: job_id: str + """ID of the job that the webhook runs.""" + access_token: str + """The personal access token used to authorize webhook's job runs.""" + workspace_url: Optional[str] = None + """URL of the workspace containing the job that this webhook runs. If not specified, the job’s + workspace URL is assumed to be the same as the workspace where the webhook is created.""" def as_dict(self) -> dict: + """Serializes the JobSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_token is not None: body['access_token'] = self.access_token if self.job_id is not None: body['job_id'] = self.job_id @@ -985,7 +1382,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobSpec': + def from_dict(cls, d: Dict[str, any]) -> JobSpec: + """Deserializes the JobSpec from a dictionary.""" return cls(access_token=d.get('access_token', None), job_id=d.get('job_id', None), workspace_url=d.get('workspace_url', None)) @@ -994,26 +1392,39 @@ def from_dict(cls, d: Dict[str, any]) -> 'JobSpec': @dataclass class JobSpecWithoutSecret: job_id: Optional[str] = None + """ID of the job that the webhook runs.""" + workspace_url: Optional[str] = None + """URL of the workspace containing the job that this webhook runs. Defaults to the workspace URL in + which the webhook is created. If not specified, the job’s workspace is assumed to be the same + as the webhook’s.""" def as_dict(self) -> dict: + """Serializes the JobSpecWithoutSecret into a dictionary suitable for use as a JSON request body.""" body = {} if self.job_id is not None: body['job_id'] = self.job_id if self.workspace_url is not None: body['workspace_url'] = self.workspace_url return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'JobSpecWithoutSecret': + def from_dict(cls, d: Dict[str, any]) -> JobSpecWithoutSecret: + """Deserializes the JobSpecWithoutSecret from a dictionary.""" return cls(job_id=d.get('job_id', None), workspace_url=d.get('workspace_url', None)) @dataclass class ListArtifactsResponse: - files: Optional['List[FileInfo]'] = None + files: Optional[List[FileInfo]] = None + """File location and metadata for artifacts.""" + next_page_token: Optional[str] = None + """Token that can be used to retrieve the next page of artifact results""" + root_uri: Optional[str] = None + """Root artifact directory for the run.""" def as_dict(self) -> dict: + """Serializes the ListArtifactsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.files: body['files'] = [v.as_dict() for v in self.files] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token @@ -1021,7 +1432,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListArtifactsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListArtifactsResponse: + """Deserializes the ListArtifactsResponse from a dictionary.""" return cls(files=_repeated_dict(d, 'files', FileInfo), next_page_token=d.get('next_page_token', None), root_uri=d.get('root_uri', None)) @@ -1029,17 +1441,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListArtifactsResponse': @dataclass class ListExperimentsResponse: - experiments: Optional['List[Experiment]'] = None + experiments: Optional[List[Experiment]] = None + """Paginated Experiments beginning with the first item on the requested page.""" + next_page_token: Optional[str] = None + """Token that can be used to retrieve the next page of experiments. Empty token means no more + experiment is available for retrieval.""" def as_dict(self) -> dict: + """Serializes the ListExperimentsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiments: body['experiments'] = [v.as_dict() for v in self.experiments] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListExperimentsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListExperimentsResponse: + """Deserializes the ListExperimentsResponse from a dictionary.""" return cls(experiments=_repeated_dict(d, 'experiments', Experiment), next_page_token=d.get('next_page_token', None)) @@ -1047,16 +1465,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListExperimentsResponse': @dataclass class ListModelsResponse: next_page_token: Optional[str] = None - registered_models: Optional['List[Model]'] = None + """Pagination token to request next page of models for the same query.""" + + registered_models: Optional[List[Model]] = None def as_dict(self) -> dict: + """Serializes the ListModelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.registered_models: body['registered_models'] = [v.as_dict() for v in self.registered_models] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListModelsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListModelsResponse: + """Deserializes the ListModelsResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), registered_models=_repeated_dict(d, 'registered_models', Model)) @@ -1064,42 +1486,61 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListModelsResponse': @dataclass class ListRegistryWebhooks: next_page_token: Optional[str] = None - webhooks: Optional['List[RegistryWebhook]'] = None + """Token that can be used to retrieve the next page of artifact results""" + + webhooks: Optional[List[RegistryWebhook]] = None + """Array of registry webhooks.""" def as_dict(self) -> dict: + """Serializes the ListRegistryWebhooks into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.webhooks: body['webhooks'] = [v.as_dict() for v in self.webhooks] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListRegistryWebhooks': + def from_dict(cls, d: Dict[str, any]) -> ListRegistryWebhooks: + """Deserializes the ListRegistryWebhooks from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), webhooks=_repeated_dict(d, 'webhooks', RegistryWebhook)) @dataclass class ListTransitionRequestsResponse: - requests: Optional['List[Activity]'] = None + requests: Optional[List[Activity]] = None + """Array of open transition requests.""" def as_dict(self) -> dict: + """Serializes the ListTransitionRequestsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.requests: body['requests'] = [v.as_dict() for v in self.requests] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListTransitionRequestsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListTransitionRequestsResponse: + """Deserializes the ListTransitionRequestsResponse from a dictionary.""" return cls(requests=_repeated_dict(d, 'requests', Activity)) @dataclass class LogBatch: - metrics: Optional['List[Metric]'] = None - params: Optional['List[Param]'] = None + metrics: Optional[List[Metric]] = None + """Metrics to log. A single request can contain up to 1000 metrics, and up to 1000 metrics, params, + and tags in total.""" + + params: Optional[List[Param]] = None + """Params to log. A single request can contain up to 100 params, and up to 1000 metrics, params, + and tags in total.""" + run_id: Optional[str] = None - tags: Optional['List[RunTag]'] = None + """ID of the run to log under""" + + tags: Optional[List[RunTag]] = None + """Tags to log. A single request can contain up to 100 tags, and up to 1000 metrics, params, and + tags in total.""" def as_dict(self) -> dict: + """Serializes the LogBatch into a dictionary suitable for use as a JSON request body.""" body = {} if self.metrics: body['metrics'] = [v.as_dict() for v in self.metrics] if self.params: body['params'] = [v.as_dict() for v in self.params] @@ -1108,7 +1549,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogBatch': + def from_dict(cls, d: Dict[str, any]) -> LogBatch: + """Deserializes the LogBatch from a dictionary.""" return cls(metrics=_repeated_dict(d, 'metrics', Metric), params=_repeated_dict(d, 'params', Param), run_id=d.get('run_id', None), @@ -1117,30 +1559,48 @@ def from_dict(cls, d: Dict[str, any]) -> 'LogBatch': @dataclass class LogInputs: - datasets: Optional['List[DatasetInput]'] = None + datasets: Optional[List[DatasetInput]] = None + """Dataset inputs""" + run_id: Optional[str] = None + """ID of the run to log under""" def as_dict(self) -> dict: + """Serializes the LogInputs into a dictionary suitable for use as a JSON request body.""" body = {} if self.datasets: body['datasets'] = [v.as_dict() for v in self.datasets] if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogInputs': + def from_dict(cls, d: Dict[str, any]) -> LogInputs: + """Deserializes the LogInputs from a dictionary.""" return cls(datasets=_repeated_dict(d, 'datasets', DatasetInput), run_id=d.get('run_id', None)) @dataclass class LogMetric: key: str + """Name of the metric.""" + value: float + """Double value of the metric being logged.""" + timestamp: int + """Unix timestamp in milliseconds at the time metric was logged.""" + run_id: Optional[str] = None + """ID of the run under which to log the metric. Must be provided.""" + run_uuid: Optional[str] = None + """[Deprecated, use run_id instead] ID of the run under which to log the metric. This field will be + removed in a future MLflow version.""" + step: Optional[int] = None + """Step at which to log the metric""" def as_dict(self) -> dict: + """Serializes the LogMetric into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.run_id is not None: body['run_id'] = self.run_id @@ -1151,7 +1611,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogMetric': + def from_dict(cls, d: Dict[str, any]) -> LogMetric: + """Deserializes the LogMetric from a dictionary.""" return cls(key=d.get('key', None), run_id=d.get('run_id', None), run_uuid=d.get('run_uuid', None), @@ -1163,27 +1624,41 @@ def from_dict(cls, d: Dict[str, any]) -> 'LogMetric': @dataclass class LogModel: model_json: Optional[str] = None + """MLmodel file in json format.""" + run_id: Optional[str] = None + """ID of the run to log under""" def as_dict(self) -> dict: + """Serializes the LogModel into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_json is not None: body['model_json'] = self.model_json if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogModel': + def from_dict(cls, d: Dict[str, any]) -> LogModel: + """Deserializes the LogModel from a dictionary.""" return cls(model_json=d.get('model_json', None), run_id=d.get('run_id', None)) @dataclass class LogParam: key: str + """Name of the param. Maximum size is 255 bytes.""" + value: str + """String value of the param being logged. Maximum size is 500 bytes.""" + run_id: Optional[str] = None + """ID of the run under which to log the param. Must be provided.""" + run_uuid: Optional[str] = None + """[Deprecated, use run_id instead] ID of the run under which to log the param. This field will be + removed in a future MLflow version.""" def as_dict(self) -> dict: + """Serializes the LogParam into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.run_id is not None: body['run_id'] = self.run_id @@ -1192,7 +1667,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'LogParam': + def from_dict(cls, d: Dict[str, any]) -> LogParam: + """Deserializes the LogParam from a dictionary.""" return cls(key=d.get('key', None), run_id=d.get('run_id', None), run_uuid=d.get('run_uuid', None), @@ -1202,11 +1678,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'LogParam': @dataclass class Metric: key: Optional[str] = None + """Key identifying this metric.""" + step: Optional[int] = None + """Step at which to log the metric.""" + timestamp: Optional[int] = None + """The timestamp at which this metric was recorded.""" + value: Optional[float] = None + """Value associated with this metric.""" def as_dict(self) -> dict: + """Serializes the Metric into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.step is not None: body['step'] = self.step @@ -1215,7 +1699,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Metric': + def from_dict(cls, d: Dict[str, any]) -> Metric: + """Deserializes the Metric from a dictionary.""" return cls(key=d.get('key', None), step=d.get('step', None), timestamp=d.get('timestamp', None), @@ -1225,14 +1710,29 @@ def from_dict(cls, d: Dict[str, any]) -> 'Metric': @dataclass class Model: creation_timestamp: Optional[int] = None + """Timestamp recorded when this `registered_model` was created.""" + description: Optional[str] = None + """Description of this `registered_model`.""" + last_updated_timestamp: Optional[int] = None - latest_versions: Optional['List[ModelVersion]'] = None + """Timestamp recorded when metadata for this `registered_model` was last updated.""" + + latest_versions: Optional[List[ModelVersion]] = None + """Collection of latest model versions for each stage. Only contains models with current `READY` + status.""" + name: Optional[str] = None - tags: Optional['List[ModelTag]'] = None + """Unique name for the model.""" + + tags: Optional[List[ModelTag]] = None + """Tags: Additional metadata key-value pairs for this `registered_model`.""" + user_id: Optional[str] = None + """User that created this `registered_model`""" def as_dict(self) -> dict: + """Serializes the Model into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp if self.description is not None: body['description'] = self.description @@ -1245,7 +1745,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Model': + def from_dict(cls, d: Dict[str, any]) -> Model: + """Deserializes the Model from a dictionary.""" return cls(creation_timestamp=d.get('creation_timestamp', None), description=d.get('description', None), last_updated_timestamp=d.get('last_updated_timestamp', None), @@ -1258,16 +1759,35 @@ def from_dict(cls, d: Dict[str, any]) -> 'Model': @dataclass class ModelDatabricks: creation_timestamp: Optional[int] = None + """Creation time of the object, as a Unix timestamp in milliseconds.""" + description: Optional[str] = None + """User-specified description for the object.""" + id: Optional[str] = None + """Unique identifier for the object.""" + last_updated_timestamp: Optional[int] = None - latest_versions: Optional['List[ModelVersion]'] = None + """Time of the object at last update, as a Unix timestamp in milliseconds.""" + + latest_versions: Optional[List[ModelVersion]] = None + """Array of model versions, each the latest version for its stage.""" + name: Optional[str] = None - permission_level: Optional['PermissionLevel'] = None - tags: Optional['List[ModelTag]'] = None + """Name of the model.""" + + permission_level: Optional[PermissionLevel] = None + """Permission level of the requesting user on the object. For what is allowed at each level, see + [MLflow Model permissions](..).""" + + tags: Optional[List[ModelTag]] = None + """Array of tags associated with the model.""" + user_id: Optional[str] = None + """The username of the user that created the object.""" def as_dict(self) -> dict: + """Serializes the ModelDatabricks into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp if self.description is not None: body['description'] = self.description @@ -1282,7 +1802,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ModelDatabricks': + def from_dict(cls, d: Dict[str, any]) -> ModelDatabricks: + """Deserializes the ModelDatabricks from a dictionary.""" return cls(creation_timestamp=d.get('creation_timestamp', None), description=d.get('description', None), id=d.get('id', None), @@ -1297,36 +1818,68 @@ def from_dict(cls, d: Dict[str, any]) -> 'ModelDatabricks': @dataclass class ModelTag: key: Optional[str] = None + """The tag key.""" + value: Optional[str] = None + """The tag value.""" def as_dict(self) -> dict: + """Serializes the ModelTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ModelTag': + def from_dict(cls, d: Dict[str, any]) -> ModelTag: + """Deserializes the ModelTag from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class ModelVersion: creation_timestamp: Optional[int] = None + """Timestamp recorded when this `model_version` was created.""" + current_stage: Optional[str] = None + """Current stage for this `model_version`.""" + description: Optional[str] = None + """Description of this `model_version`.""" + last_updated_timestamp: Optional[int] = None + """Timestamp recorded when metadata for this `model_version` was last updated.""" + name: Optional[str] = None + """Unique name of the model""" + run_id: Optional[str] = None + """MLflow run ID used when creating `model_version`, if `source` was generated by an experiment run + stored in MLflow tracking server.""" + run_link: Optional[str] = None + """Run Link: Direct link to the run that generated this version""" + source: Optional[str] = None - status: Optional['ModelVersionStatus'] = None + """URI indicating the location of the source model artifacts, used when creating `model_version`""" + + status: Optional[ModelVersionStatus] = None + """Current status of `model_version`""" + status_message: Optional[str] = None - tags: Optional['List[ModelVersionTag]'] = None + """Details on current `status`, if it is pending or failed.""" + + tags: Optional[List[ModelVersionTag]] = None + """Tags: Additional metadata key-value pairs for this `model_version`.""" + user_id: Optional[str] = None + """User that created this `model_version`.""" + version: Optional[str] = None + """Model's version number.""" def as_dict(self) -> dict: + """Serializes the ModelVersion into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp if self.current_stage is not None: body['current_stage'] = self.current_stage @@ -1345,7 +1898,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ModelVersion': + def from_dict(cls, d: Dict[str, any]) -> ModelVersion: + """Deserializes the ModelVersion from a dictionary.""" return cls(creation_timestamp=d.get('creation_timestamp', None), current_stage=d.get('current_stage', None), description=d.get('description', None), @@ -1364,21 +1918,66 @@ def from_dict(cls, d: Dict[str, any]) -> 'ModelVersion': @dataclass class ModelVersionDatabricks: creation_timestamp: Optional[int] = None - current_stage: Optional['Stage'] = None + """Creation time of the object, as a Unix timestamp in milliseconds.""" + + current_stage: Optional[Stage] = None + """Stage of the model version. Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + description: Optional[str] = None + """User-specified description for the object.""" + last_updated_timestamp: Optional[int] = None + """Time of the object at last update, as a Unix timestamp in milliseconds.""" + name: Optional[str] = None - permission_level: Optional['PermissionLevel'] = None + """Name of the model.""" + + permission_level: Optional[PermissionLevel] = None + """Permission level of the requesting user on the object. For what is allowed at each level, see + [MLflow Model permissions](..).""" + run_id: Optional[str] = None + """Unique identifier for the MLflow tracking run associated with the source model artifacts.""" + run_link: Optional[str] = None + """URL of the run associated with the model artifacts. This field is set at model version creation + time only for model versions whose source run is from a tracking server that is different from + the registry server.""" + source: Optional[str] = None - status: Optional['Status'] = None + """URI that indicates the location of the source model artifacts. This is used when creating the + model version.""" + + status: Optional[Status] = None + """The status of the model version. Valid values are: * `PENDING_REGISTRATION`: Request to register + a new model version is pending as server performs background tasks. + + * `FAILED_REGISTRATION`: Request to register a new model version has failed. + + * `READY`: Model version is ready for use.""" + status_message: Optional[str] = None - tags: Optional['List[ModelVersionTag]'] = None + """Details on the current status, for example why registration failed.""" + + tags: Optional[List[ModelVersionTag]] = None + """Array of tags that are associated with the model version.""" + user_id: Optional[str] = None + """The username of the user that created the object.""" + version: Optional[str] = None + """Version of the model.""" def as_dict(self) -> dict: + """Serializes the ModelVersionDatabricks into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp if self.current_stage is not None: body['current_stage'] = self.current_stage.value @@ -1398,7 +1997,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ModelVersionDatabricks': + def from_dict(cls, d: Dict[str, any]) -> ModelVersionDatabricks: + """Deserializes the ModelVersionDatabricks from a dictionary.""" return cls(creation_timestamp=d.get('creation_timestamp', None), current_stage=_enum(d, 'current_stage', Stage), description=d.get('description', None), @@ -1426,32 +2026,42 @@ class ModelVersionStatus(Enum): @dataclass class ModelVersionTag: key: Optional[str] = None + """The tag key.""" + value: Optional[str] = None + """The tag value.""" def as_dict(self) -> dict: + """Serializes the ModelVersionTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ModelVersionTag': + def from_dict(cls, d: Dict[str, any]) -> ModelVersionTag: + """Deserializes the ModelVersionTag from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class Param: key: Optional[str] = None + """Key identifying this param.""" + value: Optional[str] = None + """Value associated with this param.""" def as_dict(self) -> dict: + """Serializes the Param into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Param': + def from_dict(cls, d: Dict[str, any]) -> Param: + """Deserializes the Param from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @@ -1469,11 +2079,20 @@ class PermissionLevel(Enum): @dataclass class RegisteredModelAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['RegisteredModelPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[RegisteredModelPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the RegisteredModelAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -1483,7 +2102,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelAccessControlRequest: + """Deserializes the RegisteredModelAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', RegisteredModelPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -1492,13 +2112,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelAccessControlRequest': @dataclass class RegisteredModelAccessControlResponse: - all_permissions: Optional['List[RegisteredModelPermission]'] = None + all_permissions: Optional[List[RegisteredModelPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the RegisteredModelAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -1509,7 +2139,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelAccessControlResponse: + """Deserializes the RegisteredModelAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', RegisteredModelPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -1520,10 +2151,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelAccessControlResponse': @dataclass class RegisteredModelPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['RegisteredModelPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[RegisteredModelPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the RegisteredModelPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -1531,7 +2166,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelPermission': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelPermission: + """Deserializes the RegisteredModelPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', RegisteredModelPermissionLevel)) @@ -1549,11 +2185,14 @@ class RegisteredModelPermissionLevel(Enum): @dataclass class RegisteredModelPermissions: - access_control_list: Optional['List[RegisteredModelAccessControlResponse]'] = None + access_control_list: Optional[List[RegisteredModelAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the RegisteredModelPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -1562,7 +2201,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelPermissions': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelPermissions: + """Deserializes the RegisteredModelPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', RegisteredModelAccessControlResponse), object_id=d.get('object_id', None), @@ -1572,26 +2212,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelPermissions': @dataclass class RegisteredModelPermissionsDescription: description: Optional[str] = None - permission_level: Optional['RegisteredModelPermissionLevel'] = None + + permission_level: Optional[RegisteredModelPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the RegisteredModelPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelPermissionsDescription: + """Deserializes the RegisteredModelPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', RegisteredModelPermissionLevel)) @dataclass class RegisteredModelPermissionsRequest: - access_control_list: Optional['List[RegisteredModelAccessControlRequest]'] = None + access_control_list: Optional[List[RegisteredModelAccessControlRequest]] = None + registered_model_id: Optional[str] = None + """The registered model for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the RegisteredModelPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -1599,7 +2246,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> RegisteredModelPermissionsRequest: + """Deserializes the RegisteredModelPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', RegisteredModelAccessControlRequest), registered_model_id=d.get('registered_model_id', None)) @@ -1608,16 +2256,65 @@ def from_dict(cls, d: Dict[str, any]) -> 'RegisteredModelPermissionsRequest': @dataclass class RegistryWebhook: creation_timestamp: Optional[int] = None + """Creation time of the object, as a Unix timestamp in milliseconds.""" + description: Optional[str] = None - events: Optional['List[RegistryWebhookEvent]'] = None - http_url_spec: Optional['HttpUrlSpecWithoutSecret'] = None + """User-specified description for the webhook.""" + + events: Optional[List[RegistryWebhookEvent]] = None + """Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A new model version was + created for the associated model. + + * `MODEL_VERSION_TRANSITIONED_STAGE`: A model version’s stage was changed. + + * `TRANSITION_REQUEST_CREATED`: A user requested a model version’s stage be transitioned. + + * `COMMENT_CREATED`: A user wrote a comment on a registered model. + + * `REGISTERED_MODEL_CREATED`: A new registered model was created. This event type can only be + specified for a registry-wide webhook, which can be created by not specifying a model name in + the create request. + + * `MODEL_VERSION_TAG_SET`: A user set a tag on the model version. + + * `MODEL_VERSION_TRANSITIONED_TO_STAGING`: A model version was transitioned to staging. + + * `MODEL_VERSION_TRANSITIONED_TO_PRODUCTION`: A model version was transitioned to production. + + * `MODEL_VERSION_TRANSITIONED_TO_ARCHIVED`: A model version was archived. + + * `TRANSITION_REQUEST_TO_STAGING_CREATED`: A user requested a model version be transitioned to + staging. + + * `TRANSITION_REQUEST_TO_PRODUCTION_CREATED`: A user requested a model version be transitioned + to production. + + * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model version be archived.""" + + http_url_spec: Optional[HttpUrlSpecWithoutSecret] = None + id: Optional[str] = None - job_spec: Optional['JobSpecWithoutSecret'] = None + """Webhook ID""" + + job_spec: Optional[JobSpecWithoutSecret] = None + last_updated_timestamp: Optional[int] = None + """Time of the object at last update, as a Unix timestamp in milliseconds.""" + model_name: Optional[str] = None - status: Optional['RegistryWebhookStatus'] = None + """Name of the model whose events would trigger this webhook.""" + + status: Optional[RegistryWebhookStatus] = None + """Enable or disable triggering the webhook, or put the webhook into test mode. The default is + `ACTIVE`: * `ACTIVE`: Webhook is triggered when an associated event happens. + + * `DISABLED`: Webhook is not triggered. + + * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is not triggered on a + real event.""" def as_dict(self) -> dict: + """Serializes the RegistryWebhook into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp if self.description is not None: body['description'] = self.description @@ -1632,7 +2329,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RegistryWebhook': + def from_dict(cls, d: Dict[str, any]) -> RegistryWebhook: + """Deserializes the RegistryWebhook from a dictionary.""" return cls(creation_timestamp=d.get('creation_timestamp', None), description=d.get('description', None), events=_repeated_enum(d, 'events', RegistryWebhookEvent), @@ -1677,11 +2375,27 @@ class RegistryWebhookStatus(Enum): @dataclass class RejectTransitionRequest: name: str + """Name of the model.""" + version: str - stage: 'Stage' + """Version of the model.""" + + stage: Stage + """Target stage of the transition. Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + comment: Optional[str] = None + """User-provided comment on the action.""" def as_dict(self) -> dict: + """Serializes the RejectTransitionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -1690,7 +2404,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RejectTransitionRequest': + def from_dict(cls, d: Dict[str, any]) -> RejectTransitionRequest: + """Deserializes the RejectTransitionRequest from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), stage=_enum(d, 'stage', Stage), @@ -1699,83 +2414,107 @@ def from_dict(cls, d: Dict[str, any]) -> 'RejectTransitionRequest': @dataclass class RejectTransitionRequestResponse: - activity: Optional['Activity'] = None + activity: Optional[Activity] = None + """Activity recorded for the action.""" def as_dict(self) -> dict: + """Serializes the RejectTransitionRequestResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.activity: body['activity'] = self.activity.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RejectTransitionRequestResponse': + def from_dict(cls, d: Dict[str, any]) -> RejectTransitionRequestResponse: + """Deserializes the RejectTransitionRequestResponse from a dictionary.""" return cls(activity=_from_dict(d, 'activity', Activity)) @dataclass class RenameModelRequest: name: str + """Registered model unique name identifier.""" + new_name: Optional[str] = None + """If provided, updates the name for this `registered_model`.""" def as_dict(self) -> dict: + """Serializes the RenameModelRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.new_name is not None: body['new_name'] = self.new_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RenameModelRequest': + def from_dict(cls, d: Dict[str, any]) -> RenameModelRequest: + """Deserializes the RenameModelRequest from a dictionary.""" return cls(name=d.get('name', None), new_name=d.get('new_name', None)) @dataclass class RenameModelResponse: - registered_model: Optional['Model'] = None + registered_model: Optional[Model] = None def as_dict(self) -> dict: + """Serializes the RenameModelResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.registered_model: body['registered_model'] = self.registered_model.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RenameModelResponse': + def from_dict(cls, d: Dict[str, any]) -> RenameModelResponse: + """Deserializes the RenameModelResponse from a dictionary.""" return cls(registered_model=_from_dict(d, 'registered_model', Model)) @dataclass class RestoreExperiment: experiment_id: str + """ID of the associated experiment.""" def as_dict(self) -> dict: + """Serializes the RestoreExperiment into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RestoreExperiment': + def from_dict(cls, d: Dict[str, any]) -> RestoreExperiment: + """Deserializes the RestoreExperiment from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None)) @dataclass class RestoreRun: run_id: str + """ID of the run to restore.""" def as_dict(self) -> dict: + """Serializes the RestoreRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_id is not None: body['run_id'] = self.run_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RestoreRun': + def from_dict(cls, d: Dict[str, any]) -> RestoreRun: + """Deserializes the RestoreRun from a dictionary.""" return cls(run_id=d.get('run_id', None)) @dataclass class RestoreRuns: experiment_id: str + """The ID of the experiment containing the runs to restore.""" + min_timestamp_millis: int + """The minimum deletion timestamp in milliseconds since the UNIX epoch for restoring runs. Only + runs deleted no earlier than this timestamp are restored.""" + max_runs: Optional[int] = None + """An optional positive integer indicating the maximum number of runs to restore. The maximum + allowed value for max_runs is 10000.""" def as_dict(self) -> dict: + """Serializes the RestoreRuns into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id if self.max_runs is not None: body['max_runs'] = self.max_runs @@ -1783,7 +2522,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RestoreRuns': + def from_dict(cls, d: Dict[str, any]) -> RestoreRuns: + """Deserializes the RestoreRuns from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None), max_runs=d.get('max_runs', None), min_timestamp_millis=d.get('min_timestamp_millis', None)) @@ -1792,24 +2532,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'RestoreRuns': @dataclass class RestoreRunsResponse: runs_restored: Optional[int] = None + """The number of runs restored.""" def as_dict(self) -> dict: + """Serializes the RestoreRunsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.runs_restored is not None: body['runs_restored'] = self.runs_restored return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RestoreRunsResponse': + def from_dict(cls, d: Dict[str, any]) -> RestoreRunsResponse: + """Deserializes the RestoreRunsResponse from a dictionary.""" return cls(runs_restored=d.get('runs_restored', None)) @dataclass class Run: - data: Optional['RunData'] = None - info: Optional['RunInfo'] = None - inputs: Optional['RunInputs'] = None + data: Optional[RunData] = None + """Run data.""" + + info: Optional[RunInfo] = None + """Run metadata.""" + + inputs: Optional[RunInputs] = None + """Run inputs.""" def as_dict(self) -> dict: + """Serializes the Run into a dictionary suitable for use as a JSON request body.""" body = {} if self.data: body['data'] = self.data.as_dict() if self.info: body['info'] = self.info.as_dict() @@ -1817,7 +2566,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Run': + def from_dict(cls, d: Dict[str, any]) -> Run: + """Deserializes the Run from a dictionary.""" return cls(data=_from_dict(d, 'data', RunData), info=_from_dict(d, 'info', RunInfo), inputs=_from_dict(d, 'inputs', RunInputs)) @@ -1825,11 +2575,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'Run': @dataclass class RunData: - metrics: Optional['List[Metric]'] = None - params: Optional['List[Param]'] = None - tags: Optional['List[RunTag]'] = None + metrics: Optional[List[Metric]] = None + """Run metrics.""" + + params: Optional[List[Param]] = None + """Run parameters.""" + + tags: Optional[List[RunTag]] = None + """Additional metadata key-value pairs.""" def as_dict(self) -> dict: + """Serializes the RunData into a dictionary suitable for use as a JSON request body.""" body = {} if self.metrics: body['metrics'] = [v.as_dict() for v in self.metrics] if self.params: body['params'] = [v.as_dict() for v in self.params] @@ -1837,7 +2593,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunData': + def from_dict(cls, d: Dict[str, any]) -> RunData: + """Deserializes the RunData from a dictionary.""" return cls(metrics=_repeated_dict(d, 'metrics', Metric), params=_repeated_dict(d, 'params', Param), tags=_repeated_dict(d, 'tags', RunTag)) @@ -1846,16 +2603,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'RunData': @dataclass class RunInfo: artifact_uri: Optional[str] = None + """URI of the directory where artifacts should be uploaded. This can be a local path (starting with + "/"), or a distributed file system (DFS) path, like `s3://bucket/directory` or + `dbfs:/my/directory`. If not set, the local `./mlruns` directory is chosen.""" + end_time: Optional[int] = None + """Unix timestamp of when the run ended in milliseconds.""" + experiment_id: Optional[str] = None + """The experiment ID.""" + lifecycle_stage: Optional[str] = None + """Current life cycle stage of the experiment : OneOf("active", "deleted")""" + run_id: Optional[str] = None + """Unique identifier for the run.""" + run_uuid: Optional[str] = None + """[Deprecated, use run_id instead] Unique identifier for the run. This field will be removed in a + future MLflow version.""" + start_time: Optional[int] = None - status: Optional['RunInfoStatus'] = None + """Unix timestamp of when the run started in milliseconds.""" + + status: Optional[RunInfoStatus] = None + """Current status of the run.""" + user_id: Optional[str] = None + """User who initiated the run. This field is deprecated as of MLflow 1.0, and will be removed in a + future MLflow release. Use 'mlflow.user' tag instead.""" def as_dict(self) -> dict: + """Serializes the RunInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.artifact_uri is not None: body['artifact_uri'] = self.artifact_uri if self.end_time is not None: body['end_time'] = self.end_time @@ -1869,7 +2648,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunInfo': + def from_dict(cls, d: Dict[str, any]) -> RunInfo: + """Deserializes the RunInfo from a dictionary.""" return cls(artifact_uri=d.get('artifact_uri', None), end_time=d.get('end_time', None), experiment_id=d.get('experiment_id', None), @@ -1893,43 +2673,64 @@ class RunInfoStatus(Enum): @dataclass class RunInputs: - dataset_inputs: Optional['List[DatasetInput]'] = None + dataset_inputs: Optional[List[DatasetInput]] = None + """Run metrics.""" def as_dict(self) -> dict: + """Serializes the RunInputs into a dictionary suitable for use as a JSON request body.""" body = {} if self.dataset_inputs: body['dataset_inputs'] = [v.as_dict() for v in self.dataset_inputs] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunInputs': + def from_dict(cls, d: Dict[str, any]) -> RunInputs: + """Deserializes the RunInputs from a dictionary.""" return cls(dataset_inputs=_repeated_dict(d, 'dataset_inputs', DatasetInput)) @dataclass class RunTag: key: Optional[str] = None + """The tag key.""" + value: Optional[str] = None + """The tag value.""" def as_dict(self) -> dict: + """Serializes the RunTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RunTag': + def from_dict(cls, d: Dict[str, any]) -> RunTag: + """Deserializes the RunTag from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class SearchExperiments: filter: Optional[str] = None + """String representing a SQL filter condition (e.g. "name ILIKE 'my-experiment%'")""" + max_results: Optional[int] = None - order_by: Optional['List[str]'] = None + """Maximum number of experiments desired. Max threshold is 3000.""" + + order_by: Optional[List[str]] = None + """List of columns for ordering search results, which can include experiment name and last updated + timestamp with an optional "DESC" or "ASC" annotation, where "ASC" is the default. Tiebreaks are + done by experiment id DESC.""" + page_token: Optional[str] = None - view_type: Optional['SearchExperimentsViewType'] = None + """Token indicating the page of experiments to fetch""" + + view_type: Optional[SearchExperimentsViewType] = None + """Qualifier for type of experiments to be returned. If unspecified, return only active + experiments.""" def as_dict(self) -> dict: + """Serializes the SearchExperiments into a dictionary suitable for use as a JSON request body.""" body = {} if self.filter is not None: body['filter'] = self.filter if self.max_results is not None: body['max_results'] = self.max_results @@ -1939,7 +2740,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SearchExperiments': + def from_dict(cls, d: Dict[str, any]) -> SearchExperiments: + """Deserializes the SearchExperiments from a dictionary.""" return cls(filter=d.get('filter', None), max_results=d.get('max_results', None), order_by=d.get('order_by', None), @@ -1949,17 +2751,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'SearchExperiments': @dataclass class SearchExperimentsResponse: - experiments: Optional['List[Experiment]'] = None + experiments: Optional[List[Experiment]] = None + """Experiments that match the search criteria""" + next_page_token: Optional[str] = None + """Token that can be used to retrieve the next page of experiments. An empty token means that no + more experiments are available for retrieval.""" def as_dict(self) -> dict: + """Serializes the SearchExperimentsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiments: body['experiments'] = [v.as_dict() for v in self.experiments] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SearchExperimentsResponse': + def from_dict(cls, d: Dict[str, any]) -> SearchExperimentsResponse: + """Deserializes the SearchExperimentsResponse from a dictionary.""" return cls(experiments=_repeated_dict(d, 'experiments', Experiment), next_page_token=d.get('next_page_token', None)) @@ -1975,17 +2783,22 @@ class SearchExperimentsViewType(Enum): @dataclass class SearchModelVersionsResponse: - model_versions: Optional['List[ModelVersion]'] = None + model_versions: Optional[List[ModelVersion]] = None + """Models that match the search criteria""" + next_page_token: Optional[str] = None + """Pagination token to request next page of models for the same search query.""" def as_dict(self) -> dict: + """Serializes the SearchModelVersionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_versions: body['model_versions'] = [v.as_dict() for v in self.model_versions] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SearchModelVersionsResponse': + def from_dict(cls, d: Dict[str, any]) -> SearchModelVersionsResponse: + """Deserializes the SearchModelVersionsResponse from a dictionary.""" return cls(model_versions=_repeated_dict(d, 'model_versions', ModelVersion), next_page_token=d.get('next_page_token', None)) @@ -1993,30 +2806,60 @@ def from_dict(cls, d: Dict[str, any]) -> 'SearchModelVersionsResponse': @dataclass class SearchModelsResponse: next_page_token: Optional[str] = None - registered_models: Optional['List[Model]'] = None + """Pagination token to request the next page of models.""" + + registered_models: Optional[List[Model]] = None + """Registered Models that match the search criteria.""" def as_dict(self) -> dict: + """Serializes the SearchModelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.registered_models: body['registered_models'] = [v.as_dict() for v in self.registered_models] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SearchModelsResponse': + def from_dict(cls, d: Dict[str, any]) -> SearchModelsResponse: + """Deserializes the SearchModelsResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), registered_models=_repeated_dict(d, 'registered_models', Model)) @dataclass class SearchRuns: - experiment_ids: Optional['List[str]'] = None + experiment_ids: Optional[List[str]] = None + """List of experiment IDs to search over.""" + filter: Optional[str] = None + """A filter expression over params, metrics, and tags, that allows returning a subset of runs. The + syntax is a subset of SQL that supports ANDing together binary operations between a param, + metric, or tag and a constant. + + Example: `metrics.rmse < 1 and params.model_class = 'LogisticRegression'` + + You can select columns with special characters (hyphen, space, period, etc.) by using double + quotes: `metrics."model class" = 'LinearRegression' and tags."user-name" = 'Tomas'` + + Supported operators are `=`, `!=`, `>`, `>=`, `<`, and `<=`.""" + max_results: Optional[int] = None - order_by: Optional['List[str]'] = None + """Maximum number of runs desired. Max threshold is 50000""" + + order_by: Optional[List[str]] = None + """List of columns to be ordered by, including attributes, params, metrics, and tags with an + optional "DESC" or "ASC" annotation, where "ASC" is the default. Example: ["params.input DESC", + "metrics.alpha ASC", "metrics.rmse"] Tiebreaks are done by start_time DESC followed by run_id + for runs with the same start time (and this is the default ordering criterion if order_by is not + provided).""" + page_token: Optional[str] = None - run_view_type: Optional['SearchRunsRunViewType'] = None + """Token for the current page of runs.""" + + run_view_type: Optional[SearchRunsRunViewType] = None + """Whether to display only active, only deleted, or all runs. Defaults to only active runs.""" def as_dict(self) -> dict: + """Serializes the SearchRuns into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_ids: body['experiment_ids'] = [v for v in self.experiment_ids] if self.filter is not None: body['filter'] = self.filter @@ -2027,7 +2870,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SearchRuns': + def from_dict(cls, d: Dict[str, any]) -> SearchRuns: + """Deserializes the SearchRuns from a dictionary.""" return cls(experiment_ids=d.get('experiment_ids', None), filter=d.get('filter', None), max_results=d.get('max_results', None), @@ -2039,16 +2883,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'SearchRuns': @dataclass class SearchRunsResponse: next_page_token: Optional[str] = None - runs: Optional['List[Run]'] = None + """Token for the next page of runs.""" + + runs: Optional[List[Run]] = None + """Runs that match the search criteria.""" def as_dict(self) -> dict: + """Serializes the SearchRunsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.runs: body['runs'] = [v.as_dict() for v in self.runs] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SearchRunsResponse': + def from_dict(cls, d: Dict[str, any]) -> SearchRunsResponse: + """Deserializes the SearchRunsResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), runs=_repeated_dict(d, 'runs', Run)) @@ -2063,10 +2912,18 @@ class SearchRunsRunViewType(Enum): @dataclass class SetExperimentTag: experiment_id: str + """ID of the experiment under which to log the tag. Must be provided.""" + key: str + """Name of the tag. Maximum size depends on storage backend. All storage backends are guaranteed to + support key values up to 250 bytes in size.""" + value: str + """String value of the tag being logged. Maximum size depends on storage backend. All storage + backends are guaranteed to support key values up to 5000 bytes in size.""" def as_dict(self) -> dict: + """Serializes the SetExperimentTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id if self.key is not None: body['key'] = self.key @@ -2074,7 +2931,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetExperimentTag': + def from_dict(cls, d: Dict[str, any]) -> SetExperimentTag: + """Deserializes the SetExperimentTag from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None), key=d.get('key', None), value=d.get('value', None)) @@ -2083,10 +2941,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'SetExperimentTag': @dataclass class SetModelTagRequest: name: str + """Unique name of the model.""" + key: str + """Name of the tag. Maximum size depends on storage backend. If a tag with this name already + exists, its preexisting value will be replaced by the specified `value`. All storage backends + are guaranteed to support key values up to 250 bytes in size.""" + value: str + """String value of the tag being logged. Maximum size depends on storage backend. All storage + backends are guaranteed to support key values up to 5000 bytes in size.""" def as_dict(self) -> dict: + """Serializes the SetModelTagRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.name is not None: body['name'] = self.name @@ -2094,18 +2961,30 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetModelTagRequest': + def from_dict(cls, d: Dict[str, any]) -> SetModelTagRequest: + """Deserializes the SetModelTagRequest from a dictionary.""" return cls(key=d.get('key', None), name=d.get('name', None), value=d.get('value', None)) @dataclass class SetModelVersionTagRequest: name: str + """Unique name of the model.""" + version: str + """Model version number.""" + key: str + """Name of the tag. Maximum size depends on storage backend. If a tag with this name already + exists, its preexisting value will be replaced by the specified `value`. All storage backends + are guaranteed to support key values up to 250 bytes in size.""" + value: str + """String value of the tag being logged. Maximum size depends on storage backend. All storage + backends are guaranteed to support key values up to 5000 bytes in size.""" def as_dict(self) -> dict: + """Serializes the SetModelVersionTagRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.name is not None: body['name'] = self.name @@ -2114,7 +2993,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetModelVersionTagRequest': + def from_dict(cls, d: Dict[str, any]) -> SetModelVersionTagRequest: + """Deserializes the SetModelVersionTagRequest from a dictionary.""" return cls(key=d.get('key', None), name=d.get('name', None), value=d.get('value', None), @@ -2124,11 +3004,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'SetModelVersionTagRequest': @dataclass class SetTag: key: str + """Name of the tag. Maximum size depends on storage backend. All storage backends are guaranteed to + support key values up to 250 bytes in size.""" + value: str + """String value of the tag being logged. Maximum size depends on storage backend. All storage + backends are guaranteed to support key values up to 5000 bytes in size.""" + run_id: Optional[str] = None + """ID of the run under which to log the tag. Must be provided.""" + run_uuid: Optional[str] = None + """[Deprecated, use run_id instead] ID of the run under which to log the tag. This field will be + removed in a future MLflow version.""" def as_dict(self) -> dict: + """Serializes the SetTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.run_id is not None: body['run_id'] = self.run_id @@ -2137,7 +3028,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetTag': + def from_dict(cls, d: Dict[str, any]) -> SetTag: + """Deserializes the SetTag from a dictionary.""" return cls(key=d.get('key', None), run_id=d.get('run_id', None), run_uuid=d.get('run_uuid', None), @@ -2179,58 +3071,90 @@ class TestRegistryWebhook: """Test webhook response object.""" body: Optional[str] = None + """Body of the response from the webhook URL""" + status_code: Optional[int] = None + """Status code returned by the webhook URL""" def as_dict(self) -> dict: + """Serializes the TestRegistryWebhook into a dictionary suitable for use as a JSON request body.""" body = {} if self.body is not None: body['body'] = self.body if self.status_code is not None: body['status_code'] = self.status_code return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TestRegistryWebhook': + def from_dict(cls, d: Dict[str, any]) -> TestRegistryWebhook: + """Deserializes the TestRegistryWebhook from a dictionary.""" return cls(body=d.get('body', None), status_code=d.get('status_code', None)) @dataclass class TestRegistryWebhookRequest: id: str - event: Optional['RegistryWebhookEvent'] = None + """Webhook ID""" + + event: Optional[RegistryWebhookEvent] = None + """If `event` is specified, the test trigger uses the specified event. If `event` is not specified, + the test trigger uses a randomly chosen event associated with the webhook.""" def as_dict(self) -> dict: + """Serializes the TestRegistryWebhookRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.event is not None: body['event'] = self.event.value if self.id is not None: body['id'] = self.id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TestRegistryWebhookRequest': + def from_dict(cls, d: Dict[str, any]) -> TestRegistryWebhookRequest: + """Deserializes the TestRegistryWebhookRequest from a dictionary.""" return cls(event=_enum(d, 'event', RegistryWebhookEvent), id=d.get('id', None)) @dataclass class TestRegistryWebhookResponse: - webhook: Optional['TestRegistryWebhook'] = None + webhook: Optional[TestRegistryWebhook] = None + """Test webhook response object.""" def as_dict(self) -> dict: + """Serializes the TestRegistryWebhookResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.webhook: body['webhook'] = self.webhook.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TestRegistryWebhookResponse': + def from_dict(cls, d: Dict[str, any]) -> TestRegistryWebhookResponse: + """Deserializes the TestRegistryWebhookResponse from a dictionary.""" return cls(webhook=_from_dict(d, 'webhook', TestRegistryWebhook)) @dataclass class TransitionModelVersionStageDatabricks: name: str + """Name of the model.""" + version: str - stage: 'Stage' + """Version of the model.""" + + stage: Stage + """Target stage of the transition. Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + archive_existing_versions: bool + """Specifies whether to archive all current model versions in the target stage.""" + comment: Optional[str] = None + """User-provided comment on the action.""" def as_dict(self) -> dict: + """Serializes the TransitionModelVersionStageDatabricks into a dictionary suitable for use as a JSON request body.""" body = {} if self.archive_existing_versions is not None: body['archive_existing_versions'] = self.archive_existing_versions @@ -2241,7 +3165,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TransitionModelVersionStageDatabricks': + def from_dict(cls, d: Dict[str, any]) -> TransitionModelVersionStageDatabricks: + """Deserializes the TransitionModelVersionStageDatabricks from a dictionary.""" return cls(archive_existing_versions=d.get('archive_existing_versions', None), comment=d.get('comment', None), name=d.get('name', None), @@ -2253,13 +3178,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'TransitionModelVersionStageDatabricks' class TransitionRequest: """Transition request details.""" - available_actions: Optional['List[ActivityAction]'] = None + available_actions: Optional[List[ActivityAction]] = None + """Array of actions on the activity allowed for the current viewer.""" + comment: Optional[str] = None + """User-provided comment associated with the transition request.""" + creation_timestamp: Optional[int] = None - to_stage: Optional['Stage'] = None + """Creation time of the object, as a Unix timestamp in milliseconds.""" + + to_stage: Optional[Stage] = None + """Target stage of the transition (if the activity is stage transition related). Valid values are: + + * `None`: The initial stage of a model version. + + * `Staging`: Staging or pre-production stage. + + * `Production`: Production stage. + + * `Archived`: Archived stage.""" + user_id: Optional[str] = None + """The username of the user that created the object.""" def as_dict(self) -> dict: + """Serializes the TransitionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.available_actions: body['available_actions'] = [v.value for v in self.available_actions] if self.comment is not None: body['comment'] = self.comment @@ -2269,7 +3212,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TransitionRequest': + def from_dict(cls, d: Dict[str, any]) -> TransitionRequest: + """Deserializes the TransitionRequest from a dictionary.""" return cls(available_actions=_repeated_enum(d, 'available_actions', ActivityAction), comment=d.get('comment', None), creation_timestamp=d.get('creation_timestamp', None), @@ -2279,87 +3223,113 @@ def from_dict(cls, d: Dict[str, any]) -> 'TransitionRequest': @dataclass class TransitionStageResponse: - model_version: Optional['ModelVersionDatabricks'] = None + model_version: Optional[ModelVersionDatabricks] = None def as_dict(self) -> dict: + """Serializes the TransitionStageResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_version: body['model_version'] = self.model_version.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TransitionStageResponse': + def from_dict(cls, d: Dict[str, any]) -> TransitionStageResponse: + """Deserializes the TransitionStageResponse from a dictionary.""" return cls(model_version=_from_dict(d, 'model_version', ModelVersionDatabricks)) @dataclass class UpdateComment: id: str + """Unique identifier of an activity""" + comment: str + """User-provided comment on the action.""" def as_dict(self) -> dict: + """Serializes the UpdateComment into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.id is not None: body['id'] = self.id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateComment': + def from_dict(cls, d: Dict[str, any]) -> UpdateComment: + """Deserializes the UpdateComment from a dictionary.""" return cls(comment=d.get('comment', None), id=d.get('id', None)) @dataclass class UpdateCommentResponse: - comment: Optional['CommentObject'] = None + comment: Optional[CommentObject] = None + """Comment details.""" def as_dict(self) -> dict: + """Serializes the UpdateCommentResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment: body['comment'] = self.comment.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateCommentResponse': + def from_dict(cls, d: Dict[str, any]) -> UpdateCommentResponse: + """Deserializes the UpdateCommentResponse from a dictionary.""" return cls(comment=_from_dict(d, 'comment', CommentObject)) @dataclass class UpdateExperiment: experiment_id: str + """ID of the associated experiment.""" + new_name: Optional[str] = None + """If provided, the experiment's name is changed to the new name. The new name must be unique.""" def as_dict(self) -> dict: + """Serializes the UpdateExperiment into a dictionary suitable for use as a JSON request body.""" body = {} if self.experiment_id is not None: body['experiment_id'] = self.experiment_id if self.new_name is not None: body['new_name'] = self.new_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateExperiment': + def from_dict(cls, d: Dict[str, any]) -> UpdateExperiment: + """Deserializes the UpdateExperiment from a dictionary.""" return cls(experiment_id=d.get('experiment_id', None), new_name=d.get('new_name', None)) @dataclass class UpdateModelRequest: name: str + """Registered model unique name identifier.""" + description: Optional[str] = None + """If provided, updates the description for this `registered_model`.""" def as_dict(self) -> dict: + """Serializes the UpdateModelRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateModelRequest: + """Deserializes the UpdateModelRequest from a dictionary.""" return cls(description=d.get('description', None), name=d.get('name', None)) @dataclass class UpdateModelVersionRequest: name: str + """Name of the registered model""" + version: str + """Model version number""" + description: Optional[str] = None + """If provided, updates the description for this `registered_model`.""" def as_dict(self) -> dict: + """Serializes the UpdateModelVersionRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.name is not None: body['name'] = self.name @@ -2367,7 +3337,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelVersionRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateModelVersionRequest: + """Deserializes the UpdateModelVersionRequest from a dictionary.""" return cls(description=d.get('description', None), name=d.get('name', None), version=d.get('version', None)) @@ -2376,13 +3347,56 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateModelVersionRequest': @dataclass class UpdateRegistryWebhook: id: str + """Webhook ID""" + description: Optional[str] = None - events: Optional['List[RegistryWebhookEvent]'] = None - http_url_spec: Optional['HttpUrlSpec'] = None - job_spec: Optional['JobSpec'] = None - status: Optional['RegistryWebhookStatus'] = None + """User-specified description for the webhook.""" + + events: Optional[List[RegistryWebhookEvent]] = None + """Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A new model version was + created for the associated model. + + * `MODEL_VERSION_TRANSITIONED_STAGE`: A model version’s stage was changed. + + * `TRANSITION_REQUEST_CREATED`: A user requested a model version’s stage be transitioned. + + * `COMMENT_CREATED`: A user wrote a comment on a registered model. + + * `REGISTERED_MODEL_CREATED`: A new registered model was created. This event type can only be + specified for a registry-wide webhook, which can be created by not specifying a model name in + the create request. + + * `MODEL_VERSION_TAG_SET`: A user set a tag on the model version. + + * `MODEL_VERSION_TRANSITIONED_TO_STAGING`: A model version was transitioned to staging. + + * `MODEL_VERSION_TRANSITIONED_TO_PRODUCTION`: A model version was transitioned to production. + + * `MODEL_VERSION_TRANSITIONED_TO_ARCHIVED`: A model version was archived. + + * `TRANSITION_REQUEST_TO_STAGING_CREATED`: A user requested a model version be transitioned to + staging. + + * `TRANSITION_REQUEST_TO_PRODUCTION_CREATED`: A user requested a model version be transitioned + to production. + + * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model version be archived.""" + + http_url_spec: Optional[HttpUrlSpec] = None + + job_spec: Optional[JobSpec] = None + + status: Optional[RegistryWebhookStatus] = None + """Enable or disable triggering the webhook, or put the webhook into test mode. The default is + `ACTIVE`: * `ACTIVE`: Webhook is triggered when an associated event happens. + + * `DISABLED`: Webhook is not triggered. + + * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is not triggered on a + real event.""" def as_dict(self) -> dict: + """Serializes the UpdateRegistryWebhook into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.events: body['events'] = [v.value for v in self.events] @@ -2393,7 +3407,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRegistryWebhook': + def from_dict(cls, d: Dict[str, any]) -> UpdateRegistryWebhook: + """Deserializes the UpdateRegistryWebhook from a dictionary.""" return cls(description=d.get('description', None), events=_repeated_enum(d, 'events', RegistryWebhookEvent), http_url_spec=_from_dict(d, 'http_url_spec', HttpUrlSpec), @@ -2405,11 +3420,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateRegistryWebhook': @dataclass class UpdateRun: end_time: Optional[int] = None + """Unix timestamp in milliseconds of when the run ended.""" + run_id: Optional[str] = None + """ID of the run to update. Must be provided.""" + run_uuid: Optional[str] = None - status: Optional['UpdateRunStatus'] = None + """[Deprecated, use run_id instead] ID of the run to update.. This field will be removed in a + future MLflow version.""" + + status: Optional[UpdateRunStatus] = None + """Updated status of the run.""" def as_dict(self) -> dict: + """Serializes the UpdateRun into a dictionary suitable for use as a JSON request body.""" body = {} if self.end_time is not None: body['end_time'] = self.end_time if self.run_id is not None: body['run_id'] = self.run_id @@ -2418,7 +3442,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRun': + def from_dict(cls, d: Dict[str, any]) -> UpdateRun: + """Deserializes the UpdateRun from a dictionary.""" return cls(end_time=d.get('end_time', None), run_id=d.get('run_id', None), run_uuid=d.get('run_uuid', None), @@ -2427,15 +3452,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateRun': @dataclass class UpdateRunResponse: - run_info: Optional['RunInfo'] = None + run_info: Optional[RunInfo] = None + """Updated metadata of the run.""" def as_dict(self) -> dict: + """Serializes the UpdateRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.run_info: body['run_info'] = self.run_info.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRunResponse': + def from_dict(cls, d: Dict[str, any]) -> UpdateRunResponse: + """Deserializes the UpdateRunResponse from a dictionary.""" return cls(run_info=_from_dict(d, 'run_info', RunInfo)) @@ -2652,7 +3680,7 @@ def get_history(self, max_results: Optional[int] = None, page_token: Optional[str] = None, run_id: Optional[str] = None, - run_uuid: Optional[str] = None) -> Iterator['Metric']: + run_uuid: Optional[str] = None) -> Iterator[Metric]: """Get history of a given metric within a run. Gets a list of all values for the specified metric for a given run. @@ -2752,7 +3780,7 @@ def list_artifacts(self, page_token: Optional[str] = None, path: Optional[str] = None, run_id: Optional[str] = None, - run_uuid: Optional[str] = None) -> Iterator['FileInfo']: + run_uuid: Optional[str] = None) -> Iterator[FileInfo]: """Get all artifacts. List artifacts for a run. Takes an optional `artifact_path` prefix. If it is specified, the response @@ -2792,7 +3820,7 @@ def list_experiments(self, *, max_results: Optional[int] = None, page_token: Optional[str] = None, - view_type: Optional[str] = None) -> Iterator['Experiment']: + view_type: Optional[str] = None) -> Iterator[Experiment]: """List experiments. Gets a list of all experiments. @@ -3067,7 +4095,7 @@ def search_experiments(self, max_results: Optional[int] = None, order_by: Optional[List[str]] = None, page_token: Optional[str] = None, - view_type: Optional[SearchExperimentsViewType] = None) -> Iterator['Experiment']: + view_type: Optional[SearchExperimentsViewType] = None) -> Iterator[Experiment]: """Search experiments. Searches for experiments that satisfy specified search criteria. @@ -3112,7 +4140,7 @@ def search_runs(self, max_results: Optional[int] = None, order_by: Optional[List[str]] = None, page_token: Optional[str] = None, - run_view_type: Optional[SearchRunsRunViewType] = None) -> Iterator['Run']: + run_view_type: Optional[SearchRunsRunViewType] = None) -> Iterator[Run]: """Search for runs. Searches for runs that satisfy expressions. @@ -3727,10 +4755,7 @@ def delete_webhook(self, *, id: Optional[str] = None): headers = {'Accept': 'application/json', } self._api.do('DELETE', '/api/2.0/mlflow/registry-webhooks/delete', query=query, headers=headers) - def get_latest_versions(self, - name: str, - *, - stages: Optional[List[str]] = None) -> Iterator['ModelVersion']: + def get_latest_versions(self, name: str, *, stages: Optional[List[str]] = None) -> Iterator[ModelVersion]: """Get the latest version. Gets the latest version of a registered model. @@ -3858,7 +4883,7 @@ def get_permissions(self, registered_model_id: str) -> RegisteredModelPermission def list_models(self, *, max_results: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['Model']: + page_token: Optional[str] = None) -> Iterator[Model]: """List models. Lists all available registered models, up to the limit specified in __max_results__. @@ -3886,7 +4911,7 @@ def list_models(self, return query['page_token'] = json['next_page_token'] - def list_transition_requests(self, name: str, version: str) -> Iterator['Activity']: + def list_transition_requests(self, name: str, version: str) -> Iterator[Activity]: """List transition requests. Gets a list of all open stage transition requests for the model version. @@ -3911,7 +4936,7 @@ def list_webhooks(self, *, events: Optional[List[RegistryWebhookEvent]] = None, model_name: Optional[str] = None, - page_token: Optional[str] = None) -> Iterator['RegistryWebhook']: + page_token: Optional[str] = None) -> Iterator[RegistryWebhook]: """List registry webhooks. **NOTE:** This endpoint is in Public Preview. @@ -4008,7 +5033,7 @@ def search_model_versions(self, filter: Optional[str] = None, max_results: Optional[int] = None, order_by: Optional[List[str]] = None, - page_token: Optional[str] = None) -> Iterator['ModelVersion']: + page_token: Optional[str] = None) -> Iterator[ModelVersion]: """Searches model versions. Searches for specific model versions based on the supplied __filter__. @@ -4050,7 +5075,7 @@ def search_models(self, filter: Optional[str] = None, max_results: Optional[int] = None, order_by: Optional[List[str]] = None, - page_token: Optional[str] = None) -> Iterator['Model']: + page_token: Optional[str] = None) -> Iterator[Model]: """Search models. Search for registered models based on the specified __filter__. diff --git a/databricks/sdk/service/oauth2.py b/databricks/sdk/service/oauth2.py index 113470bc8..9a48d9082 100755 --- a/databricks/sdk/service/oauth2.py +++ b/databricks/sdk/service/oauth2.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from typing import Dict, Iterator, List, Optional @@ -14,12 +16,23 @@ @dataclass class CreateCustomAppIntegration: name: str - redirect_urls: 'List[str]' + """name of the custom oauth app""" + + redirect_urls: List[str] + """List of oauth redirect urls""" + confidential: Optional[bool] = None - scopes: Optional['List[str]'] = None - token_access_policy: Optional['TokenAccessPolicy'] = None + """indicates if an oauth client-secret should be generated""" + + scopes: Optional[List[str]] = None + """OAuth scopes granted to the application. Supported scopes: all-apis, sql, offline_access, + openid, profile, email.""" + + token_access_policy: Optional[TokenAccessPolicy] = None + """Token access policy""" def as_dict(self) -> dict: + """Serializes the CreateCustomAppIntegration into a dictionary suitable for use as a JSON request body.""" body = {} if self.confidential is not None: body['confidential'] = self.confidential if self.name is not None: body['name'] = self.name @@ -29,7 +42,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCustomAppIntegration': + def from_dict(cls, d: Dict[str, any]) -> CreateCustomAppIntegration: + """Deserializes the CreateCustomAppIntegration from a dictionary.""" return cls(confidential=d.get('confidential', None), name=d.get('name', None), redirect_urls=d.get('redirect_urls', None), @@ -40,10 +54,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCustomAppIntegration': @dataclass class CreateCustomAppIntegrationOutput: client_id: Optional[str] = None + """oauth client-id generated by the Databricks""" + client_secret: Optional[str] = None + """oauth client-secret generated by the Databricks if this is a confidential oauth app + client-secret will be generated.""" + integration_id: Optional[str] = None + """unique integration id for the custom oauth app""" def as_dict(self) -> dict: + """Serializes the CreateCustomAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.client_id is not None: body['client_id'] = self.client_id if self.client_secret is not None: body['client_secret'] = self.client_secret @@ -51,7 +72,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCustomAppIntegrationOutput': + def from_dict(cls, d: Dict[str, any]) -> CreateCustomAppIntegrationOutput: + """Deserializes the CreateCustomAppIntegrationOutput from a dictionary.""" return cls(client_id=d.get('client_id', None), client_secret=d.get('client_secret', None), integration_id=d.get('integration_id', None)) @@ -60,16 +82,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCustomAppIntegrationOutput': @dataclass class CreatePublishedAppIntegration: app_id: Optional[str] = None - token_access_policy: Optional['TokenAccessPolicy'] = None + """app_id of the oauth published app integration. For example power-bi, tableau-deskop""" + + token_access_policy: Optional[TokenAccessPolicy] = None + """Token access policy""" def as_dict(self) -> dict: + """Serializes the CreatePublishedAppIntegration into a dictionary suitable for use as a JSON request body.""" body = {} if self.app_id is not None: body['app_id'] = self.app_id if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePublishedAppIntegration': + def from_dict(cls, d: Dict[str, any]) -> CreatePublishedAppIntegration: + """Deserializes the CreatePublishedAppIntegration from a dictionary.""" return cls(app_id=d.get('app_id', None), token_access_policy=_from_dict(d, 'token_access_policy', TokenAccessPolicy)) @@ -77,27 +104,42 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreatePublishedAppIntegration': @dataclass class CreatePublishedAppIntegrationOutput: integration_id: Optional[str] = None + """unique integration id for the published oauth app""" def as_dict(self) -> dict: + """Serializes the CreatePublishedAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.integration_id is not None: body['integration_id'] = self.integration_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePublishedAppIntegrationOutput': + def from_dict(cls, d: Dict[str, any]) -> CreatePublishedAppIntegrationOutput: + """Deserializes the CreatePublishedAppIntegrationOutput from a dictionary.""" return cls(integration_id=d.get('integration_id', None)) @dataclass class CreateServicePrincipalSecretResponse: create_time: Optional[str] = None + """UTC time when the secret was created""" + id: Optional[str] = None + """ID of the secret""" + secret: Optional[str] = None + """Secret Value""" + secret_hash: Optional[str] = None + """Secret Hash""" + status: Optional[str] = None + """Status of the secret""" + update_time: Optional[str] = None + """UTC time when the secret was updated""" def as_dict(self) -> dict: + """Serializes the CreateServicePrincipalSecretResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.create_time is not None: body['create_time'] = self.create_time if self.id is not None: body['id'] = self.id @@ -108,7 +150,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateServicePrincipalSecretResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateServicePrincipalSecretResponse: + """Deserializes the CreateServicePrincipalSecretResponse from a dictionary.""" return cls(create_time=d.get('create_time', None), id=d.get('id', None), secret=d.get('secret', None), @@ -120,13 +163,25 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateServicePrincipalSecretResponse': @dataclass class GetCustomAppIntegrationOutput: client_id: Optional[str] = None + """oauth client id of the custom oauth app""" + confidential: Optional[bool] = None + """indicates if an oauth client-secret should be generated""" + integration_id: Optional[str] = None + """ID of this custom app""" + name: Optional[str] = None - redirect_urls: Optional['List[str]'] = None - token_access_policy: Optional['TokenAccessPolicy'] = None + """name of the custom oauth app""" + + redirect_urls: Optional[List[str]] = None + """List of oauth redirect urls""" + + token_access_policy: Optional[TokenAccessPolicy] = None + """Token access policy""" def as_dict(self) -> dict: + """Serializes the GetCustomAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.client_id is not None: body['client_id'] = self.client_id if self.confidential is not None: body['confidential'] = self.confidential @@ -137,7 +192,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetCustomAppIntegrationOutput': + def from_dict(cls, d: Dict[str, any]) -> GetCustomAppIntegrationOutput: + """Deserializes the GetCustomAppIntegrationOutput from a dictionary.""" return cls(client_id=d.get('client_id', None), confidential=d.get('confidential', None), integration_id=d.get('integration_id', None), @@ -148,26 +204,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetCustomAppIntegrationOutput': @dataclass class GetCustomAppIntegrationsOutput: - apps: Optional['List[GetCustomAppIntegrationOutput]'] = None + apps: Optional[List[GetCustomAppIntegrationOutput]] = None + """Array of Custom OAuth App Integrations defined for the account.""" def as_dict(self) -> dict: + """Serializes the GetCustomAppIntegrationsOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.apps: body['apps'] = [v.as_dict() for v in self.apps] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetCustomAppIntegrationsOutput': + def from_dict(cls, d: Dict[str, any]) -> GetCustomAppIntegrationsOutput: + """Deserializes the GetCustomAppIntegrationsOutput from a dictionary.""" return cls(apps=_repeated_dict(d, 'apps', GetCustomAppIntegrationOutput)) @dataclass class GetPublishedAppIntegrationOutput: app_id: Optional[str] = None + """app-id of the published app integration""" + integration_id: Optional[str] = None + """unique integration id for the published oauth app""" + name: Optional[str] = None - token_access_policy: Optional['TokenAccessPolicy'] = None + """name of the published oauth app""" + + token_access_policy: Optional[TokenAccessPolicy] = None + """Token access policy""" def as_dict(self) -> dict: + """Serializes the GetPublishedAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.app_id is not None: body['app_id'] = self.app_id if self.integration_id is not None: body['integration_id'] = self.integration_id @@ -176,7 +243,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPublishedAppIntegrationOutput': + def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppIntegrationOutput: + """Deserializes the GetPublishedAppIntegrationOutput from a dictionary.""" return cls(app_id=d.get('app_id', None), integration_id=d.get('integration_id', None), name=d.get('name', None), @@ -185,60 +253,87 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetPublishedAppIntegrationOutput': @dataclass class GetPublishedAppIntegrationsOutput: - apps: Optional['List[GetPublishedAppIntegrationOutput]'] = None + apps: Optional[List[GetPublishedAppIntegrationOutput]] = None + """Array of Published OAuth App Integrations defined for the account.""" def as_dict(self) -> dict: + """Serializes the GetPublishedAppIntegrationsOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.apps: body['apps'] = [v.as_dict() for v in self.apps] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPublishedAppIntegrationsOutput': + def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppIntegrationsOutput: + """Deserializes the GetPublishedAppIntegrationsOutput from a dictionary.""" return cls(apps=_repeated_dict(d, 'apps', GetPublishedAppIntegrationOutput)) @dataclass class GetPublishedAppsOutput: - apps: Optional['List[PublishedAppOutput]'] = None + apps: Optional[List[PublishedAppOutput]] = None + """Array of Published OAuth Apps.""" + next_page_token: Optional[str] = None + """A token that can be used to get the next page of results. If not present, there are no more + results to show.""" def as_dict(self) -> dict: + """Serializes the GetPublishedAppsOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.apps: body['apps'] = [v.as_dict() for v in self.apps] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPublishedAppsOutput': + def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppsOutput: + """Deserializes the GetPublishedAppsOutput from a dictionary.""" return cls(apps=_repeated_dict(d, 'apps', PublishedAppOutput), next_page_token=d.get('next_page_token', None)) @dataclass class ListServicePrincipalSecretsResponse: - secrets: Optional['List[SecretInfo]'] = None + secrets: Optional[List[SecretInfo]] = None + """List of the secrets""" def as_dict(self) -> dict: + """Serializes the ListServicePrincipalSecretsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.secrets: body['secrets'] = [v.as_dict() for v in self.secrets] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListServicePrincipalSecretsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListServicePrincipalSecretsResponse: + """Deserializes the ListServicePrincipalSecretsResponse from a dictionary.""" return cls(secrets=_repeated_dict(d, 'secrets', SecretInfo)) @dataclass class PublishedAppOutput: app_id: Optional[str] = None + """Unique ID of the published OAuth app.""" + client_id: Optional[str] = None + """Client ID of the published OAuth app. It is the client_id in the OAuth flow""" + description: Optional[str] = None + """Description of the published OAuth app.""" + is_confidential_client: Optional[bool] = None + """Whether the published OAuth app is a confidential client. It is always false for published OAuth + apps.""" + name: Optional[str] = None - redirect_urls: Optional['List[str]'] = None - scopes: Optional['List[str]'] = None + """Name of the published OAuth app.""" + + redirect_urls: Optional[List[str]] = None + """Redirect URLs of the published OAuth app.""" + + scopes: Optional[List[str]] = None + """Required scopes for the published OAuth app.""" def as_dict(self) -> dict: + """Serializes the PublishedAppOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.app_id is not None: body['app_id'] = self.app_id if self.client_id is not None: body['client_id'] = self.client_id @@ -251,7 +346,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PublishedAppOutput': + def from_dict(cls, d: Dict[str, any]) -> PublishedAppOutput: + """Deserializes the PublishedAppOutput from a dictionary.""" return cls(app_id=d.get('app_id', None), client_id=d.get('client_id', None), description=d.get('description', None), @@ -264,12 +360,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'PublishedAppOutput': @dataclass class SecretInfo: create_time: Optional[str] = None + """UTC time when the secret was created""" + id: Optional[str] = None + """ID of the secret""" + secret_hash: Optional[str] = None + """Secret Hash""" + status: Optional[str] = None + """Status of the secret""" + update_time: Optional[str] = None + """UTC time when the secret was updated""" def as_dict(self) -> dict: + """Serializes the SecretInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.create_time is not None: body['create_time'] = self.create_time if self.id is not None: body['id'] = self.id @@ -279,7 +385,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SecretInfo': + def from_dict(cls, d: Dict[str, any]) -> SecretInfo: + """Deserializes the SecretInfo from a dictionary.""" return cls(create_time=d.get('create_time', None), id=d.get('id', None), secret_hash=d.get('secret_hash', None), @@ -290,9 +397,13 @@ def from_dict(cls, d: Dict[str, any]) -> 'SecretInfo': @dataclass class TokenAccessPolicy: access_token_ttl_in_minutes: Optional[int] = None + """access token time to live in minutes""" + refresh_token_ttl_in_minutes: Optional[int] = None + """refresh token time to live in minutes""" def as_dict(self) -> dict: + """Serializes the TokenAccessPolicy into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_token_ttl_in_minutes is not None: body['access_token_ttl_in_minutes'] = self.access_token_ttl_in_minutes @@ -301,7 +412,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenAccessPolicy': + def from_dict(cls, d: Dict[str, any]) -> TokenAccessPolicy: + """Deserializes the TokenAccessPolicy from a dictionary.""" return cls(access_token_ttl_in_minutes=d.get('access_token_ttl_in_minutes', None), refresh_token_ttl_in_minutes=d.get('refresh_token_ttl_in_minutes', None)) @@ -309,10 +421,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'TokenAccessPolicy': @dataclass class UpdateCustomAppIntegration: integration_id: Optional[str] = None - redirect_urls: Optional['List[str]'] = None - token_access_policy: Optional['TokenAccessPolicy'] = None + """The oauth app integration ID.""" + + redirect_urls: Optional[List[str]] = None + """List of oauth redirect urls to be updated in the custom oauth app integration""" + + token_access_policy: Optional[TokenAccessPolicy] = None + """Token access policy to be updated in the custom oauth app integration""" def as_dict(self) -> dict: + """Serializes the UpdateCustomAppIntegration into a dictionary suitable for use as a JSON request body.""" body = {} if self.integration_id is not None: body['integration_id'] = self.integration_id if self.redirect_urls: body['redirect_urls'] = [v for v in self.redirect_urls] @@ -320,7 +438,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateCustomAppIntegration': + def from_dict(cls, d: Dict[str, any]) -> UpdateCustomAppIntegration: + """Deserializes the UpdateCustomAppIntegration from a dictionary.""" return cls(integration_id=d.get('integration_id', None), redirect_urls=d.get('redirect_urls', None), token_access_policy=_from_dict(d, 'token_access_policy', TokenAccessPolicy)) @@ -329,16 +448,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateCustomAppIntegration': @dataclass class UpdatePublishedAppIntegration: integration_id: Optional[str] = None - token_access_policy: Optional['TokenAccessPolicy'] = None + """The oauth app integration ID.""" + + token_access_policy: Optional[TokenAccessPolicy] = None + """Token access policy to be updated in the published oauth app integration""" def as_dict(self) -> dict: + """Serializes the UpdatePublishedAppIntegration into a dictionary suitable for use as a JSON request body.""" body = {} if self.integration_id is not None: body['integration_id'] = self.integration_id if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdatePublishedAppIntegration': + def from_dict(cls, d: Dict[str, any]) -> UpdatePublishedAppIntegration: + """Deserializes the UpdatePublishedAppIntegration from a dictionary.""" return cls(integration_id=d.get('integration_id', None), token_access_policy=_from_dict(d, 'token_access_policy', TokenAccessPolicy)) @@ -426,7 +550,7 @@ def get(self, integration_id: str) -> GetCustomAppIntegrationOutput: headers=headers) return GetCustomAppIntegrationOutput.from_dict(res) - def list(self) -> Iterator['GetCustomAppIntegrationOutput']: + def list(self) -> Iterator[GetCustomAppIntegrationOutput]: """Get custom oauth app integrations. Get the list of custom oauth app integrations for the specified Databricks account @@ -482,7 +606,7 @@ def __init__(self, api_client): def list(self, *, page_size: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['PublishedAppOutput']: + page_token: Optional[str] = None) -> Iterator[PublishedAppOutput]: """Get all the published OAuth apps. Get all the available published OAuth apps in Databricks. @@ -585,7 +709,7 @@ def get(self, integration_id: str) -> GetPublishedAppIntegrationOutput: headers=headers) return GetPublishedAppIntegrationOutput.from_dict(res) - def list(self) -> Iterator['GetPublishedAppIntegrationOutput']: + def list(self) -> Iterator[GetPublishedAppIntegrationOutput]: """Get published oauth app integrations. Get the list of published oauth app integrations for the specified Databricks account @@ -676,7 +800,7 @@ def delete(self, service_principal_id: int, secret_id: str): f'/api/2.0/accounts/{self._api.account_id}/servicePrincipals/{service_principal_id}/credentials/secrets/{secret_id}', headers=headers) - def list(self, service_principal_id: int) -> Iterator['SecretInfo']: + def list(self, service_principal_id: int) -> Iterator[SecretInfo]: """List service principal secrets. List all secrets associated with the given service principal. This operation only returns information diff --git a/databricks/sdk/service/pipelines.py b/databricks/sdk/service/pipelines.py index 93f383ae2..560e76991 100755 --- a/databricks/sdk/service/pipelines.py +++ b/databricks/sdk/service/pipelines.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging import random import time @@ -21,26 +23,68 @@ @dataclass class CreatePipeline: allow_duplicate_names: Optional[bool] = None + """If false, deployment will fail if name conflicts with that of another pipeline.""" + catalog: Optional[str] = None + """A catalog in Unity Catalog to publish data from this pipeline to. If `target` is specified, + tables in this pipeline are published to a `target` schema inside `catalog` (for example, + `catalog`.`target`.`table`). If `target` is not specified, no data is published to Unity + Catalog.""" + channel: Optional[str] = None - clusters: Optional['List[PipelineCluster]'] = None - configuration: Optional['Dict[str,str]'] = None + """DLT Release Channel that specifies which version to use.""" + + clusters: Optional[List[PipelineCluster]] = None + """Cluster settings for this pipeline deployment.""" + + configuration: Optional[Dict[str, str]] = None + """String-String configuration for this pipeline execution.""" + continuous: Optional[bool] = None + """Whether the pipeline is continuous or triggered. This replaces `trigger`.""" + development: Optional[bool] = None + """Whether the pipeline is in Development mode. Defaults to false.""" + dry_run: Optional[bool] = None + edition: Optional[str] = None - filters: Optional['Filters'] = None + """Pipeline product edition.""" + + filters: Optional[Filters] = None + """Filters on which Pipeline packages to include in the deployed graph.""" + id: Optional[str] = None - libraries: Optional['List[PipelineLibrary]'] = None + """Unique identifier for this pipeline.""" + + libraries: Optional[List[PipelineLibrary]] = None + """Libraries or code needed by this deployment.""" + name: Optional[str] = None - notifications: Optional['List[Notifications]'] = None + """Friendly identifier for this pipeline.""" + + notifications: Optional[List[Notifications]] = None + """List of notification settings for this pipeline.""" + photon: Optional[bool] = None + """Whether Photon is enabled for this pipeline.""" + serverless: Optional[bool] = None + """Whether serverless compute is enabled for this pipeline.""" + storage: Optional[str] = None + """DBFS root directory for storing checkpoints and tables.""" + target: Optional[str] = None - trigger: Optional['PipelineTrigger'] = None + """Target schema (database) to add tables in this pipeline to. If not specified, no data is + published to the Hive metastore or Unity Catalog. To publish to Unity Catalog, also specify + `catalog`.""" + + trigger: Optional[PipelineTrigger] = None + """Which pipeline trigger to use. Deprecated: Use `continuous` instead.""" def as_dict(self) -> dict: + """Serializes the CreatePipeline into a dictionary suitable for use as a JSON request body.""" body = {} if self.allow_duplicate_names is not None: body['allow_duplicate_names'] = self.allow_duplicate_names if self.catalog is not None: body['catalog'] = self.catalog @@ -64,7 +108,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePipeline': + def from_dict(cls, d: Dict[str, any]) -> CreatePipeline: + """Deserializes the CreatePipeline from a dictionary.""" return cls(allow_duplicate_names=d.get('allow_duplicate_names', None), catalog=d.get('catalog', None), channel=d.get('channel', None), @@ -88,17 +133,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreatePipeline': @dataclass class CreatePipelineResponse: - effective_settings: Optional['PipelineSpec'] = None + effective_settings: Optional[PipelineSpec] = None + """Only returned when dry_run is true.""" + pipeline_id: Optional[str] = None + """The unique identifier for the newly created pipeline. Only returned when dry_run is false.""" def as_dict(self) -> dict: + """Serializes the CreatePipelineResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.effective_settings: body['effective_settings'] = self.effective_settings.as_dict() if self.pipeline_id is not None: body['pipeline_id'] = self.pipeline_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePipelineResponse': + def from_dict(cls, d: Dict[str, any]) -> CreatePipelineResponse: + """Deserializes the CreatePipelineResponse from a dictionary.""" return cls(effective_settings=_from_dict(d, 'effective_settings', PipelineSpec), pipeline_id=d.get('pipeline_id', None)) @@ -106,16 +156,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreatePipelineResponse': @dataclass class CronTrigger: quartz_cron_schedule: Optional[str] = None + timezone_id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the CronTrigger into a dictionary suitable for use as a JSON request body.""" body = {} if self.quartz_cron_schedule is not None: body['quartz_cron_schedule'] = self.quartz_cron_schedule if self.timezone_id is not None: body['timezone_id'] = self.timezone_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CronTrigger': + def from_dict(cls, d: Dict[str, any]) -> CronTrigger: + """Deserializes the CronTrigger from a dictionary.""" return cls(quartz_cron_schedule=d.get('quartz_cron_schedule', None), timezone_id=d.get('timezone_id', None)) @@ -123,43 +176,94 @@ def from_dict(cls, d: Dict[str, any]) -> 'CronTrigger': @dataclass class DataPlaneId: instance: Optional[str] = None + """The instance name of the data plane emitting an event.""" + seq_no: Optional[Any] = None + """A sequence number, unique and increasing within the data plane instance.""" def as_dict(self) -> dict: + """Serializes the DataPlaneId into a dictionary suitable for use as a JSON request body.""" body = {} if self.instance is not None: body['instance'] = self.instance if self.seq_no: body['seq_no'] = self.seq_no return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DataPlaneId': + def from_dict(cls, d: Dict[str, any]) -> DataPlaneId: + """Deserializes the DataPlaneId from a dictionary.""" return cls(instance=d.get('instance', None), seq_no=d.get('seq_no', None)) @dataclass class EditPipeline: allow_duplicate_names: Optional[bool] = None + """If false, deployment will fail if name has changed and conflicts the name of another pipeline.""" + catalog: Optional[str] = None + """A catalog in Unity Catalog to publish data from this pipeline to. If `target` is specified, + tables in this pipeline are published to a `target` schema inside `catalog` (for example, + `catalog`.`target`.`table`). If `target` is not specified, no data is published to Unity + Catalog.""" + channel: Optional[str] = None - clusters: Optional['List[PipelineCluster]'] = None - configuration: Optional['Dict[str,str]'] = None + """DLT Release Channel that specifies which version to use.""" + + clusters: Optional[List[PipelineCluster]] = None + """Cluster settings for this pipeline deployment.""" + + configuration: Optional[Dict[str, str]] = None + """String-String configuration for this pipeline execution.""" + continuous: Optional[bool] = None + """Whether the pipeline is continuous or triggered. This replaces `trigger`.""" + development: Optional[bool] = None + """Whether the pipeline is in Development mode. Defaults to false.""" + edition: Optional[str] = None + """Pipeline product edition.""" + expected_last_modified: Optional[int] = None - filters: Optional['Filters'] = None + """If present, the last-modified time of the pipeline settings before the edit. If the settings + were modified after that time, then the request will fail with a conflict.""" + + filters: Optional[Filters] = None + """Filters on which Pipeline packages to include in the deployed graph.""" + id: Optional[str] = None - libraries: Optional['List[PipelineLibrary]'] = None + """Unique identifier for this pipeline.""" + + libraries: Optional[List[PipelineLibrary]] = None + """Libraries or code needed by this deployment.""" + name: Optional[str] = None - notifications: Optional['List[Notifications]'] = None + """Friendly identifier for this pipeline.""" + + notifications: Optional[List[Notifications]] = None + """List of notification settings for this pipeline.""" + photon: Optional[bool] = None + """Whether Photon is enabled for this pipeline.""" + pipeline_id: Optional[str] = None + """Unique identifier for this pipeline.""" + serverless: Optional[bool] = None + """Whether serverless compute is enabled for this pipeline.""" + storage: Optional[str] = None + """DBFS root directory for storing checkpoints and tables.""" + target: Optional[str] = None - trigger: Optional['PipelineTrigger'] = None + """Target schema (database) to add tables in this pipeline to. If not specified, no data is + published to the Hive metastore or Unity Catalog. To publish to Unity Catalog, also specify + `catalog`.""" + + trigger: Optional[PipelineTrigger] = None + """Which pipeline trigger to use. Deprecated: Use `continuous` instead.""" def as_dict(self) -> dict: + """Serializes the EditPipeline into a dictionary suitable for use as a JSON request body.""" body = {} if self.allow_duplicate_names is not None: body['allow_duplicate_names'] = self.allow_duplicate_names if self.catalog is not None: body['catalog'] = self.catalog @@ -185,7 +289,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EditPipeline': + def from_dict(cls, d: Dict[str, any]) -> EditPipeline: + """Deserializes the EditPipeline from a dictionary.""" return cls(allow_duplicate_names=d.get('allow_duplicate_names', None), catalog=d.get('catalog', None), channel=d.get('channel', None), @@ -210,17 +315,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'EditPipeline': @dataclass class ErrorDetail: - exceptions: Optional['List[SerializedException]'] = None + exceptions: Optional[List[SerializedException]] = None + """The exception thrown for this error, with its chain of cause.""" + fatal: Optional[bool] = None + """Whether this error is considered fatal, that is, unrecoverable.""" def as_dict(self) -> dict: + """Serializes the ErrorDetail into a dictionary suitable for use as a JSON request body.""" body = {} if self.exceptions: body['exceptions'] = [v.as_dict() for v in self.exceptions] if self.fatal is not None: body['fatal'] = self.fatal return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ErrorDetail': + def from_dict(cls, d: Dict[str, any]) -> ErrorDetail: + """Deserializes the ErrorDetail from a dictionary.""" return cls(exceptions=_repeated_dict(d, 'exceptions', SerializedException), fatal=d.get('fatal', None)) @@ -237,62 +347,95 @@ class EventLevel(Enum): @dataclass class FileLibrary: path: Optional[str] = None + """The absolute path of the file.""" def as_dict(self) -> dict: + """Serializes the FileLibrary into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FileLibrary': + def from_dict(cls, d: Dict[str, any]) -> FileLibrary: + """Deserializes the FileLibrary from a dictionary.""" return cls(path=d.get('path', None)) @dataclass class Filters: - exclude: Optional['List[str]'] = None - include: Optional['List[str]'] = None + exclude: Optional[List[str]] = None + """Paths to exclude.""" + + include: Optional[List[str]] = None + """Paths to include.""" def as_dict(self) -> dict: + """Serializes the Filters into a dictionary suitable for use as a JSON request body.""" body = {} if self.exclude: body['exclude'] = [v for v in self.exclude] if self.include: body['include'] = [v for v in self.include] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Filters': + def from_dict(cls, d: Dict[str, any]) -> Filters: + """Deserializes the Filters from a dictionary.""" return cls(exclude=d.get('exclude', None), include=d.get('include', None)) @dataclass class GetPipelinePermissionLevelsResponse: - permission_levels: Optional['List[PipelinePermissionsDescription]'] = None + permission_levels: Optional[List[PipelinePermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetPipelinePermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPipelinePermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetPipelinePermissionLevelsResponse: + """Deserializes the GetPipelinePermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', PipelinePermissionsDescription)) @dataclass class GetPipelineResponse: cause: Optional[str] = None + """An optional message detailing the cause of the pipeline state.""" + cluster_id: Optional[str] = None + """The ID of the cluster that the pipeline is running on.""" + creator_user_name: Optional[str] = None - health: Optional['GetPipelineResponseHealth'] = None + """The username of the pipeline creator.""" + + health: Optional[GetPipelineResponseHealth] = None + """The health of a pipeline.""" + last_modified: Optional[int] = None - latest_updates: Optional['List[UpdateStateInfo]'] = None + """The last time the pipeline settings were modified or created.""" + + latest_updates: Optional[List[UpdateStateInfo]] = None + """Status of the latest updates for the pipeline. Ordered with the newest update first.""" + name: Optional[str] = None + """A human friendly identifier for the pipeline, taken from the `spec`.""" + pipeline_id: Optional[str] = None + """The ID of the pipeline.""" + run_as_user_name: Optional[str] = None - spec: Optional['PipelineSpec'] = None - state: Optional['PipelineState'] = None + """Username of the user that the pipeline will run on behalf of.""" + + spec: Optional[PipelineSpec] = None + """The pipeline specification. This field is not returned when called by `ListPipelines`.""" + + state: Optional[PipelineState] = None + """The pipeline state.""" def as_dict(self) -> dict: + """Serializes the GetPipelineResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.cause is not None: body['cause'] = self.cause if self.cluster_id is not None: body['cluster_id'] = self.cluster_id @@ -308,7 +451,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetPipelineResponse': + def from_dict(cls, d: Dict[str, any]) -> GetPipelineResponse: + """Deserializes the GetPipelineResponse from a dictionary.""" return cls(cause=d.get('cause', None), cluster_id=d.get('cluster_id', None), creator_user_name=d.get('creator_user_name', None), @@ -331,25 +475,34 @@ class GetPipelineResponseHealth(Enum): @dataclass class GetUpdateResponse: - update: Optional['UpdateInfo'] = None + update: Optional[UpdateInfo] = None + """The current update info.""" def as_dict(self) -> dict: + """Serializes the GetUpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.update: body['update'] = self.update.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetUpdateResponse': + def from_dict(cls, d: Dict[str, any]) -> GetUpdateResponse: + """Deserializes the GetUpdateResponse from a dictionary.""" return cls(update=_from_dict(d, 'update', UpdateInfo)) @dataclass class ListPipelineEventsResponse: - events: Optional['List[PipelineEvent]'] = None + events: Optional[List[PipelineEvent]] = None + """The list of events matching the request criteria.""" + next_page_token: Optional[str] = None + """If present, a token to fetch the next page of events.""" + prev_page_token: Optional[str] = None + """If present, a token to fetch the previous page of events.""" def as_dict(self) -> dict: + """Serializes the ListPipelineEventsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.events: body['events'] = [v.as_dict() for v in self.events] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token @@ -357,7 +510,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListPipelineEventsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListPipelineEventsResponse: + """Deserializes the ListPipelineEventsResponse from a dictionary.""" return cls(events=_repeated_dict(d, 'events', PipelineEvent), next_page_token=d.get('next_page_token', None), prev_page_token=d.get('prev_page_token', None)) @@ -366,16 +520,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListPipelineEventsResponse': @dataclass class ListPipelinesResponse: next_page_token: Optional[str] = None - statuses: Optional['List[PipelineStateInfo]'] = None + """If present, a token to fetch the next page of events.""" + + statuses: Optional[List[PipelineStateInfo]] = None + """The list of events matching the request criteria.""" def as_dict(self) -> dict: + """Serializes the ListPipelinesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.statuses: body['statuses'] = [v.as_dict() for v in self.statuses] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListPipelinesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListPipelinesResponse: + """Deserializes the ListPipelinesResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), statuses=_repeated_dict(d, 'statuses', PipelineStateInfo)) @@ -383,10 +542,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListPipelinesResponse': @dataclass class ListUpdatesResponse: next_page_token: Optional[str] = None + """If present, then there are more results, and this a token to be used in a subsequent request to + fetch the next page.""" + prev_page_token: Optional[str] = None - updates: Optional['List[UpdateInfo]'] = None + """If present, then this token can be used in a subsequent request to fetch the previous page.""" + + updates: Optional[List[UpdateInfo]] = None def as_dict(self) -> dict: + """Serializes the ListUpdatesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.prev_page_token is not None: body['prev_page_token'] = self.prev_page_token @@ -394,7 +559,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListUpdatesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListUpdatesResponse: + """Deserializes the ListUpdatesResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), prev_page_token=d.get('prev_page_token', None), updates=_repeated_dict(d, 'updates', UpdateInfo)) @@ -411,54 +577,102 @@ class MaturityLevel(Enum): @dataclass class NotebookLibrary: path: Optional[str] = None + """The absolute path of the notebook.""" def as_dict(self) -> dict: + """Serializes the NotebookLibrary into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NotebookLibrary': + def from_dict(cls, d: Dict[str, any]) -> NotebookLibrary: + """Deserializes the NotebookLibrary from a dictionary.""" return cls(path=d.get('path', None)) @dataclass class Notifications: - alerts: Optional['List[str]'] = None - email_recipients: Optional['List[str]'] = None + alerts: Optional[List[str]] = None + """A list of alerts that trigger the sending of notifications to the configured destinations. The + supported alerts are: + + * `on-update-success`: A pipeline update completes successfully. * `on-update-failure`: Each + time a pipeline update fails. * `on-update-fatal-failure`: A pipeline update fails with a + non-retryable (fatal) error. * `on-flow-failure`: A single data flow fails.""" + + email_recipients: Optional[List[str]] = None + """A list of email addresses notified when a configured alert is triggered.""" def as_dict(self) -> dict: + """Serializes the Notifications into a dictionary suitable for use as a JSON request body.""" body = {} if self.alerts: body['alerts'] = [v for v in self.alerts] if self.email_recipients: body['email_recipients'] = [v for v in self.email_recipients] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Notifications': + def from_dict(cls, d: Dict[str, any]) -> Notifications: + """Deserializes the Notifications from a dictionary.""" return cls(alerts=d.get('alerts', None), email_recipients=d.get('email_recipients', None)) @dataclass class Origin: batch_id: Optional[int] = None + """The id of a batch. Unique within a flow.""" + cloud: Optional[str] = None + """The cloud provider, e.g., AWS or Azure.""" + cluster_id: Optional[str] = None + """The id of the cluster where an execution happens. Unique within a region.""" + dataset_name: Optional[str] = None + """The name of a dataset. Unique within a pipeline.""" + flow_id: Optional[str] = None + """The id of the flow. Globally unique. Incremental queries will generally reuse the same id while + complete queries will have a new id per update.""" + flow_name: Optional[str] = None + """The name of the flow. Not unique.""" + host: Optional[str] = None + """The optional host name where the event was triggered""" + maintenance_id: Optional[str] = None + """The id of a maintenance run. Globally unique.""" + materialization_name: Optional[str] = None + """Materialization name.""" + org_id: Optional[int] = None + """The org id of the user. Unique within a cloud.""" + pipeline_id: Optional[str] = None + """The id of the pipeline. Globally unique.""" + pipeline_name: Optional[str] = None + """The name of the pipeline. Not unique.""" + region: Optional[str] = None + """The cloud region.""" + request_id: Optional[str] = None + """The id of the request that caused an update.""" + table_id: Optional[str] = None + """The id of a (delta) table. Globally unique.""" + uc_resource_id: Optional[str] = None + """The Unity Catalog id of the MV or ST being updated.""" + update_id: Optional[str] = None + """The id of an execution. Globally unique.""" def as_dict(self) -> dict: + """Serializes the Origin into a dictionary suitable for use as a JSON request body.""" body = {} if self.batch_id is not None: body['batch_id'] = self.batch_id if self.cloud is not None: body['cloud'] = self.cloud @@ -480,7 +694,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Origin': + def from_dict(cls, d: Dict[str, any]) -> Origin: + """Deserializes the Origin from a dictionary.""" return cls(batch_id=d.get('batch_id', None), cloud=d.get('cloud', None), cluster_id=d.get('cluster_id', None), @@ -503,11 +718,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'Origin': @dataclass class PipelineAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['PipelinePermissionLevel'] = None + """name of the group""" + + permission_level: Optional[PipelinePermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the PipelineAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -517,7 +741,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> PipelineAccessControlRequest: + """Deserializes the PipelineAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', PipelinePermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -526,13 +751,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelineAccessControlRequest': @dataclass class PipelineAccessControlResponse: - all_permissions: Optional['List[PipelinePermission]'] = None + all_permissions: Optional[List[PipelinePermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the PipelineAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -543,7 +778,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> PipelineAccessControlResponse: + """Deserializes the PipelineAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', PipelinePermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -554,24 +790,99 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelineAccessControlResponse': @dataclass class PipelineCluster: apply_policy_default_values: Optional[bool] = None - autoscale: Optional['compute.AutoScale'] = None - aws_attributes: Optional['compute.AwsAttributes'] = None - azure_attributes: Optional['compute.AzureAttributes'] = None - cluster_log_conf: Optional['compute.ClusterLogConf'] = None - custom_tags: Optional['Dict[str,str]'] = None + """Note: This field won't be persisted. Only API users will check this field.""" + + autoscale: Optional[compute.AutoScale] = None + """Parameters needed in order to automatically scale clusters up and down based on load. Note: + autoscaling works best with DB runtime versions 3.0 or later.""" + + aws_attributes: Optional[compute.AwsAttributes] = None + """Attributes related to clusters running on Amazon Web Services. If not specified at cluster + creation, a set of default values will be used.""" + + azure_attributes: Optional[compute.AzureAttributes] = None + """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, + a set of default values will be used.""" + + cluster_log_conf: Optional[compute.ClusterLogConf] = None + """The configuration for delivering spark logs to a long-term storage destination. Only dbfs + destinations are supported. Only one destination can be specified for one cluster. If the conf + is given, the logs will be delivered to the destination every `5 mins`. The destination of + driver logs is `$destination/$clusterId/driver`, while the destination of executor logs is + `$destination/$clusterId/executor`.""" + + custom_tags: Optional[Dict[str, str]] = None + """Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster + tags""" + driver_instance_pool_id: Optional[str] = None + """The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster + uses the instance pool with id (instance_pool_id) if the driver pool is not assigned.""" + driver_node_type_id: Optional[str] = None - gcp_attributes: Optional['compute.GcpAttributes'] = None + """The node type of the Spark driver. Note that this field is optional; if unset, the driver node + type will be set as the same value as `node_type_id` defined above.""" + + gcp_attributes: Optional[compute.GcpAttributes] = None + """Attributes related to clusters running on Google Cloud Platform. If not specified at cluster + creation, a set of default values will be used.""" + instance_pool_id: Optional[str] = None + """The optional ID of the instance pool to which the cluster belongs.""" + label: Optional[str] = None + """A label for the cluster specification, either `default` to configure the default cluster, or + `maintenance` to configure the maintenance cluster. This field is optional. The default value is + `default`.""" + node_type_id: Optional[str] = None + """This field encodes, through a single value, the resources available to each of the Spark nodes + in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or + compute intensive workloads. A list of available node types can be retrieved by using the + :method:clusters/listNodeTypes API call.""" + num_workers: Optional[int] = None + """Number of worker nodes that this cluster should have. A cluster has one Spark Driver and + `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number of + workers rather than the actual current number of workers. For instance, if a cluster is resized + from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 + workers, whereas the workers listed in `spark_info` will gradually increase from 5 to 10 as the + new nodes are provisioned.""" + policy_id: Optional[str] = None - spark_conf: Optional['Dict[str,str]'] = None - spark_env_vars: Optional['Dict[str,str]'] = None - ssh_public_keys: Optional['List[str]'] = None + """The ID of the cluster policy used to create the cluster if applicable.""" + + spark_conf: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified Spark configuration key-value pairs. See + :method:clusters/create for more details.""" + + spark_env_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) + while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them + to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default + databricks managed environmental variables are included as well. + + Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": + "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS + -Dspark.shuffle.service.enabled=true"}`""" + + ssh_public_keys: Optional[List[str]] = None + """SSH public key contents that will be added to each Spark node in this cluster. The corresponding + private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can + be specified.""" def as_dict(self) -> dict: + """Serializes the PipelineCluster into a dictionary suitable for use as a JSON request body.""" body = {} if self.apply_policy_default_values is not None: body['apply_policy_default_values'] = self.apply_policy_default_values @@ -595,7 +906,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineCluster': + def from_dict(cls, d: Dict[str, any]) -> PipelineCluster: + """Deserializes the PipelineCluster from a dictionary.""" return cls(apply_policy_default_values=d.get('apply_policy_default_values', None), autoscale=_from_dict(d, 'autoscale', compute.AutoScale), aws_attributes=_from_dict(d, 'aws_attributes', compute.AwsAttributes), @@ -617,17 +929,35 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelineCluster': @dataclass class PipelineEvent: - error: Optional['ErrorDetail'] = None + error: Optional[ErrorDetail] = None + """Information about an error captured by the event.""" + event_type: Optional[str] = None + """The event type. Should always correspond to the details""" + id: Optional[str] = None - level: Optional['EventLevel'] = None - maturity_level: Optional['MaturityLevel'] = None + """A time-based, globally unique id.""" + + level: Optional[EventLevel] = None + """The severity level of the event.""" + + maturity_level: Optional[MaturityLevel] = None + """Maturity level for event_type.""" + message: Optional[str] = None - origin: Optional['Origin'] = None - sequence: Optional['Sequencing'] = None + """The display message associated with the event.""" + + origin: Optional[Origin] = None + """Describes where the event originates from.""" + + sequence: Optional[Sequencing] = None + """A sequencing object to identify and order events.""" + timestamp: Optional[str] = None + """The time of the event.""" def as_dict(self) -> dict: + """Serializes the PipelineEvent into a dictionary suitable for use as a JSON request body.""" body = {} if self.error: body['error'] = self.error.as_dict() if self.event_type is not None: body['event_type'] = self.event_type @@ -641,7 +971,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineEvent': + def from_dict(cls, d: Dict[str, any]) -> PipelineEvent: + """Deserializes the PipelineEvent from a dictionary.""" return cls(error=_from_dict(d, 'error', ErrorDetail), event_type=d.get('event_type', None), id=d.get('id', None), @@ -655,12 +986,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelineEvent': @dataclass class PipelineLibrary: - file: Optional['FileLibrary'] = None + file: Optional[FileLibrary] = None + """The path to a file that defines a pipeline and is stored in the Databricks Repos.""" + jar: Optional[str] = None - maven: Optional['compute.MavenLibrary'] = None - notebook: Optional['NotebookLibrary'] = None + """URI of the jar to be installed. Currently only DBFS is supported.""" + + maven: Optional[compute.MavenLibrary] = None + """Specification of a maven library to be installed.""" + + notebook: Optional[NotebookLibrary] = None + """The path to a notebook that defines a pipeline and is stored in the workspace.""" def as_dict(self) -> dict: + """Serializes the PipelineLibrary into a dictionary suitable for use as a JSON request body.""" body = {} if self.file: body['file'] = self.file.as_dict() if self.jar is not None: body['jar'] = self.jar @@ -669,7 +1008,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineLibrary': + def from_dict(cls, d: Dict[str, any]) -> PipelineLibrary: + """Deserializes the PipelineLibrary from a dictionary.""" return cls(file=_from_dict(d, 'file', FileLibrary), jar=d.get('jar', None), maven=_from_dict(d, 'maven', compute.MavenLibrary), @@ -679,10 +1019,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelineLibrary': @dataclass class PipelinePermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['PipelinePermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[PipelinePermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the PipelinePermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -690,7 +1034,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelinePermission': + def from_dict(cls, d: Dict[str, any]) -> PipelinePermission: + """Deserializes the PipelinePermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', PipelinePermissionLevel)) @@ -707,11 +1052,14 @@ class PipelinePermissionLevel(Enum): @dataclass class PipelinePermissions: - access_control_list: Optional['List[PipelineAccessControlResponse]'] = None + access_control_list: Optional[List[PipelineAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the PipelinePermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -720,7 +1068,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelinePermissions': + def from_dict(cls, d: Dict[str, any]) -> PipelinePermissions: + """Deserializes the PipelinePermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', PipelineAccessControlResponse), object_id=d.get('object_id', None), @@ -730,26 +1079,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelinePermissions': @dataclass class PipelinePermissionsDescription: description: Optional[str] = None - permission_level: Optional['PipelinePermissionLevel'] = None + + permission_level: Optional[PipelinePermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the PipelinePermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelinePermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> PipelinePermissionsDescription: + """Deserializes the PipelinePermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', PipelinePermissionLevel)) @dataclass class PipelinePermissionsRequest: - access_control_list: Optional['List[PipelineAccessControlRequest]'] = None + access_control_list: Optional[List[PipelineAccessControlRequest]] = None + pipeline_id: Optional[str] = None + """The pipeline for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the PipelinePermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -757,7 +1113,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelinePermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> PipelinePermissionsRequest: + """Deserializes the PipelinePermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', PipelineAccessControlRequest), pipeline_id=d.get('pipeline_id', None)) @@ -765,24 +1122,63 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelinePermissionsRequest': @dataclass class PipelineSpec: catalog: Optional[str] = None + """A catalog in Unity Catalog to publish data from this pipeline to. If `target` is specified, + tables in this pipeline are published to a `target` schema inside `catalog` (for example, + `catalog`.`target`.`table`). If `target` is not specified, no data is published to Unity + Catalog.""" + channel: Optional[str] = None - clusters: Optional['List[PipelineCluster]'] = None - configuration: Optional['Dict[str,str]'] = None + """DLT Release Channel that specifies which version to use.""" + + clusters: Optional[List[PipelineCluster]] = None + """Cluster settings for this pipeline deployment.""" + + configuration: Optional[Dict[str, str]] = None + """String-String configuration for this pipeline execution.""" + continuous: Optional[bool] = None + """Whether the pipeline is continuous or triggered. This replaces `trigger`.""" + development: Optional[bool] = None + """Whether the pipeline is in Development mode. Defaults to false.""" + edition: Optional[str] = None - filters: Optional['Filters'] = None + """Pipeline product edition.""" + + filters: Optional[Filters] = None + """Filters on which Pipeline packages to include in the deployed graph.""" + id: Optional[str] = None - libraries: Optional['List[PipelineLibrary]'] = None + """Unique identifier for this pipeline.""" + + libraries: Optional[List[PipelineLibrary]] = None + """Libraries or code needed by this deployment.""" + name: Optional[str] = None - notifications: Optional['List[Notifications]'] = None + """Friendly identifier for this pipeline.""" + + notifications: Optional[List[Notifications]] = None + """List of notification settings for this pipeline.""" + photon: Optional[bool] = None + """Whether Photon is enabled for this pipeline.""" + serverless: Optional[bool] = None + """Whether serverless compute is enabled for this pipeline.""" + storage: Optional[str] = None + """DBFS root directory for storing checkpoints and tables.""" + target: Optional[str] = None - trigger: Optional['PipelineTrigger'] = None + """Target schema (database) to add tables in this pipeline to. If not specified, no data is + published to the Hive metastore or Unity Catalog. To publish to Unity Catalog, also specify + `catalog`.""" + + trigger: Optional[PipelineTrigger] = None + """Which pipeline trigger to use. Deprecated: Use `continuous` instead.""" def as_dict(self) -> dict: + """Serializes the PipelineSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog is not None: body['catalog'] = self.catalog if self.channel is not None: body['channel'] = self.channel @@ -804,7 +1200,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineSpec': + def from_dict(cls, d: Dict[str, any]) -> PipelineSpec: + """Deserializes the PipelineSpec from a dictionary.""" return cls(catalog=d.get('catalog', None), channel=d.get('channel', None), clusters=_repeated_dict(d, 'clusters', PipelineCluster), @@ -841,14 +1238,29 @@ class PipelineState(Enum): @dataclass class PipelineStateInfo: cluster_id: Optional[str] = None + """The unique identifier of the cluster running the pipeline.""" + creator_user_name: Optional[str] = None - latest_updates: Optional['List[UpdateStateInfo]'] = None + """The username of the pipeline creator.""" + + latest_updates: Optional[List[UpdateStateInfo]] = None + """Status of the latest updates for the pipeline. Ordered with the newest update first.""" + name: Optional[str] = None + """The user-friendly name of the pipeline.""" + pipeline_id: Optional[str] = None + """The unique identifier of the pipeline.""" + run_as_user_name: Optional[str] = None - state: Optional['PipelineState'] = None + """The username that the pipeline runs as. This is a read only value derived from the pipeline + owner.""" + + state: Optional[PipelineState] = None + """The pipeline state.""" def as_dict(self) -> dict: + """Serializes the PipelineStateInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.cluster_id is not None: body['cluster_id'] = self.cluster_id if self.creator_user_name is not None: body['creator_user_name'] = self.creator_user_name @@ -860,7 +1272,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineStateInfo': + def from_dict(cls, d: Dict[str, any]) -> PipelineStateInfo: + """Deserializes the PipelineStateInfo from a dictionary.""" return cls(cluster_id=d.get('cluster_id', None), creator_user_name=d.get('creator_user_name', None), latest_updates=_repeated_dict(d, 'latest_updates', UpdateStateInfo), @@ -872,33 +1285,41 @@ def from_dict(cls, d: Dict[str, any]) -> 'PipelineStateInfo': @dataclass class PipelineTrigger: - cron: Optional['CronTrigger'] = None + cron: Optional[CronTrigger] = None + manual: Optional[Any] = None def as_dict(self) -> dict: + """Serializes the PipelineTrigger into a dictionary suitable for use as a JSON request body.""" body = {} if self.cron: body['cron'] = self.cron.as_dict() if self.manual: body['manual'] = self.manual return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PipelineTrigger': + def from_dict(cls, d: Dict[str, any]) -> PipelineTrigger: + """Deserializes the PipelineTrigger from a dictionary.""" return cls(cron=_from_dict(d, 'cron', CronTrigger), manual=d.get('manual', None)) @dataclass class Sequencing: control_plane_seq_no: Optional[int] = None - data_plane_id: Optional['DataPlaneId'] = None + """A sequence number, unique and increasing within the control plane.""" + + data_plane_id: Optional[DataPlaneId] = None + """the ID assigned by the data plane.""" def as_dict(self) -> dict: + """Serializes the Sequencing into a dictionary suitable for use as a JSON request body.""" body = {} if self.control_plane_seq_no is not None: body['control_plane_seq_no'] = self.control_plane_seq_no if self.data_plane_id: body['data_plane_id'] = self.data_plane_id.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Sequencing': + def from_dict(cls, d: Dict[str, any]) -> Sequencing: + """Deserializes the Sequencing from a dictionary.""" return cls(control_plane_seq_no=d.get('control_plane_seq_no', None), data_plane_id=_from_dict(d, 'data_plane_id', DataPlaneId)) @@ -906,10 +1327,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'Sequencing': @dataclass class SerializedException: class_name: Optional[str] = None + """Runtime class of the exception""" + message: Optional[str] = None - stack: Optional['List[StackFrame]'] = None + """Exception message""" + + stack: Optional[List[StackFrame]] = None + """Stack trace consisting of a list of stack frames""" def as_dict(self) -> dict: + """Serializes the SerializedException into a dictionary suitable for use as a JSON request body.""" body = {} if self.class_name is not None: body['class_name'] = self.class_name if self.message is not None: body['message'] = self.message @@ -917,7 +1344,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SerializedException': + def from_dict(cls, d: Dict[str, any]) -> SerializedException: + """Deserializes the SerializedException from a dictionary.""" return cls(class_name=d.get('class_name', None), message=d.get('message', None), stack=_repeated_dict(d, 'stack', StackFrame)) @@ -926,11 +1354,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'SerializedException': @dataclass class StackFrame: declaring_class: Optional[str] = None + """Class from which the method call originated""" + file_name: Optional[str] = None + """File where the method is defined""" + line_number: Optional[int] = None + """Line from which the method was called""" + method_name: Optional[str] = None + """Name of the method which was called""" def as_dict(self) -> dict: + """Serializes the StackFrame into a dictionary suitable for use as a JSON request body.""" body = {} if self.declaring_class is not None: body['declaring_class'] = self.declaring_class if self.file_name is not None: body['file_name'] = self.file_name @@ -939,7 +1375,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StackFrame': + def from_dict(cls, d: Dict[str, any]) -> StackFrame: + """Deserializes the StackFrame from a dictionary.""" return cls(declaring_class=d.get('declaring_class', None), file_name=d.get('file_name', None), line_number=d.get('line_number', None), @@ -948,13 +1385,25 @@ def from_dict(cls, d: Dict[str, any]) -> 'StackFrame': @dataclass class StartUpdate: - cause: Optional['StartUpdateCause'] = None + cause: Optional[StartUpdateCause] = None + full_refresh: Optional[bool] = None - full_refresh_selection: Optional['List[str]'] = None + """If true, this update will reset all tables before running.""" + + full_refresh_selection: Optional[List[str]] = None + """A list of tables to update with fullRefresh. If both refresh_selection and + full_refresh_selection are empty, this is a full graph update. Full Refresh on a table means + that the states of the table will be reset before the refresh.""" + pipeline_id: Optional[str] = None - refresh_selection: Optional['List[str]'] = None + + refresh_selection: Optional[List[str]] = None + """A list of tables to update without fullRefresh. If both refresh_selection and + full_refresh_selection are empty, this is a full graph update. Full Refresh on a table means + that the states of the table will be reset before the refresh.""" def as_dict(self) -> dict: + """Serializes the StartUpdate into a dictionary suitable for use as a JSON request body.""" body = {} if self.cause is not None: body['cause'] = self.cause.value if self.full_refresh is not None: body['full_refresh'] = self.full_refresh @@ -965,7 +1414,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StartUpdate': + def from_dict(cls, d: Dict[str, any]) -> StartUpdate: + """Deserializes the StartUpdate from a dictionary.""" return cls(cause=_enum(d, 'cause', StartUpdateCause), full_refresh=d.get('full_refresh', None), full_refresh_selection=d.get('full_refresh_selection', None), @@ -988,29 +1438,56 @@ class StartUpdateResponse: update_id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the StartUpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.update_id is not None: body['update_id'] = self.update_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StartUpdateResponse': + def from_dict(cls, d: Dict[str, any]) -> StartUpdateResponse: + """Deserializes the StartUpdateResponse from a dictionary.""" return cls(update_id=d.get('update_id', None)) @dataclass class UpdateInfo: - cause: Optional['UpdateInfoCause'] = None + cause: Optional[UpdateInfoCause] = None + """What triggered this update.""" + cluster_id: Optional[str] = None - config: Optional['PipelineSpec'] = None + """The ID of the cluster that the update is running on.""" + + config: Optional[PipelineSpec] = None + """The pipeline configuration with system defaults applied where unspecified by the user. Not + returned by ListUpdates.""" + creation_time: Optional[int] = None + """The time when this update was created.""" + full_refresh: Optional[bool] = None - full_refresh_selection: Optional['List[str]'] = None + """If true, this update will reset all tables before running.""" + + full_refresh_selection: Optional[List[str]] = None + """A list of tables to update with fullRefresh. If both refresh_selection and + full_refresh_selection are empty, this is a full graph update. Full Refresh on a table means + that the states of the table will be reset before the refresh.""" + pipeline_id: Optional[str] = None - refresh_selection: Optional['List[str]'] = None - state: Optional['UpdateInfoState'] = None + """The ID of the pipeline.""" + + refresh_selection: Optional[List[str]] = None + """A list of tables to update without fullRefresh. If both refresh_selection and + full_refresh_selection are empty, this is a full graph update. Full Refresh on a table means + that the states of the table will be reset before the refresh.""" + + state: Optional[UpdateInfoState] = None + """The update state.""" + update_id: Optional[str] = None + """The ID of this update.""" def as_dict(self) -> dict: + """Serializes the UpdateInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.cause is not None: body['cause'] = self.cause.value if self.cluster_id is not None: body['cluster_id'] = self.cluster_id @@ -1026,7 +1503,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateInfo': + def from_dict(cls, d: Dict[str, any]) -> UpdateInfo: + """Deserializes the UpdateInfo from a dictionary.""" return cls(cause=_enum(d, 'cause', UpdateInfoCause), cluster_id=d.get('cluster_id', None), config=_from_dict(d, 'config', PipelineSpec), @@ -1069,10 +1547,13 @@ class UpdateInfoState(Enum): @dataclass class UpdateStateInfo: creation_time: Optional[str] = None - state: Optional['UpdateStateInfoState'] = None + + state: Optional[UpdateStateInfoState] = None + update_id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the UpdateStateInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_time is not None: body['creation_time'] = self.creation_time if self.state is not None: body['state'] = self.state.value @@ -1080,7 +1561,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateStateInfo': + def from_dict(cls, d: Dict[str, any]) -> UpdateStateInfo: + """Deserializes the UpdateStateInfo from a dictionary.""" return cls(creation_time=d.get('creation_time', None), state=_enum(d, 'state', UpdateStateInfoState), update_id=d.get('update_id', None)) @@ -1351,7 +1833,7 @@ def list_pipeline_events(self, filter: Optional[str] = None, max_results: Optional[int] = None, order_by: Optional[List[str]] = None, - page_token: Optional[str] = None) -> Iterator['PipelineEvent']: + page_token: Optional[str] = None) -> Iterator[PipelineEvent]: """List pipeline events. Retrieves events for a pipeline. @@ -1404,7 +1886,7 @@ def list_pipelines(self, filter: Optional[str] = None, max_results: Optional[int] = None, order_by: Optional[List[str]] = None, - page_token: Optional[str] = None) -> Iterator['PipelineStateInfo']: + page_token: Optional[str] = None) -> Iterator[PipelineStateInfo]: """List pipelines. Lists pipelines defined in the Delta Live Tables system. diff --git a/databricks/sdk/service/provisioning.py b/databricks/sdk/service/provisioning.py index a122f2a36..11e8102e2 100755 --- a/databricks/sdk/service/provisioning.py +++ b/databricks/sdk/service/provisioning.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging import random import time @@ -18,26 +20,38 @@ @dataclass class AwsCredentials: - sts_role: Optional['StsRole'] = None + sts_role: Optional[StsRole] = None def as_dict(self) -> dict: + """Serializes the AwsCredentials into a dictionary suitable for use as a JSON request body.""" body = {} if self.sts_role: body['sts_role'] = self.sts_role.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AwsCredentials': + def from_dict(cls, d: Dict[str, any]) -> AwsCredentials: + """Deserializes the AwsCredentials from a dictionary.""" return cls(sts_role=_from_dict(d, 'sts_role', StsRole)) @dataclass class AwsKeyInfo: key_arn: str + """The AWS KMS key's Amazon Resource Name (ARN).""" + key_region: str + """The AWS KMS key region.""" + key_alias: Optional[str] = None + """The AWS KMS key alias.""" + reuse_key_for_cluster_volumes: Optional[bool] = None + """This field applies only if the `use_cases` property includes `STORAGE`. If this is set to `true` + or omitted, the key is also used to encrypt cluster EBS volumes. If you do not want to use this + key for encrypting EBS volumes, set to `false`.""" def as_dict(self) -> dict: + """Serializes the AwsKeyInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.key_alias is not None: body['key_alias'] = self.key_alias if self.key_arn is not None: body['key_arn'] = self.key_arn @@ -47,7 +61,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AwsKeyInfo': + def from_dict(cls, d: Dict[str, any]) -> AwsKeyInfo: + """Deserializes the AwsKeyInfo from a dictionary.""" return cls(key_alias=d.get('key_alias', None), key_arn=d.get('key_arn', None), key_region=d.get('key_region', None), @@ -58,25 +73,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'AwsKeyInfo': class CloudResourceContainer: """The general workspace configurations that are specific to cloud providers.""" - gcp: Optional['CustomerFacingGcpCloudResourceContainer'] = None + gcp: Optional[CustomerFacingGcpCloudResourceContainer] = None + """The general workspace configurations that are specific to Google Cloud.""" def as_dict(self) -> dict: + """Serializes the CloudResourceContainer into a dictionary suitable for use as a JSON request body.""" body = {} if self.gcp: body['gcp'] = self.gcp.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CloudResourceContainer': + def from_dict(cls, d: Dict[str, any]) -> CloudResourceContainer: + """Deserializes the CloudResourceContainer from a dictionary.""" return cls(gcp=_from_dict(d, 'gcp', CustomerFacingGcpCloudResourceContainer)) @dataclass class CreateAwsKeyInfo: key_arn: str + """The AWS KMS key's Amazon Resource Name (ARN). Note that the key's AWS region is inferred from + the ARN.""" + key_alias: Optional[str] = None + """The AWS KMS key alias.""" + reuse_key_for_cluster_volumes: Optional[bool] = None + """This field applies only if the `use_cases` property includes `STORAGE`. If this is set to `true` + or omitted, the key is also used to encrypt cluster EBS volumes. To not use this key also for + encrypting EBS volumes, set this to `false`.""" def as_dict(self) -> dict: + """Serializes the CreateAwsKeyInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.key_alias is not None: body['key_alias'] = self.key_alias if self.key_arn is not None: body['key_arn'] = self.key_arn @@ -85,7 +112,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateAwsKeyInfo': + def from_dict(cls, d: Dict[str, any]) -> CreateAwsKeyInfo: + """Deserializes the CreateAwsKeyInfo from a dictionary.""" return cls(key_alias=d.get('key_alias', None), key_arn=d.get('key_arn', None), reuse_key_for_cluster_volumes=d.get('reuse_key_for_cluster_volumes', None)) @@ -93,31 +121,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateAwsKeyInfo': @dataclass class CreateCredentialAwsCredentials: - sts_role: Optional['CreateCredentialStsRole'] = None + sts_role: Optional[CreateCredentialStsRole] = None def as_dict(self) -> dict: + """Serializes the CreateCredentialAwsCredentials into a dictionary suitable for use as a JSON request body.""" body = {} if self.sts_role: body['sts_role'] = self.sts_role.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentialAwsCredentials': + def from_dict(cls, d: Dict[str, any]) -> CreateCredentialAwsCredentials: + """Deserializes the CreateCredentialAwsCredentials from a dictionary.""" return cls(sts_role=_from_dict(d, 'sts_role', CreateCredentialStsRole)) @dataclass class CreateCredentialRequest: credentials_name: str - aws_credentials: 'CreateCredentialAwsCredentials' + """The human-readable name of the credential configuration object.""" + + aws_credentials: CreateCredentialAwsCredentials def as_dict(self) -> dict: + """Serializes the CreateCredentialRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_credentials: body['aws_credentials'] = self.aws_credentials.as_dict() if self.credentials_name is not None: body['credentials_name'] = self.credentials_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentialRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateCredentialRequest: + """Deserializes the CreateCredentialRequest from a dictionary.""" return cls(aws_credentials=_from_dict(d, 'aws_credentials', CreateCredentialAwsCredentials), credentials_name=d.get('credentials_name', None)) @@ -125,24 +159,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentialRequest': @dataclass class CreateCredentialStsRole: role_arn: Optional[str] = None + """The Amazon Resource Name (ARN) of the cross account role.""" def as_dict(self) -> dict: + """Serializes the CreateCredentialStsRole into a dictionary suitable for use as a JSON request body.""" body = {} if self.role_arn is not None: body['role_arn'] = self.role_arn return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentialStsRole': + def from_dict(cls, d: Dict[str, any]) -> CreateCredentialStsRole: + """Deserializes the CreateCredentialStsRole from a dictionary.""" return cls(role_arn=d.get('role_arn', None)) @dataclass class CreateCustomerManagedKeyRequest: - use_cases: 'List[KeyUseCase]' - aws_key_info: Optional['CreateAwsKeyInfo'] = None - gcp_key_info: Optional['CreateGcpKeyInfo'] = None + use_cases: List[KeyUseCase] + """The cases that the key can be used for.""" + + aws_key_info: Optional[CreateAwsKeyInfo] = None + + gcp_key_info: Optional[CreateGcpKeyInfo] = None def as_dict(self) -> dict: + """Serializes the CreateCustomerManagedKeyRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_key_info: body['aws_key_info'] = self.aws_key_info.as_dict() if self.gcp_key_info: body['gcp_key_info'] = self.gcp_key_info.as_dict() @@ -150,7 +191,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCustomerManagedKeyRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateCustomerManagedKeyRequest: + """Deserializes the CreateCustomerManagedKeyRequest from a dictionary.""" return cls(aws_key_info=_from_dict(d, 'aws_key_info', CreateAwsKeyInfo), gcp_key_info=_from_dict(d, 'gcp_key_info', CreateGcpKeyInfo), use_cases=_repeated_enum(d, 'use_cases', KeyUseCase)) @@ -159,27 +201,49 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCustomerManagedKeyRequest': @dataclass class CreateGcpKeyInfo: kms_key_id: str + """The GCP KMS key's resource name""" def as_dict(self) -> dict: + """Serializes the CreateGcpKeyInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.kms_key_id is not None: body['kms_key_id'] = self.kms_key_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateGcpKeyInfo': + def from_dict(cls, d: Dict[str, any]) -> CreateGcpKeyInfo: + """Deserializes the CreateGcpKeyInfo from a dictionary.""" return cls(kms_key_id=d.get('kms_key_id', None)) @dataclass class CreateNetworkRequest: network_name: str - gcp_network_info: Optional['GcpNetworkInfo'] = None - security_group_ids: Optional['List[str]'] = None - subnet_ids: Optional['List[str]'] = None - vpc_endpoints: Optional['NetworkVpcEndpoints'] = None + """The human-readable name of the network configuration.""" + + gcp_network_info: Optional[GcpNetworkInfo] = None + """The Google Cloud specific information for this network (for example, the VPC ID, subnet ID, and + secondary IP ranges).""" + + security_group_ids: Optional[List[str]] = None + """IDs of one to five security groups associated with this network. Security group IDs **cannot** + be used in multiple network configurations.""" + + subnet_ids: Optional[List[str]] = None + """IDs of at least two subnets associated with this network. Subnet IDs **cannot** be used in + multiple network configurations.""" + + vpc_endpoints: Optional[NetworkVpcEndpoints] = None + """If specified, contains the VPC endpoints used to allow cluster communication from this VPC over + [AWS PrivateLink]. + + [AWS PrivateLink]: https://aws.amazon.com/privatelink/""" + vpc_id: Optional[str] = None + """The ID of the VPC associated with this network. VPC IDs can be used in multiple network + configurations.""" def as_dict(self) -> dict: + """Serializes the CreateNetworkRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.gcp_network_info: body['gcp_network_info'] = self.gcp_network_info.as_dict() if self.network_name is not None: body['network_name'] = self.network_name @@ -190,7 +254,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateNetworkRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateNetworkRequest: + """Deserializes the CreateNetworkRequest from a dictionary.""" return cls(gcp_network_info=_from_dict(d, 'gcp_network_info', GcpNetworkInfo), network_name=d.get('network_name', None), security_group_ids=d.get('security_group_ids', None), @@ -202,9 +267,13 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateNetworkRequest': @dataclass class CreateStorageConfigurationRequest: storage_configuration_name: str - root_bucket_info: 'RootBucketInfo' + """The human-readable name of the storage configuration.""" + + root_bucket_info: RootBucketInfo + """Root S3 bucket information.""" def as_dict(self) -> dict: + """Serializes the CreateStorageConfigurationRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.root_bucket_info: body['root_bucket_info'] = self.root_bucket_info.as_dict() if self.storage_configuration_name is not None: @@ -212,7 +281,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateStorageConfigurationRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateStorageConfigurationRequest: + """Deserializes the CreateStorageConfigurationRequest from a dictionary.""" return cls(root_bucket_info=_from_dict(d, 'root_bucket_info', RootBucketInfo), storage_configuration_name=d.get('storage_configuration_name', None)) @@ -220,11 +290,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateStorageConfigurationRequest': @dataclass class CreateVpcEndpointRequest: vpc_endpoint_name: str + """The human-readable name of the storage configuration.""" + aws_vpc_endpoint_id: Optional[str] = None - gcp_vpc_endpoint_info: Optional['GcpVpcEndpointInfo'] = None + """The ID of the VPC endpoint object in AWS.""" + + gcp_vpc_endpoint_info: Optional[GcpVpcEndpointInfo] = None + """The Google Cloud specific information for this Private Service Connect endpoint.""" + region: Optional[str] = None + """The AWS region in which this VPC endpoint object exists.""" def as_dict(self) -> dict: + """Serializes the CreateVpcEndpointRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_vpc_endpoint_id is not None: body['aws_vpc_endpoint_id'] = self.aws_vpc_endpoint_id if self.gcp_vpc_endpoint_info: body['gcp_vpc_endpoint_info'] = self.gcp_vpc_endpoint_info.as_dict() @@ -233,7 +311,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateVpcEndpointRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateVpcEndpointRequest: + """Deserializes the CreateVpcEndpointRequest from a dictionary.""" return cls(aws_vpc_endpoint_id=d.get('aws_vpc_endpoint_id', None), gcp_vpc_endpoint_info=_from_dict(d, 'gcp_vpc_endpoint_info', GcpVpcEndpointInfo), region=d.get('region', None), @@ -243,23 +322,114 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateVpcEndpointRequest': @dataclass class CreateWorkspaceRequest: workspace_name: str + """The workspace's human-readable name.""" + aws_region: Optional[str] = None + """The AWS region of the workspace's data plane.""" + cloud: Optional[str] = None - cloud_resource_container: Optional['CloudResourceContainer'] = None + """The cloud provider which the workspace uses. For Google Cloud workspaces, always set this field + to `gcp`.""" + + cloud_resource_container: Optional[CloudResourceContainer] = None + """The general workspace configurations that are specific to cloud providers.""" + credentials_id: Optional[str] = None - custom_tags: Optional['Dict[str,str]'] = None + """ID of the workspace's credential configuration object.""" + + custom_tags: Optional[Dict[str, str]] = None + """The custom tags key-value pairing that is attached to this workspace. The key-value pair is a + string of utf-8 characters. The value can be an empty string, with maximum length of 255 + characters. The key can be of maximum length of 127 characters, and cannot be empty.""" + deployment_name: Optional[str] = None - gcp_managed_network_config: Optional['GcpManagedNetworkConfig'] = None - gke_config: Optional['GkeConfig'] = None + """The deployment name defines part of the subdomain for the workspace. The workspace URL for web + application and REST APIs is `.cloud.databricks.com`. For example, if + the deployment name is `abcsales`, your workspace URL will be + `https://abcsales.cloud.databricks.com`. Hyphens are allowed. This property supports only the + set of characters that are allowed in a subdomain. + + If your account has a non-empty deployment name prefix at workspace creation time, the workspace + deployment name changes so that the beginning has the account prefix and a hyphen. For example, + if your account's deployment prefix is `acme` and the workspace deployment name is + `workspace-1`, the `deployment_name` field becomes `acme-workspace-1` and that is the value that + is returned in JSON responses for the `deployment_name` field. The workspace URL is + `acme-workspace-1.cloud.databricks.com`. + + If your account has a non-empty deployment name prefix and you set `deployment_name` to the + reserved keyword `EMPTY`, `deployment_name` is just the account prefix only. For example, if + your account's deployment prefix is `acme` and the workspace deployment name is `EMPTY`, + `deployment_name` becomes `acme` only and the workspace URL is `acme.cloud.databricks.com`. + + Contact your Databricks representatives to add an account deployment name prefix to your + account. If you do not have a deployment name prefix, the special deployment name value `EMPTY` + is invalid. + + This value must be unique across all non-deleted deployments across all AWS regions. + + If a new workspace omits this property, the server generates a unique deployment name for you + with the pattern `dbc-xxxxxxxx-xxxx`.""" + + gcp_managed_network_config: Optional[GcpManagedNetworkConfig] = None + """The network settings for the workspace. The configurations are only for Databricks-managed VPCs. + It is ignored if you specify a customer-managed VPC in the `network_id` field.", All the IP + range configurations must be mutually exclusive. An attempt to create a workspace fails if + Databricks detects an IP range overlap. + + Specify custom IP ranges in CIDR format. The IP ranges for these fields must not overlap, and + all IP addresses must be entirely within the following ranges: `10.0.0.0/8`, `100.64.0.0/10`, + `172.16.0.0/12`, `192.168.0.0/16`, and `240.0.0.0/4`. + + The sizes of these IP ranges affect the maximum number of nodes for the workspace. + + **Important**: Confirm the IP ranges used by your Databricks workspace before creating the + workspace. You cannot change them after your workspace is deployed. If the IP address ranges for + your Databricks are too small, IP exhaustion can occur, causing your Databricks jobs to fail. To + determine the address range sizes that you need, Databricks provides a calculator as a Microsoft + Excel spreadsheet. See [calculate subnet sizes for a new workspace]. + + [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html""" + + gke_config: Optional[GkeConfig] = None + """The configurations for the GKE cluster of a Databricks workspace.""" + location: Optional[str] = None + """The Google Cloud region of the workspace data plane in your Google account. For example, + `us-east4`.""" + managed_services_customer_managed_key_id: Optional[str] = None + """The ID of the workspace's managed services encryption key configuration object. This is used to + help protect and control access to the workspace's notebooks, secrets, Databricks SQL queries, + and query history. The provided key configuration object property `use_cases` must contain + `MANAGED_SERVICES`.""" + network_id: Optional[str] = None - pricing_tier: Optional['PricingTier'] = None + + pricing_tier: Optional[PricingTier] = None + """The pricing tier of the workspace. For pricing tier information, see [AWS Pricing]. + + [AWS Pricing]: https://databricks.com/product/aws-pricing""" + private_access_settings_id: Optional[str] = None + """ID of the workspace's private access settings object. Only used for PrivateLink. This ID must be + specified for customers using [AWS PrivateLink] for either front-end (user-to-workspace + connection), back-end (data plane to control plane connection), or both connection types. + + Before configuring PrivateLink, read the [Databricks article about PrivateLink]. + + [AWS PrivateLink]: https://aws.amazon.com/privatelink/ + [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html""" + storage_configuration_id: Optional[str] = None + """The ID of the workspace's storage configuration object.""" + storage_customer_managed_key_id: Optional[str] = None + """The ID of the workspace's storage encryption key configuration object. This is used to encrypt + the workspace's root S3 bucket (root DBFS and system data) and, optionally, cluster EBS volumes. + The provided key configuration object property `use_cases` must contain `STORAGE`.""" def as_dict(self) -> dict: + """Serializes the CreateWorkspaceRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_region is not None: body['aws_region'] = self.aws_region if self.cloud is not None: body['cloud'] = self.cloud @@ -286,7 +456,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateWorkspaceRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateWorkspaceRequest: + """Deserializes the CreateWorkspaceRequest from a dictionary.""" return cls(aws_region=d.get('aws_region', None), cloud=d.get('cloud', None), cloud_resource_container=_from_dict(d, 'cloud_resource_container', CloudResourceContainer), @@ -310,12 +481,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateWorkspaceRequest': @dataclass class Credential: account_id: Optional[str] = None - aws_credentials: Optional['AwsCredentials'] = None + """The Databricks account ID that hosts the credential.""" + + aws_credentials: Optional[AwsCredentials] = None + creation_time: Optional[int] = None + """Time in epoch milliseconds when the credential was created.""" + credentials_id: Optional[str] = None + """Databricks credential configuration ID.""" + credentials_name: Optional[str] = None + """The human-readable name of the credential configuration object.""" def as_dict(self) -> dict: + """Serializes the Credential into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.aws_credentials: body['aws_credentials'] = self.aws_credentials.as_dict() @@ -325,7 +505,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Credential': + def from_dict(cls, d: Dict[str, any]) -> Credential: + """Deserializes the Credential from a dictionary.""" return cls(account_id=d.get('account_id', None), aws_credentials=_from_dict(d, 'aws_credentials', AwsCredentials), creation_time=d.get('creation_time', None), @@ -341,27 +522,41 @@ class CustomerFacingGcpCloudResourceContainer: """The general workspace configurations that are specific to Google Cloud.""" project_id: Optional[str] = None + """The Google Cloud project ID, which the workspace uses to instantiate cloud resources for your + workspace.""" def as_dict(self) -> dict: + """Serializes the CustomerFacingGcpCloudResourceContainer into a dictionary suitable for use as a JSON request body.""" body = {} if self.project_id is not None: body['project_id'] = self.project_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CustomerFacingGcpCloudResourceContainer': + def from_dict(cls, d: Dict[str, any]) -> CustomerFacingGcpCloudResourceContainer: + """Deserializes the CustomerFacingGcpCloudResourceContainer from a dictionary.""" return cls(project_id=d.get('project_id', None)) @dataclass class CustomerManagedKey: account_id: Optional[str] = None - aws_key_info: Optional['AwsKeyInfo'] = None + """The Databricks account ID that holds the customer-managed key.""" + + aws_key_info: Optional[AwsKeyInfo] = None + creation_time: Optional[int] = None + """Time in epoch milliseconds when the customer key was created.""" + customer_managed_key_id: Optional[str] = None - gcp_key_info: Optional['GcpKeyInfo'] = None - use_cases: Optional['List[KeyUseCase]'] = None + """ID of the encryption key configuration object.""" + + gcp_key_info: Optional[GcpKeyInfo] = None + + use_cases: Optional[List[KeyUseCase]] = None + """The cases that the key can be used for.""" def as_dict(self) -> dict: + """Serializes the CustomerManagedKey into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.aws_key_info: body['aws_key_info'] = self.aws_key_info.as_dict() @@ -373,7 +568,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CustomerManagedKey': + def from_dict(cls, d: Dict[str, any]) -> CustomerManagedKey: + """Deserializes the CustomerManagedKey from a dictionary.""" return cls(account_id=d.get('account_id', None), aws_key_info=_from_dict(d, 'aws_key_info', AwsKeyInfo), creation_time=d.get('creation_time', None), @@ -406,14 +602,17 @@ class ErrorType(Enum): @dataclass class GcpKeyInfo: kms_key_id: str + """The GCP KMS key's resource name""" def as_dict(self) -> dict: + """Serializes the GcpKeyInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.kms_key_id is not None: body['kms_key_id'] = self.kms_key_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GcpKeyInfo': + def from_dict(cls, d: Dict[str, any]) -> GcpKeyInfo: + """Deserializes the GcpKeyInfo from a dictionary.""" return cls(kms_key_id=d.get('kms_key_id', None)) @@ -439,10 +638,19 @@ class GcpManagedNetworkConfig: [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html""" gke_cluster_pod_ip_range: Optional[str] = None + """The IP range from which to allocate GKE cluster pods. No bigger than `/9` and no smaller than + `/21`.""" + gke_cluster_service_ip_range: Optional[str] = None + """The IP range from which to allocate GKE cluster services. No bigger than `/16` and no smaller + than `/27`.""" + subnet_cidr: Optional[str] = None + """The IP range from which to allocate GKE cluster nodes. No bigger than `/9` and no smaller than + `/29`.""" def as_dict(self) -> dict: + """Serializes the GcpManagedNetworkConfig into a dictionary suitable for use as a JSON request body.""" body = {} if self.gke_cluster_pod_ip_range is not None: body['gke_cluster_pod_ip_range'] = self.gke_cluster_pod_ip_range @@ -452,7 +660,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GcpManagedNetworkConfig': + def from_dict(cls, d: Dict[str, any]) -> GcpManagedNetworkConfig: + """Deserializes the GcpManagedNetworkConfig from a dictionary.""" return cls(gke_cluster_pod_ip_range=d.get('gke_cluster_pod_ip_range', None), gke_cluster_service_ip_range=d.get('gke_cluster_service_ip_range', None), subnet_cidr=d.get('subnet_cidr', None)) @@ -464,13 +673,28 @@ class GcpNetworkInfo: secondary IP ranges).""" network_project_id: str + """The Google Cloud project ID of the VPC network.""" + vpc_id: str + """The ID of the VPC associated with this network. VPC IDs can be used in multiple network + configurations.""" + subnet_id: str + """The ID of the subnet associated with this network.""" + subnet_region: str + """The Google Cloud region of the workspace data plane (for example, `us-east4`).""" + pod_ip_range_name: str + """The name of the secondary IP range for pods. A Databricks-managed GKE cluster uses this IP range + for its pods. This secondary IP range can be used by only one workspace.""" + service_ip_range_name: str + """The name of the secondary IP range for services. A Databricks-managed GKE cluster uses this IP + range for its services. This secondary IP range can be used by only one workspace.""" def as_dict(self) -> dict: + """Serializes the GcpNetworkInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.network_project_id is not None: body['network_project_id'] = self.network_project_id if self.pod_ip_range_name is not None: body['pod_ip_range_name'] = self.pod_ip_range_name @@ -481,7 +705,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GcpNetworkInfo': + def from_dict(cls, d: Dict[str, any]) -> GcpNetworkInfo: + """Deserializes the GcpNetworkInfo from a dictionary.""" return cls(network_project_id=d.get('network_project_id', None), pod_ip_range_name=d.get('pod_ip_range_name', None), service_ip_range_name=d.get('service_ip_range_name', None), @@ -495,12 +720,22 @@ class GcpVpcEndpointInfo: """The Google Cloud specific information for this Private Service Connect endpoint.""" project_id: str + """The Google Cloud project ID of the VPC network where the PSC connection resides.""" + psc_endpoint_name: str + """The name of the PSC endpoint in the Google Cloud project.""" + endpoint_region: str + """Region of the PSC endpoint.""" + psc_connection_id: Optional[str] = None + """The unique ID of this PSC connection.""" + service_attachment_id: Optional[str] = None + """The service attachment this PSC connection connects to.""" def as_dict(self) -> dict: + """Serializes the GcpVpcEndpointInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.endpoint_region is not None: body['endpoint_region'] = self.endpoint_region if self.project_id is not None: body['project_id'] = self.project_id @@ -510,7 +745,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GcpVpcEndpointInfo': + def from_dict(cls, d: Dict[str, any]) -> GcpVpcEndpointInfo: + """Deserializes the GcpVpcEndpointInfo from a dictionary.""" return cls(endpoint_region=d.get('endpoint_region', None), project_id=d.get('project_id', None), psc_connection_id=d.get('psc_connection_id', None), @@ -522,17 +758,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'GcpVpcEndpointInfo': class GkeConfig: """The configurations for the GKE cluster of a Databricks workspace.""" - connectivity_type: Optional['GkeConfigConnectivityType'] = None + connectivity_type: Optional[GkeConfigConnectivityType] = None + """Specifies the network connectivity types for the GKE nodes and the GKE master network. + + Set to `PRIVATE_NODE_PUBLIC_MASTER` for a private GKE cluster for the workspace. The GKE nodes + will not have public IPs. + + Set to `PUBLIC_NODE_PUBLIC_MASTER` for a public GKE cluster. The nodes of a public GKE cluster + have public IP addresses.""" + master_ip_range: Optional[str] = None + """The IP range from which to allocate GKE cluster master resources. This field will be ignored if + GKE private cluster is not enabled. + + It must be exactly as big as `/28`.""" def as_dict(self) -> dict: + """Serializes the GkeConfig into a dictionary suitable for use as a JSON request body.""" body = {} if self.connectivity_type is not None: body['connectivity_type'] = self.connectivity_type.value if self.master_ip_range is not None: body['master_ip_range'] = self.master_ip_range return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GkeConfig': + def from_dict(cls, d: Dict[str, any]) -> GkeConfig: + """Deserializes the GkeConfig from a dictionary.""" return cls(connectivity_type=_enum(d, 'connectivity_type', GkeConfigConnectivityType), master_ip_range=d.get('master_ip_range', None)) @@ -562,20 +812,50 @@ class KeyUseCase(Enum): @dataclass class Network: account_id: Optional[str] = None + """The Databricks account ID associated with this network configuration.""" + creation_time: Optional[int] = None - error_messages: Optional['List[NetworkHealth]'] = None - gcp_network_info: Optional['GcpNetworkInfo'] = None + """Time in epoch milliseconds when the network was created.""" + + error_messages: Optional[List[NetworkHealth]] = None + """Array of error messages about the network configuration.""" + + gcp_network_info: Optional[GcpNetworkInfo] = None + """The Google Cloud specific information for this network (for example, the VPC ID, subnet ID, and + secondary IP ranges).""" + network_id: Optional[str] = None + """The Databricks network configuration ID.""" + network_name: Optional[str] = None - security_group_ids: Optional['List[str]'] = None - subnet_ids: Optional['List[str]'] = None - vpc_endpoints: Optional['NetworkVpcEndpoints'] = None + """The human-readable name of the network configuration.""" + + security_group_ids: Optional[List[str]] = None + + subnet_ids: Optional[List[str]] = None + + vpc_endpoints: Optional[NetworkVpcEndpoints] = None + """If specified, contains the VPC endpoints used to allow cluster communication from this VPC over + [AWS PrivateLink]. + + [AWS PrivateLink]: https://aws.amazon.com/privatelink/""" + vpc_id: Optional[str] = None - vpc_status: Optional['VpcStatus'] = None - warning_messages: Optional['List[NetworkWarning]'] = None + """The ID of the VPC associated with this network configuration. VPC IDs can be used in multiple + networks.""" + + vpc_status: Optional[VpcStatus] = None + """The status of this network configuration object in terms of its use in a workspace: * + `UNATTACHED`: Unattached. * `VALID`: Valid. * `BROKEN`: Broken. * `WARNED`: Warned.""" + + warning_messages: Optional[List[NetworkWarning]] = None + """Array of warning messages about the network configuration.""" + workspace_id: Optional[int] = None + """Workspace ID associated with this network configuration.""" def as_dict(self) -> dict: + """Serializes the Network into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.creation_time is not None: body['creation_time'] = self.creation_time @@ -593,7 +873,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Network': + def from_dict(cls, d: Dict[str, any]) -> Network: + """Deserializes the Network from a dictionary.""" return cls(account_id=d.get('account_id', None), creation_time=d.get('creation_time', None), error_messages=_repeated_dict(d, 'error_messages', NetworkHealth), @@ -612,16 +893,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'Network': @dataclass class NetworkHealth: error_message: Optional[str] = None - error_type: Optional['ErrorType'] = None + """Details of the error.""" + + error_type: Optional[ErrorType] = None + """The AWS resource associated with this error: credentials, VPC, subnet, security group, or + network ACL.""" def as_dict(self) -> dict: + """Serializes the NetworkHealth into a dictionary suitable for use as a JSON request body.""" body = {} if self.error_message is not None: body['error_message'] = self.error_message if self.error_type is not None: body['error_type'] = self.error_type.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NetworkHealth': + def from_dict(cls, d: Dict[str, any]) -> NetworkHealth: + """Deserializes the NetworkHealth from a dictionary.""" return cls(error_message=d.get('error_message', None), error_type=_enum(d, 'error_type', ErrorType)) @@ -632,33 +919,44 @@ class NetworkVpcEndpoints: [AWS PrivateLink]: https://aws.amazon.com/privatelink/""" - rest_api: 'List[str]' - dataplane_relay: 'List[str]' + rest_api: List[str] + """The VPC endpoint ID used by this network to access the Databricks REST API.""" + + dataplane_relay: List[str] + """The VPC endpoint ID used by this network to access the Databricks secure cluster connectivity + relay.""" def as_dict(self) -> dict: + """Serializes the NetworkVpcEndpoints into a dictionary suitable for use as a JSON request body.""" body = {} if self.dataplane_relay: body['dataplane_relay'] = [v for v in self.dataplane_relay] if self.rest_api: body['rest_api'] = [v for v in self.rest_api] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NetworkVpcEndpoints': + def from_dict(cls, d: Dict[str, any]) -> NetworkVpcEndpoints: + """Deserializes the NetworkVpcEndpoints from a dictionary.""" return cls(dataplane_relay=d.get('dataplane_relay', None), rest_api=d.get('rest_api', None)) @dataclass class NetworkWarning: warning_message: Optional[str] = None - warning_type: Optional['WarningType'] = None + """Details of the warning.""" + + warning_type: Optional[WarningType] = None + """The AWS resource associated with this warning: a subnet or a security group.""" def as_dict(self) -> dict: + """Serializes the NetworkWarning into a dictionary suitable for use as a JSON request body.""" body = {} if self.warning_message is not None: body['warning_message'] = self.warning_message if self.warning_type is not None: body['warning_type'] = self.warning_type.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NetworkWarning': + def from_dict(cls, d: Dict[str, any]) -> NetworkWarning: + """Deserializes the NetworkWarning from a dictionary.""" return cls(warning_message=d.get('warning_message', None), warning_type=_enum(d, 'warning_type', WarningType)) @@ -690,14 +988,35 @@ class PrivateAccessLevel(Enum): @dataclass class PrivateAccessSettings: account_id: Optional[str] = None - allowed_vpc_endpoint_ids: Optional['List[str]'] = None - private_access_level: Optional['PrivateAccessLevel'] = None + """The Databricks account ID that hosts the credential.""" + + allowed_vpc_endpoint_ids: Optional[List[str]] = None + """An array of Databricks VPC endpoint IDs.""" + + private_access_level: Optional[PrivateAccessLevel] = None + """The private access level controls which VPC endpoints can connect to the UI or API of any + workspace that attaches this private access settings object. * `ACCOUNT` level access (the + default) allows only VPC endpoints that are registered in your Databricks account connect to + your workspace. * `ENDPOINT` level access allows only specified VPC endpoints connect to your + workspace. For details, see `allowed_vpc_endpoint_ids`.""" + private_access_settings_id: Optional[str] = None + """Databricks private access settings ID.""" + private_access_settings_name: Optional[str] = None + """The human-readable name of the private access settings object.""" + public_access_enabled: Optional[bool] = None + """Determines if the workspace can be accessed over public internet. For fully private workspaces, + you can optionally specify `false`, but only if you implement both the front-end and the + back-end PrivateLink connections. Otherwise, specify `true`, which means that public access is + enabled.""" + region: Optional[str] = None + """The cloud region for workspaces attached to this private access settings object.""" def as_dict(self) -> dict: + """Serializes the PrivateAccessSettings into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.allowed_vpc_endpoint_ids: @@ -713,7 +1032,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PrivateAccessSettings': + def from_dict(cls, d: Dict[str, any]) -> PrivateAccessSettings: + """Deserializes the PrivateAccessSettings from a dictionary.""" return cls(account_id=d.get('account_id', None), allowed_vpc_endpoint_ids=d.get('allowed_vpc_endpoint_ids', None), private_access_level=_enum(d, 'private_access_level', PrivateAccessLevel), @@ -728,26 +1048,39 @@ class RootBucketInfo: """Root S3 bucket information.""" bucket_name: Optional[str] = None + """The name of the S3 bucket.""" def as_dict(self) -> dict: + """Serializes the RootBucketInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.bucket_name is not None: body['bucket_name'] = self.bucket_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RootBucketInfo': + def from_dict(cls, d: Dict[str, any]) -> RootBucketInfo: + """Deserializes the RootBucketInfo from a dictionary.""" return cls(bucket_name=d.get('bucket_name', None)) @dataclass class StorageConfiguration: account_id: Optional[str] = None + """The Databricks account ID that hosts the credential.""" + creation_time: Optional[int] = None - root_bucket_info: Optional['RootBucketInfo'] = None + """Time in epoch milliseconds when the storage configuration was created.""" + + root_bucket_info: Optional[RootBucketInfo] = None + """Root S3 bucket information.""" + storage_configuration_id: Optional[str] = None + """Databricks storage configuration ID.""" + storage_configuration_name: Optional[str] = None + """The human-readable name of the storage configuration.""" def as_dict(self) -> dict: + """Serializes the StorageConfiguration into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.creation_time is not None: body['creation_time'] = self.creation_time @@ -759,7 +1092,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StorageConfiguration': + def from_dict(cls, d: Dict[str, any]) -> StorageConfiguration: + """Deserializes the StorageConfiguration from a dictionary.""" return cls(account_id=d.get('account_id', None), creation_time=d.get('creation_time', None), root_bucket_info=_from_dict(d, 'root_bucket_info', RootBucketInfo), @@ -770,32 +1104,66 @@ def from_dict(cls, d: Dict[str, any]) -> 'StorageConfiguration': @dataclass class StsRole: external_id: Optional[str] = None + """The external ID that needs to be trusted by the cross-account role. This is always your + Databricks account ID.""" + role_arn: Optional[str] = None + """The Amazon Resource Name (ARN) of the cross account role.""" def as_dict(self) -> dict: + """Serializes the StsRole into a dictionary suitable for use as a JSON request body.""" body = {} if self.external_id is not None: body['external_id'] = self.external_id if self.role_arn is not None: body['role_arn'] = self.role_arn return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StsRole': + def from_dict(cls, d: Dict[str, any]) -> StsRole: + """Deserializes the StsRole from a dictionary.""" return cls(external_id=d.get('external_id', None), role_arn=d.get('role_arn', None)) @dataclass class UpdateWorkspaceRequest: aws_region: Optional[str] = None + """The AWS region of the workspace's data plane (for example, `us-west-2`). This parameter is + available only for updating failed workspaces.""" + credentials_id: Optional[str] = None - custom_tags: Optional['Dict[str,str]'] = None + """ID of the workspace's credential configuration object. This parameter is available for updating + both failed and running workspaces.""" + + custom_tags: Optional[Dict[str, str]] = None + """The custom tags key-value pairing that is attached to this workspace. The key-value pair is a + string of utf-8 characters. The value can be an empty string, with maximum length of 255 + characters. The key can be of maximum length of 127 characters, and cannot be empty.""" + managed_services_customer_managed_key_id: Optional[str] = None + """The ID of the workspace's managed services encryption key configuration object. This parameter + is available only for updating failed workspaces.""" + network_connectivity_config_id: Optional[str] = None + """The ID of the network connectivity configuration object, which is the parent resource of this + private endpoint rule object.""" + network_id: Optional[str] = None + """The ID of the workspace's network configuration object. Used only if you already use a + customer-managed VPC. For failed workspaces only, you can switch from a Databricks-managed VPC + to a customer-managed VPC by updating the workspace to add a network configuration ID.""" + storage_configuration_id: Optional[str] = None + """The ID of the workspace's storage configuration object. This parameter is available only for + updating failed workspaces.""" + storage_customer_managed_key_id: Optional[str] = None + """The ID of the key configuration object for workspace storage. This parameter is available for + updating both failed and running workspaces.""" + workspace_id: Optional[int] = None + """Workspace ID.""" def as_dict(self) -> dict: + """Serializes the UpdateWorkspaceRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.aws_region is not None: body['aws_region'] = self.aws_region if self.credentials_id is not None: body['credentials_id'] = self.credentials_id @@ -813,7 +1181,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceRequest': + def from_dict(cls, d: Dict[str, any]) -> UpdateWorkspaceRequest: + """Deserializes the UpdateWorkspaceRequest from a dictionary.""" return cls(aws_region=d.get('aws_region', None), credentials_id=d.get('credentials_id', None), custom_tags=d.get('custom_tags', None), @@ -829,13 +1198,43 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateWorkspaceRequest': @dataclass class UpsertPrivateAccessSettingsRequest: private_access_settings_name: str + """The human-readable name of the private access settings object.""" + region: str - allowed_vpc_endpoint_ids: Optional['List[str]'] = None - private_access_level: Optional['PrivateAccessLevel'] = None + """The cloud region for workspaces associated with this private access settings object.""" + + allowed_vpc_endpoint_ids: Optional[List[str]] = None + """An array of Databricks VPC endpoint IDs. This is the Databricks ID that is returned when + registering the VPC endpoint configuration in your Databricks account. This is not the ID of the + VPC endpoint in AWS. + + Only used when `private_access_level` is set to `ENDPOINT`. This is an allow list of VPC + endpoints that in your account that can connect to your workspace over AWS PrivateLink. + + If hybrid access to your workspace is enabled by setting `public_access_enabled` to `true`, this + control only works for PrivateLink connections. To control how your workspace is accessed via + public internet, see [IP access lists]. + + [IP access lists]: https://docs.databricks.com/security/network/ip-access-list.html""" + + private_access_level: Optional[PrivateAccessLevel] = None + """The private access level controls which VPC endpoints can connect to the UI or API of any + workspace that attaches this private access settings object. * `ACCOUNT` level access (the + default) allows only VPC endpoints that are registered in your Databricks account connect to + your workspace. * `ENDPOINT` level access allows only specified VPC endpoints connect to your + workspace. For details, see `allowed_vpc_endpoint_ids`.""" + private_access_settings_id: Optional[str] = None + """Databricks Account API private access settings ID.""" + public_access_enabled: Optional[bool] = None + """Determines if the workspace can be accessed over public internet. For fully private workspaces, + you can optionally specify `false`, but only if you implement both the front-end and the + back-end PrivateLink connections. Otherwise, specify `true`, which means that public access is + enabled.""" def as_dict(self) -> dict: + """Serializes the UpsertPrivateAccessSettingsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.allowed_vpc_endpoint_ids: body['allowed_vpc_endpoint_ids'] = [v for v in self.allowed_vpc_endpoint_ids] @@ -850,7 +1249,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpsertPrivateAccessSettingsRequest': + def from_dict(cls, d: Dict[str, any]) -> UpsertPrivateAccessSettingsRequest: + """Deserializes the UpsertPrivateAccessSettingsRequest from a dictionary.""" return cls(allowed_vpc_endpoint_ids=d.get('allowed_vpc_endpoint_ids', None), private_access_level=_enum(d, 'private_access_level', PrivateAccessLevel), private_access_settings_id=d.get('private_access_settings_id', None), @@ -862,17 +1262,49 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpsertPrivateAccessSettingsRequest': @dataclass class VpcEndpoint: account_id: Optional[str] = None + """The Databricks account ID that hosts the VPC endpoint configuration.""" + aws_account_id: Optional[str] = None + """The AWS Account in which the VPC endpoint object exists.""" + aws_endpoint_service_id: Optional[str] = None + """The ID of the Databricks [endpoint service] that this VPC endpoint is connected to. For a list + of endpoint service IDs for each supported AWS region, see the [Databricks PrivateLink + documentation]. + + [Databricks PrivateLink documentation]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html + [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html""" + aws_vpc_endpoint_id: Optional[str] = None - gcp_vpc_endpoint_info: Optional['GcpVpcEndpointInfo'] = None + """The ID of the VPC endpoint object in AWS.""" + + gcp_vpc_endpoint_info: Optional[GcpVpcEndpointInfo] = None + """The Google Cloud specific information for this Private Service Connect endpoint.""" + region: Optional[str] = None + """The AWS region in which this VPC endpoint object exists.""" + state: Optional[str] = None - use_case: Optional['EndpointUseCase'] = None + """The current state (such as `available` or `rejected`) of the VPC endpoint. Derived from AWS. For + the full set of values, see [AWS DescribeVpcEndpoint documentation]. + + [AWS DescribeVpcEndpoint documentation]: https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpc-endpoints.html""" + + use_case: Optional[EndpointUseCase] = None + """This enumeration represents the type of Databricks VPC [endpoint service] that was used when + creating this VPC endpoint. + + [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html""" + vpc_endpoint_id: Optional[str] = None + """Databricks VPC endpoint ID. This is the Databricks-specific name of the VPC endpoint. Do not + confuse this with the `aws_vpc_endpoint_id`, which is the ID within AWS of the VPC endpoint.""" + vpc_endpoint_name: Optional[str] = None + """The human-readable name of the storage configuration.""" def as_dict(self) -> dict: + """Serializes the VpcEndpoint into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.aws_account_id is not None: body['aws_account_id'] = self.aws_account_id @@ -888,7 +1320,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'VpcEndpoint': + def from_dict(cls, d: Dict[str, any]) -> VpcEndpoint: + """Deserializes the VpcEndpoint from a dictionary.""" return cls(account_id=d.get('account_id', None), aws_account_id=d.get('aws_account_id', None), aws_endpoint_service_id=d.get('aws_endpoint_service_id', None), @@ -921,28 +1354,104 @@ class WarningType(Enum): @dataclass class Workspace: account_id: Optional[str] = None + """Databricks account ID.""" + aws_region: Optional[str] = None + """The AWS region of the workspace data plane (for example, `us-west-2`).""" + cloud: Optional[str] = None - cloud_resource_container: Optional['CloudResourceContainer'] = None + """The cloud name. This field always has the value `gcp`.""" + + cloud_resource_container: Optional[CloudResourceContainer] = None + """The general workspace configurations that are specific to cloud providers.""" + creation_time: Optional[int] = None + """Time in epoch milliseconds when the workspace was created.""" + credentials_id: Optional[str] = None - custom_tags: Optional['Dict[str,str]'] = None + """ID of the workspace's credential configuration object.""" + + custom_tags: Optional[Dict[str, str]] = None + """The custom tags key-value pairing that is attached to this workspace. The key-value pair is a + string of utf-8 characters. The value can be an empty string, with maximum length of 255 + characters. The key can be of maximum length of 127 characters, and cannot be empty.""" + deployment_name: Optional[str] = None - gcp_managed_network_config: Optional['GcpManagedNetworkConfig'] = None - gke_config: Optional['GkeConfig'] = None + """The deployment name defines part of the subdomain for the workspace. The workspace URL for web + application and REST APIs is `.cloud.databricks.com`. + + This value must be unique across all non-deleted deployments across all AWS regions.""" + + gcp_managed_network_config: Optional[GcpManagedNetworkConfig] = None + """The network settings for the workspace. The configurations are only for Databricks-managed VPCs. + It is ignored if you specify a customer-managed VPC in the `network_id` field.", All the IP + range configurations must be mutually exclusive. An attempt to create a workspace fails if + Databricks detects an IP range overlap. + + Specify custom IP ranges in CIDR format. The IP ranges for these fields must not overlap, and + all IP addresses must be entirely within the following ranges: `10.0.0.0/8`, `100.64.0.0/10`, + `172.16.0.0/12`, `192.168.0.0/16`, and `240.0.0.0/4`. + + The sizes of these IP ranges affect the maximum number of nodes for the workspace. + + **Important**: Confirm the IP ranges used by your Databricks workspace before creating the + workspace. You cannot change them after your workspace is deployed. If the IP address ranges for + your Databricks are too small, IP exhaustion can occur, causing your Databricks jobs to fail. To + determine the address range sizes that you need, Databricks provides a calculator as a Microsoft + Excel spreadsheet. See [calculate subnet sizes for a new workspace]. + + [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html""" + + gke_config: Optional[GkeConfig] = None + """The configurations for the GKE cluster of a Databricks workspace.""" + location: Optional[str] = None + """The Google Cloud region of the workspace data plane in your Google account (for example, + `us-east4`).""" + managed_services_customer_managed_key_id: Optional[str] = None + """ID of the key configuration for encrypting managed services.""" + network_id: Optional[str] = None - pricing_tier: Optional['PricingTier'] = None + """The network configuration ID that is attached to the workspace. This field is available only if + the network is a customer-managed network.""" + + pricing_tier: Optional[PricingTier] = None + """The pricing tier of the workspace. For pricing tier information, see [AWS Pricing]. + + [AWS Pricing]: https://databricks.com/product/aws-pricing""" + private_access_settings_id: Optional[str] = None + """ID of the workspace's private access settings object. Only used for PrivateLink. You must + specify this ID if you are using [AWS PrivateLink] for either front-end (user-to-workspace + connection), back-end (data plane to control plane connection), or both connection types. + + Before configuring PrivateLink, read the [Databricks article about PrivateLink]. + + [AWS PrivateLink]: https://aws.amazon.com/privatelink/ + [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html""" + storage_configuration_id: Optional[str] = None + """ID of the workspace's storage configuration object.""" + storage_customer_managed_key_id: Optional[str] = None + """ID of the key configuration for encrypting workspace storage.""" + workspace_id: Optional[int] = None + """A unique integer ID for the workspace""" + workspace_name: Optional[str] = None - workspace_status: Optional['WorkspaceStatus'] = None + """The human-readable name of the workspace.""" + + workspace_status: Optional[WorkspaceStatus] = None + """The status of the workspace. For workspace creation, usually it is set to `PROVISIONING` + initially. Continue to check the status until the status is `RUNNING`.""" + workspace_status_message: Optional[str] = None + """Message describing the current workspace status.""" def as_dict(self) -> dict: + """Serializes the Workspace into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.aws_region is not None: body['aws_region'] = self.aws_region @@ -975,7 +1484,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Workspace': + def from_dict(cls, d: Dict[str, any]) -> Workspace: + """Deserializes the Workspace from a dictionary.""" return cls(account_id=d.get('account_id', None), aws_region=d.get('aws_region', None), cloud=d.get('cloud', None), @@ -1088,7 +1598,7 @@ def get(self, credentials_id: str) -> Credential: headers=headers) return Credential.from_dict(res) - def list(self) -> Iterator['Credential']: + def list(self) -> Iterator[Credential]: """Get all credential configurations. Gets all Databricks credential configurations associated with an account specified by ID. @@ -1205,7 +1715,7 @@ def get(self, customer_managed_key_id: str) -> CustomerManagedKey: headers=headers) return CustomerManagedKey.from_dict(res) - def list(self) -> Iterator['CustomerManagedKey']: + def list(self) -> Iterator[CustomerManagedKey]: """Get all encryption key configurations. Gets all customer-managed key configuration objects for an account. If the key is specified as a @@ -1321,7 +1831,7 @@ def get(self, network_id: str) -> Network: headers=headers) return Network.from_dict(res) - def list(self) -> Iterator['Network']: + def list(self) -> Iterator[Network]: """Get all network configurations. Gets a list of all Databricks network configurations for an account, specified by ID. @@ -1456,7 +1966,7 @@ def get(self, private_access_settings_id: str) -> PrivateAccessSettings: headers=headers) return PrivateAccessSettings.from_dict(res) - def list(self) -> Iterator['PrivateAccessSettings']: + def list(self) -> Iterator[PrivateAccessSettings]: """Get all private access settings objects. Gets a list of all private access settings objects for an account, specified by ID. @@ -1623,7 +2133,7 @@ def get(self, storage_configuration_id: str) -> StorageConfiguration: headers=headers) return StorageConfiguration.from_dict(res) - def list(self) -> Iterator['StorageConfiguration']: + def list(self) -> Iterator[StorageConfiguration]: """Get all storage configurations. Gets a list of all Databricks storage configurations for your account, specified by ID. @@ -1732,7 +2242,7 @@ def get(self, vpc_endpoint_id: str) -> VpcEndpoint: headers=headers) return VpcEndpoint.from_dict(res) - def list(self) -> Iterator['VpcEndpoint']: + def list(self) -> Iterator[VpcEndpoint]: """Get all VPC endpoint configurations. Gets a list of all VPC endpoints for an account, specified by ID. @@ -2029,7 +2539,7 @@ def get(self, workspace_id: int) -> Workspace: headers=headers) return Workspace.from_dict(res) - def list(self) -> Iterator['Workspace']: + def list(self) -> Iterator[Workspace]: """Get all workspaces. Gets a list of all workspaces associated with an account, specified by ID. diff --git a/databricks/sdk/service/serving.py b/databricks/sdk/service/serving.py index 6d9b776b0..1d1d47102 100755 --- a/databricks/sdk/service/serving.py +++ b/databricks/sdk/service/serving.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging import random import time @@ -19,12 +21,17 @@ @dataclass class AppEvents: event_name: Optional[str] = None + event_time: Optional[str] = None + event_type: Optional[str] = None + message: Optional[str] = None + service_name: Optional[str] = None def as_dict(self) -> dict: + """Serializes the AppEvents into a dictionary suitable for use as a JSON request body.""" body = {} if self.event_name is not None: body['event_name'] = self.event_name if self.event_time is not None: body['event_time'] = self.event_time @@ -34,7 +41,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AppEvents': + def from_dict(cls, d: Dict[str, any]) -> AppEvents: + """Deserializes the AppEvents from a dictionary.""" return cls(event_name=d.get('event_name', None), event_time=d.get('event_time', None), event_type=d.get('event_type', None), @@ -44,15 +52,29 @@ def from_dict(cls, d: Dict[str, any]) -> 'AppEvents': @dataclass class AppManifest: - dependencies: Optional['List[Any]'] = None + dependencies: Optional[List[Any]] = None + """Workspace dependencies.""" + description: Optional[str] = None + """application description""" + ingress: Optional[Any] = None + """Ingress rules for app public endpoints""" + name: Optional[str] = None + """Only a-z and dashes (-). Max length of 30.""" + registry: Optional[Any] = None + """Container private registry""" + services: Optional[Any] = None + """list of app services. Restricted to one for now.""" + version: Optional[Any] = None + """The manifest format version. Must be set to 1.""" def as_dict(self) -> dict: + """Serializes the AppManifest into a dictionary suitable for use as a JSON request body.""" body = {} if self.dependencies: body['dependencies'] = [v for v in self.dependencies] if self.description is not None: body['description'] = self.description @@ -64,7 +86,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AppManifest': + def from_dict(cls, d: Dict[str, any]) -> AppManifest: + """Deserializes the AppManifest from a dictionary.""" return cls(dependencies=d.get('dependencies', None), description=d.get('description', None), ingress=d.get('ingress', None), @@ -77,10 +100,13 @@ def from_dict(cls, d: Dict[str, any]) -> 'AppManifest': @dataclass class AppServiceStatus: deployment: Optional[Any] = None + name: Optional[str] = None + template: Optional[Any] = None def as_dict(self) -> dict: + """Serializes the AppServiceStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.deployment: body['deployment'] = self.deployment if self.name is not None: body['name'] = self.name @@ -88,7 +114,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AppServiceStatus': + def from_dict(cls, d: Dict[str, any]) -> AppServiceStatus: + """Deserializes the AppServiceStatus from a dictionary.""" return cls(deployment=d.get('deployment', None), name=d.get('name', None), template=d.get('template', None)) @@ -97,24 +124,34 @@ def from_dict(cls, d: Dict[str, any]) -> 'AppServiceStatus': @dataclass class BuildLogsResponse: logs: str + """The logs associated with building the served model's environment.""" def as_dict(self) -> dict: + """Serializes the BuildLogsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.logs is not None: body['logs'] = self.logs return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BuildLogsResponse': + def from_dict(cls, d: Dict[str, any]) -> BuildLogsResponse: + """Deserializes the BuildLogsResponse from a dictionary.""" return cls(logs=d.get('logs', None)) @dataclass class CreateServingEndpoint: name: str - config: 'EndpointCoreConfigInput' - tags: Optional['List[EndpointTag]'] = None + """The name of the serving endpoint. This field is required and must be unique across a Databricks + workspace. An endpoint name can consist of alphanumeric characters, dashes, and underscores.""" + + config: EndpointCoreConfigInput + """The core config of the serving endpoint.""" + + tags: Optional[List[EndpointTag]] = None + """Tags to be attached to the serving endpoint and automatically propagated to billing logs.""" def as_dict(self) -> dict: + """Serializes the CreateServingEndpoint into a dictionary suitable for use as a JSON request body.""" body = {} if self.config: body['config'] = self.config.as_dict() if self.name is not None: body['name'] = self.name @@ -122,7 +159,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateServingEndpoint': + def from_dict(cls, d: Dict[str, any]) -> CreateServingEndpoint: + """Deserializes the CreateServingEndpoint from a dictionary.""" return cls(config=_from_dict(d, 'config', EndpointCoreConfigInput), name=d.get('name', None), tags=_repeated_dict(d, 'tags', EndpointTag)) @@ -130,11 +168,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateServingEndpoint': @dataclass class DataframeSplitInput: - columns: Optional['List[Any]'] = None - data: Optional['List[Any]'] = None - index: Optional['List[int]'] = None + columns: Optional[List[Any]] = None + + data: Optional[List[Any]] = None + + index: Optional[List[int]] = None def as_dict(self) -> dict: + """Serializes the DataframeSplitInput into a dictionary suitable for use as a JSON request body.""" body = {} if self.columns: body['columns'] = [v for v in self.columns] if self.data: body['data'] = [v for v in self.data] @@ -142,7 +183,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DataframeSplitInput': + def from_dict(cls, d: Dict[str, any]) -> DataframeSplitInput: + """Deserializes the DataframeSplitInput from a dictionary.""" return cls(columns=d.get('columns', None), data=d.get('data', None), index=d.get('index', None)) @@ -151,39 +193,54 @@ class DeleteAppResponse: name: Optional[str] = None def as_dict(self) -> dict: + """Serializes the DeleteAppResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteAppResponse': + def from_dict(cls, d: Dict[str, any]) -> DeleteAppResponse: + """Deserializes the DeleteAppResponse from a dictionary.""" return cls(name=d.get('name', None)) @dataclass class DeployAppRequest: - manifest: 'AppManifest' + manifest: AppManifest + """Manifest that specifies the application requirements""" + resources: Optional[Any] = None + """Information passed at app deployment time to fulfill app dependencies""" def as_dict(self) -> dict: + """Serializes the DeployAppRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.manifest: body['manifest'] = self.manifest.as_dict() if self.resources: body['resources'] = self.resources return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeployAppRequest': + def from_dict(cls, d: Dict[str, any]) -> DeployAppRequest: + """Deserializes the DeployAppRequest from a dictionary.""" return cls(manifest=_from_dict(d, 'manifest', AppManifest), resources=d.get('resources', None)) @dataclass class DeploymentStatus: - container_logs: Optional['List[Any]'] = None + container_logs: Optional[List[Any]] = None + """Container logs.""" + deployment_id: Optional[str] = None + """description""" + extra_info: Optional[str] = None - state: Optional['DeploymentStatusState'] = None + """Supplementary information about pod""" + + state: Optional[DeploymentStatusState] = None + """State: one of DEPLOYING,SUCCESS, FAILURE, DEPLOYMENT_STATE_UNSPECIFIED""" def as_dict(self) -> dict: + """Serializes the DeploymentStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.container_logs: body['container_logs'] = [v for v in self.container_logs] if self.deployment_id is not None: body['deployment_id'] = self.deployment_id @@ -192,7 +249,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeploymentStatus': + def from_dict(cls, d: Dict[str, any]) -> DeploymentStatus: + """Deserializes the DeploymentStatus from a dictionary.""" return cls(container_logs=d.get('container_logs', None), deployment_id=d.get('deployment_id', None), extra_info=d.get('extra_info', None), @@ -210,11 +268,18 @@ class DeploymentStatusState(Enum): @dataclass class EndpointCoreConfigInput: - served_models: 'List[ServedModelInput]' + served_models: List[ServedModelInput] + """A list of served models for the endpoint to serve. A serving endpoint can have up to 10 served + models.""" + name: Optional[str] = None - traffic_config: Optional['TrafficConfig'] = None + """The name of the serving endpoint to update. This field is required.""" + + traffic_config: Optional[TrafficConfig] = None + """The traffic config defining how invocations to the serving endpoint should be routed.""" def as_dict(self) -> dict: + """Serializes the EndpointCoreConfigInput into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.served_models: body['served_models'] = [v.as_dict() for v in self.served_models] @@ -222,7 +287,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointCoreConfigInput': + def from_dict(cls, d: Dict[str, any]) -> EndpointCoreConfigInput: + """Deserializes the EndpointCoreConfigInput from a dictionary.""" return cls(name=d.get('name', None), served_models=_repeated_dict(d, 'served_models', ServedModelInput), traffic_config=_from_dict(d, 'traffic_config', TrafficConfig)) @@ -231,10 +297,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'EndpointCoreConfigInput': @dataclass class EndpointCoreConfigOutput: config_version: Optional[int] = None - served_models: Optional['List[ServedModelOutput]'] = None - traffic_config: Optional['TrafficConfig'] = None + """The config version that the serving endpoint is currently serving.""" + + served_models: Optional[List[ServedModelOutput]] = None + """The list of served models under the serving endpoint config.""" + + traffic_config: Optional[TrafficConfig] = None + """The traffic configuration associated with the serving endpoint config.""" def as_dict(self) -> dict: + """Serializes the EndpointCoreConfigOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.config_version is not None: body['config_version'] = self.config_version if self.served_models: body['served_models'] = [v.as_dict() for v in self.served_models] @@ -242,7 +314,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointCoreConfigOutput': + def from_dict(cls, d: Dict[str, any]) -> EndpointCoreConfigOutput: + """Deserializes the EndpointCoreConfigOutput from a dictionary.""" return cls(config_version=d.get('config_version', None), served_models=_repeated_dict(d, 'served_models', ServedModelOutput), traffic_config=_from_dict(d, 'traffic_config', TrafficConfig)) @@ -250,26 +323,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'EndpointCoreConfigOutput': @dataclass class EndpointCoreConfigSummary: - served_models: Optional['List[ServedModelSpec]'] = None + served_models: Optional[List[ServedModelSpec]] = None + """The list of served models under the serving endpoint config.""" def as_dict(self) -> dict: + """Serializes the EndpointCoreConfigSummary into a dictionary suitable for use as a JSON request body.""" body = {} if self.served_models: body['served_models'] = [v.as_dict() for v in self.served_models] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointCoreConfigSummary': + def from_dict(cls, d: Dict[str, any]) -> EndpointCoreConfigSummary: + """Deserializes the EndpointCoreConfigSummary from a dictionary.""" return cls(served_models=_repeated_dict(d, 'served_models', ServedModelSpec)) @dataclass class EndpointPendingConfig: config_version: Optional[int] = None - served_models: Optional['List[ServedModelOutput]'] = None + """The config version that the serving endpoint is currently serving.""" + + served_models: Optional[List[ServedModelOutput]] = None + """The list of served models belonging to the last issued update to the serving endpoint.""" + start_time: Optional[int] = None - traffic_config: Optional['TrafficConfig'] = None + """The timestamp when the update to the pending config started.""" + + traffic_config: Optional[TrafficConfig] = None + """The traffic config defining how invocations to the serving endpoint should be routed.""" def as_dict(self) -> dict: + """Serializes the EndpointPendingConfig into a dictionary suitable for use as a JSON request body.""" body = {} if self.config_version is not None: body['config_version'] = self.config_version if self.served_models: body['served_models'] = [v.as_dict() for v in self.served_models] @@ -278,7 +362,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointPendingConfig': + def from_dict(cls, d: Dict[str, any]) -> EndpointPendingConfig: + """Deserializes the EndpointPendingConfig from a dictionary.""" return cls(config_version=d.get('config_version', None), served_models=_repeated_dict(d, 'served_models', ServedModelOutput), start_time=d.get('start_time', None), @@ -287,17 +372,27 @@ def from_dict(cls, d: Dict[str, any]) -> 'EndpointPendingConfig': @dataclass class EndpointState: - config_update: Optional['EndpointStateConfigUpdate'] = None - ready: Optional['EndpointStateReady'] = None + config_update: Optional[EndpointStateConfigUpdate] = None + """The state of an endpoint's config update. This informs the user if the pending_config is in + progress, if the update failed, or if there is no update in progress. Note that if the + endpoint's config_update state value is IN_PROGRESS, another update can not be made until the + update completes or fails.""" + + ready: Optional[EndpointStateReady] = None + """The state of an endpoint, indicating whether or not the endpoint is queryable. An endpoint is + READY if all of the served models in its active configuration are ready. If any of the actively + served models are in a non-ready state, the endpoint state will be NOT_READY.""" def as_dict(self) -> dict: + """Serializes the EndpointState into a dictionary suitable for use as a JSON request body.""" body = {} if self.config_update is not None: body['config_update'] = self.config_update.value if self.ready is not None: body['ready'] = self.ready.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointState': + def from_dict(cls, d: Dict[str, any]) -> EndpointState: + """Deserializes the EndpointState from a dictionary.""" return cls(config_update=_enum(d, 'config_update', EndpointStateConfigUpdate), ready=_enum(d, 'ready', EndpointStateReady)) @@ -325,27 +420,36 @@ class EndpointStateReady(Enum): @dataclass class EndpointTag: key: str + """Key field for a serving endpoint tag.""" + value: Optional[str] = None + """Optional value field for a serving endpoint tag.""" def as_dict(self) -> dict: + """Serializes the EndpointTag into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointTag': + def from_dict(cls, d: Dict[str, any]) -> EndpointTag: + """Deserializes the EndpointTag from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class GetAppResponse: - current_services: Optional['List[AppServiceStatus]'] = None + current_services: Optional[List[AppServiceStatus]] = None + name: Optional[str] = None - pending_services: Optional['List[AppServiceStatus]'] = None + + pending_services: Optional[List[AppServiceStatus]] = None + url: Optional[str] = None def as_dict(self) -> dict: + """Serializes the GetAppResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.current_services: body['current_services'] = [v.as_dict() for v in self.current_services] if self.name is not None: body['name'] = self.name @@ -354,7 +458,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetAppResponse': + def from_dict(cls, d: Dict[str, any]) -> GetAppResponse: + """Deserializes the GetAppResponse from a dictionary.""" return cls(current_services=_repeated_dict(d, 'current_services', AppServiceStatus), name=d.get('name', None), pending_services=_repeated_dict(d, 'pending_services', AppServiceStatus), @@ -363,70 +468,89 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetAppResponse': @dataclass class GetServingEndpointPermissionLevelsResponse: - permission_levels: Optional['List[ServingEndpointPermissionsDescription]'] = None + permission_levels: Optional[List[ServingEndpointPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetServingEndpointPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetServingEndpointPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetServingEndpointPermissionLevelsResponse: + """Deserializes the GetServingEndpointPermissionLevelsResponse from a dictionary.""" return cls( permission_levels=_repeated_dict(d, 'permission_levels', ServingEndpointPermissionsDescription)) @dataclass class ListAppEventsResponse: - events: Optional['List[AppEvents]'] = None + events: Optional[List[AppEvents]] = None + """App events""" def as_dict(self) -> dict: + """Serializes the ListAppEventsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.events: body['events'] = [v.as_dict() for v in self.events] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListAppEventsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListAppEventsResponse: + """Deserializes the ListAppEventsResponse from a dictionary.""" return cls(events=_repeated_dict(d, 'events', AppEvents)) @dataclass class ListAppsResponse: - apps: Optional['List[Any]'] = None + apps: Optional[List[Any]] = None + """Available apps.""" + next_page_token: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ListAppsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.apps: body['apps'] = [v for v in self.apps] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListAppsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListAppsResponse: + """Deserializes the ListAppsResponse from a dictionary.""" return cls(apps=d.get('apps', None), next_page_token=d.get('next_page_token', None)) @dataclass class ListEndpointsResponse: - endpoints: Optional['List[ServingEndpoint]'] = None + endpoints: Optional[List[ServingEndpoint]] = None + """The list of endpoints.""" def as_dict(self) -> dict: + """Serializes the ListEndpointsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.endpoints: body['endpoints'] = [v.as_dict() for v in self.endpoints] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListEndpointsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListEndpointsResponse: + """Deserializes the ListEndpointsResponse from a dictionary.""" return cls(endpoints=_repeated_dict(d, 'endpoints', ServingEndpoint)) @dataclass class PatchServingEndpointTags: - add_tags: Optional['List[EndpointTag]'] = None - delete_tags: Optional['List[str]'] = None + add_tags: Optional[List[EndpointTag]] = None + """List of endpoint tags to add""" + + delete_tags: Optional[List[str]] = None + """List of tag keys to delete""" + name: Optional[str] = None + """The name of the serving endpoint who's tags to patch. This field is required.""" def as_dict(self) -> dict: + """Serializes the PatchServingEndpointTags into a dictionary suitable for use as a JSON request body.""" body = {} if self.add_tags: body['add_tags'] = [v.as_dict() for v in self.add_tags] if self.delete_tags: body['delete_tags'] = [v for v in self.delete_tags] @@ -434,7 +558,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PatchServingEndpointTags': + def from_dict(cls, d: Dict[str, any]) -> PatchServingEndpointTags: + """Deserializes the PatchServingEndpointTags from a dictionary.""" return cls(add_tags=_repeated_dict(d, 'add_tags', EndpointTag), delete_tags=d.get('delete_tags', None), name=d.get('name', None)) @@ -442,13 +567,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'PatchServingEndpointTags': @dataclass class QueryEndpointInput: - dataframe_records: Optional['List[Any]'] = None - dataframe_split: Optional['DataframeSplitInput'] = None + dataframe_records: Optional[List[Any]] = None + """Pandas Dataframe input in the records orientation.""" + + dataframe_split: Optional[DataframeSplitInput] = None + """Pandas Dataframe input in the split orientation.""" + inputs: Optional[Any] = None - instances: Optional['List[Any]'] = None + """Tensor-based input in columnar format.""" + + instances: Optional[List[Any]] = None + """Tensor-based input in row format.""" + name: Optional[str] = None + """The name of the serving endpoint. This field is required.""" def as_dict(self) -> dict: + """Serializes the QueryEndpointInput into a dictionary suitable for use as a JSON request body.""" body = {} if self.dataframe_records: body['dataframe_records'] = [v for v in self.dataframe_records] if self.dataframe_split: body['dataframe_split'] = self.dataframe_split.as_dict() @@ -458,7 +593,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryEndpointInput': + def from_dict(cls, d: Dict[str, any]) -> QueryEndpointInput: + """Deserializes the QueryEndpointInput from a dictionary.""" return cls(dataframe_records=d.get('dataframe_records', None), dataframe_split=_from_dict(d, 'dataframe_split', DataframeSplitInput), inputs=d.get('inputs', None), @@ -468,31 +604,40 @@ def from_dict(cls, d: Dict[str, any]) -> 'QueryEndpointInput': @dataclass class QueryEndpointResponse: - predictions: 'List[Any]' + predictions: List[Any] + """The predictions returned by the serving endpoint.""" def as_dict(self) -> dict: + """Serializes the QueryEndpointResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.predictions: body['predictions'] = [v for v in self.predictions] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryEndpointResponse': + def from_dict(cls, d: Dict[str, any]) -> QueryEndpointResponse: + """Deserializes the QueryEndpointResponse from a dictionary.""" return cls(predictions=d.get('predictions', None)) @dataclass class Route: served_model_name: str + """The name of the served model this route configures traffic for.""" + traffic_percentage: int + """The percentage of endpoint traffic to send to this route. It must be an integer between 0 and + 100 inclusive.""" def as_dict(self) -> dict: + """Serializes the Route into a dictionary suitable for use as a JSON request body.""" body = {} if self.served_model_name is not None: body['served_model_name'] = self.served_model_name if self.traffic_percentage is not None: body['traffic_percentage'] = self.traffic_percentage return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Route': + def from_dict(cls, d: Dict[str, any]) -> Route: + """Deserializes the Route from a dictionary.""" return cls(served_model_name=d.get('served_model_name', None), traffic_percentage=d.get('traffic_percentage', None)) @@ -500,15 +645,45 @@ def from_dict(cls, d: Dict[str, any]) -> 'Route': @dataclass class ServedModelInput: model_name: str + """The name of the model in Databricks Model Registry to be served or if the model resides in Unity + Catalog, the full name of model, in the form of __catalog_name__.__schema_name__.__model_name__.""" + model_version: str + """The version of the model in Databricks Model Registry or Unity Catalog to be served.""" + workload_size: str + """The workload size of the served model. The workload size corresponds to a range of provisioned + concurrency that the compute will autoscale between. A single unit of provisioned concurrency + can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned + concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned + concurrency). If scale-to-zero is enabled, the lower bound of the provisioned concurrency for + each workload size will be 0.""" + scale_to_zero_enabled: bool - environment_vars: Optional['Dict[str,str]'] = None + """Whether the compute resources for the served model should scale down to zero.""" + + environment_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs used + for serving this model. Note: this is an experimental feature and subject to change. Example + model environment variables that refer to Databricks secrets: `{"OPENAI_API_KEY": + "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": "{{secrets/my_scope2/my_key2}}"}`""" + instance_profile_arn: Optional[str] = None + """ARN of the instance profile that the served model will use to access AWS resources.""" + name: Optional[str] = None + """The name of a served model. It must be unique across an endpoint. If not specified, this field + will default to -. A served model name can consist of alphanumeric + characters, dashes, and underscores.""" + workload_type: Optional[str] = None + """The workload type of the served model. The workload type selects which type of compute to use in + the endpoint. The default value for this parameter is "CPU". For deep learning workloads, GPU + acceleration is available by selecting workload types like GPU_SMALL and others. See + documentation for all options.""" def as_dict(self) -> dict: + """Serializes the ServedModelInput into a dictionary suitable for use as a JSON request body.""" body = {} if self.environment_vars: body['environment_vars'] = self.environment_vars if self.instance_profile_arn is not None: body['instance_profile_arn'] = self.instance_profile_arn @@ -521,7 +696,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServedModelInput': + def from_dict(cls, d: Dict[str, any]) -> ServedModelInput: + """Deserializes the ServedModelInput from a dictionary.""" return cls(environment_vars=d.get('environment_vars', None), instance_profile_arn=d.get('instance_profile_arn', None), model_name=d.get('model_name', None), @@ -535,18 +711,52 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServedModelInput': @dataclass class ServedModelOutput: creation_timestamp: Optional[int] = None + """The creation timestamp of the served model in Unix time.""" + creator: Optional[str] = None - environment_vars: Optional['Dict[str,str]'] = None + """The email of the user who created the served model.""" + + environment_vars: Optional[Dict[str, str]] = None + """An object containing a set of optional, user-specified environment variable key-value pairs used + for serving this model. Note: this is an experimental feature and subject to change. Example + model environment variables that refer to Databricks secrets: `{"OPENAI_API_KEY": + "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": "{{secrets/my_scope2/my_key2}}"}`""" + instance_profile_arn: Optional[str] = None + """ARN of the instance profile that the served model will use to access AWS resources.""" + model_name: Optional[str] = None + """The name of the model in Databricks Model Registry or the full name of the model in Unity + Catalog.""" + model_version: Optional[str] = None + """The version of the model in Databricks Model Registry or Unity Catalog to be served.""" + name: Optional[str] = None + """The name of the served model.""" + scale_to_zero_enabled: Optional[bool] = None - state: Optional['ServedModelState'] = None + """Whether the compute resources for the Served Model should scale down to zero.""" + + state: Optional[ServedModelState] = None + """Information corresponding to the state of the Served Model.""" + workload_size: Optional[str] = None + """The workload size of the served model. The workload size corresponds to a range of provisioned + concurrency that the compute will autoscale between. A single unit of provisioned concurrency + can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned + concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned + concurrency). If scale-to-zero is enabled, the lower bound of the provisioned concurrency for + each workload size will be 0.""" + workload_type: Optional[str] = None + """The workload type of the served model. The workload type selects which type of compute to use in + the endpoint. The default value for this parameter is "CPU". For deep learning workloads, GPU + acceleration is available by selecting workload types like GPU_SMALL and others. See + documentation for all options.""" def as_dict(self) -> dict: + """Serializes the ServedModelOutput into a dictionary suitable for use as a JSON request body.""" body = {} if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp if self.creator is not None: body['creator'] = self.creator @@ -562,7 +772,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServedModelOutput': + def from_dict(cls, d: Dict[str, any]) -> ServedModelOutput: + """Deserializes the ServedModelOutput from a dictionary.""" return cls(creation_timestamp=d.get('creation_timestamp', None), creator=d.get('creator', None), environment_vars=d.get('environment_vars', None), @@ -579,10 +790,17 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServedModelOutput': @dataclass class ServedModelSpec: model_name: Optional[str] = None + """The name of the model in Databricks Model Registry or the full name of the model in Unity + Catalog.""" + model_version: Optional[str] = None + """The version of the model in Databricks Model Registry or Unity Catalog to be served.""" + name: Optional[str] = None + """The name of the served model.""" def as_dict(self) -> dict: + """Serializes the ServedModelSpec into a dictionary suitable for use as a JSON request body.""" body = {} if self.model_name is not None: body['model_name'] = self.model_name if self.model_version is not None: body['model_version'] = self.model_version @@ -590,7 +808,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServedModelSpec': + def from_dict(cls, d: Dict[str, any]) -> ServedModelSpec: + """Deserializes the ServedModelSpec from a dictionary.""" return cls(model_name=d.get('model_name', None), model_version=d.get('model_version', None), name=d.get('name', None)) @@ -598,10 +817,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServedModelSpec': @dataclass class ServedModelState: - deployment: Optional['ServedModelStateDeployment'] = None + deployment: Optional[ServedModelStateDeployment] = None + """The state of the served model deployment. DEPLOYMENT_CREATING indicates that the served model is + not ready yet because the deployment is still being created (i.e container image is building, + model server is deploying for the first time, etc.). DEPLOYMENT_RECOVERING indicates that the + served model was previously in a ready state but no longer is and is attempting to recover. + DEPLOYMENT_READY indicates that the served model is ready to receive traffic. DEPLOYMENT_FAILED + indicates that there was an error trying to bring up the served model (e.g container image build + failed, the model server failed to start due to a model loading error, etc.) DEPLOYMENT_ABORTED + indicates that the deployment was terminated likely due to a failure in bringing up another + served model under the same endpoint and config version.""" + deployment_state_message: Optional[str] = None + """More information about the state of the served model, if available.""" def as_dict(self) -> dict: + """Serializes the ServedModelState into a dictionary suitable for use as a JSON request body.""" body = {} if self.deployment is not None: body['deployment'] = self.deployment.value if self.deployment_state_message is not None: @@ -609,7 +840,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServedModelState': + def from_dict(cls, d: Dict[str, any]) -> ServedModelState: + """Deserializes the ServedModelState from a dictionary.""" return cls(deployment=_enum(d, 'deployment', ServedModelStateDeployment), deployment_state_message=d.get('deployment_state_message', None)) @@ -635,29 +867,49 @@ class ServedModelStateDeployment(Enum): @dataclass class ServerLogsResponse: logs: str + """The most recent log lines of the model server processing invocation requests.""" def as_dict(self) -> dict: + """Serializes the ServerLogsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.logs is not None: body['logs'] = self.logs return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServerLogsResponse': + def from_dict(cls, d: Dict[str, any]) -> ServerLogsResponse: + """Deserializes the ServerLogsResponse from a dictionary.""" return cls(logs=d.get('logs', None)) @dataclass class ServingEndpoint: - config: Optional['EndpointCoreConfigSummary'] = None + config: Optional[EndpointCoreConfigSummary] = None + """The config that is currently being served by the endpoint.""" + creation_timestamp: Optional[int] = None + """The timestamp when the endpoint was created in Unix time.""" + creator: Optional[str] = None + """The email of the user who created the serving endpoint.""" + id: Optional[str] = None + """System-generated ID of the endpoint. This is used to refer to the endpoint in the Permissions + API""" + last_updated_timestamp: Optional[int] = None + """The timestamp when the endpoint was last updated by a user in Unix time.""" + name: Optional[str] = None - state: Optional['EndpointState'] = None - tags: Optional['List[EndpointTag]'] = None + """The name of the serving endpoint.""" + + state: Optional[EndpointState] = None + """Information corresponding to the state of the serving endpoint.""" + + tags: Optional[List[EndpointTag]] = None + """Tags attached to the serving endpoint.""" def as_dict(self) -> dict: + """Serializes the ServingEndpoint into a dictionary suitable for use as a JSON request body.""" body = {} if self.config: body['config'] = self.config.as_dict() if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp @@ -671,7 +923,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpoint': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpoint: + """Deserializes the ServingEndpoint from a dictionary.""" return cls(config=_from_dict(d, 'config', EndpointCoreConfigSummary), creation_timestamp=d.get('creation_timestamp', None), creator=d.get('creator', None), @@ -685,11 +938,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpoint': @dataclass class ServingEndpointAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['ServingEndpointPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[ServingEndpointPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ServingEndpointAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -699,7 +961,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointAccessControlRequest: + """Deserializes the ServingEndpointAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', ServingEndpointPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -708,13 +971,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointAccessControlRequest': @dataclass class ServingEndpointAccessControlResponse: - all_permissions: Optional['List[ServingEndpointPermission]'] = None + all_permissions: Optional[List[ServingEndpointPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the ServingEndpointAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -725,7 +998,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointAccessControlResponse: + """Deserializes the ServingEndpointAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', ServingEndpointPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -735,18 +1009,39 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointAccessControlResponse': @dataclass class ServingEndpointDetailed: - config: Optional['EndpointCoreConfigOutput'] = None + config: Optional[EndpointCoreConfigOutput] = None + """The config that is currently being served by the endpoint.""" + creation_timestamp: Optional[int] = None + """The timestamp when the endpoint was created in Unix time.""" + creator: Optional[str] = None + """The email of the user who created the serving endpoint.""" + id: Optional[str] = None + """System-generated ID of the endpoint. This is used to refer to the endpoint in the Permissions + API""" + last_updated_timestamp: Optional[int] = None + """The timestamp when the endpoint was last updated by a user in Unix time.""" + name: Optional[str] = None - pending_config: Optional['EndpointPendingConfig'] = None - permission_level: Optional['ServingEndpointDetailedPermissionLevel'] = None - state: Optional['EndpointState'] = None - tags: Optional['List[EndpointTag]'] = None + """The name of the serving endpoint.""" + + pending_config: Optional[EndpointPendingConfig] = None + """The config that the endpoint is attempting to update to.""" + + permission_level: Optional[ServingEndpointDetailedPermissionLevel] = None + """The permission level of the principal making the request.""" + + state: Optional[EndpointState] = None + """Information corresponding to the state of the serving endpoint.""" + + tags: Optional[List[EndpointTag]] = None + """Tags attached to the serving endpoint.""" def as_dict(self) -> dict: + """Serializes the ServingEndpointDetailed into a dictionary suitable for use as a JSON request body.""" body = {} if self.config: body['config'] = self.config.as_dict() if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp @@ -762,7 +1057,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointDetailed': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointDetailed: + """Deserializes the ServingEndpointDetailed from a dictionary.""" return cls(config=_from_dict(d, 'config', EndpointCoreConfigOutput), creation_timestamp=d.get('creation_timestamp', None), creator=d.get('creator', None), @@ -786,10 +1082,14 @@ class ServingEndpointDetailedPermissionLevel(Enum): @dataclass class ServingEndpointPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['ServingEndpointPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[ServingEndpointPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ServingEndpointPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -797,7 +1097,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointPermission': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointPermission: + """Deserializes the ServingEndpointPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', ServingEndpointPermissionLevel)) @@ -813,11 +1114,14 @@ class ServingEndpointPermissionLevel(Enum): @dataclass class ServingEndpointPermissions: - access_control_list: Optional['List[ServingEndpointAccessControlResponse]'] = None + access_control_list: Optional[List[ServingEndpointAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the ServingEndpointPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -826,7 +1130,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointPermissions': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointPermissions: + """Deserializes the ServingEndpointPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ServingEndpointAccessControlResponse), object_id=d.get('object_id', None), @@ -836,26 +1141,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointPermissions': @dataclass class ServingEndpointPermissionsDescription: description: Optional[str] = None - permission_level: Optional['ServingEndpointPermissionLevel'] = None + + permission_level: Optional[ServingEndpointPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the ServingEndpointPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointPermissionsDescription: + """Deserializes the ServingEndpointPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', ServingEndpointPermissionLevel)) @dataclass class ServingEndpointPermissionsRequest: - access_control_list: Optional['List[ServingEndpointAccessControlRequest]'] = None + access_control_list: Optional[List[ServingEndpointAccessControlRequest]] = None + serving_endpoint_id: Optional[str] = None + """The serving endpoint for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the ServingEndpointPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -863,7 +1175,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> ServingEndpointPermissionsRequest: + """Deserializes the ServingEndpointPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', ServingEndpointAccessControlRequest), serving_endpoint_id=d.get('serving_endpoint_id', None)) @@ -871,15 +1184,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'ServingEndpointPermissionsRequest': @dataclass class TrafficConfig: - routes: Optional['List[Route]'] = None + routes: Optional[List[Route]] = None + """The list of routes that define traffic to each served model.""" def as_dict(self) -> dict: + """Serializes the TrafficConfig into a dictionary suitable for use as a JSON request body.""" body = {} if self.routes: body['routes'] = [v.as_dict() for v in self.routes] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TrafficConfig': + def from_dict(cls, d: Dict[str, any]) -> TrafficConfig: + """Deserializes the TrafficConfig from a dictionary.""" return cls(routes=_repeated_dict(d, 'routes', Route)) @@ -1172,7 +1488,7 @@ def get_permissions(self, serving_endpoint_id: str) -> ServingEndpointPermission headers=headers) return ServingEndpointPermissions.from_dict(res) - def list(self) -> Iterator['ServingEndpoint']: + def list(self) -> Iterator[ServingEndpoint]: """Retrieve all serving endpoints. :returns: Iterator over :class:`ServingEndpoint` @@ -1206,7 +1522,7 @@ def patch(self, name: str, *, add_tags: Optional[List[EndpointTag]] = None, - delete_tags: Optional[List[str]] = None) -> Iterator['EndpointTag']: + delete_tags: Optional[List[str]] = None) -> Iterator[EndpointTag]: """Patch the tags of a serving endpoint. Used to batch add and delete tags from a serving endpoint with a single API call. diff --git a/databricks/sdk/service/settings.py b/databricks/sdk/service/settings.py index af2d8c987..34ade7a09 100755 --- a/databricks/sdk/service/settings.py +++ b/databricks/sdk/service/settings.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -15,25 +17,39 @@ @dataclass class AccountNetworkPolicyMessage: serverless_internet_access_enabled: Optional[bool] = None + """Whether or not serverless UDF can access the internet. When false, access to the internet will + be blocked from serverless clusters. Trusted traffic required by clusters for basic + functionality will not be affected.""" def as_dict(self) -> dict: + """Serializes the AccountNetworkPolicyMessage into a dictionary suitable for use as a JSON request body.""" body = {} if self.serverless_internet_access_enabled is not None: body['serverless_internet_access_enabled'] = self.serverless_internet_access_enabled return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccountNetworkPolicyMessage': + def from_dict(cls, d: Dict[str, any]) -> AccountNetworkPolicyMessage: + """Deserializes the AccountNetworkPolicyMessage from a dictionary.""" return cls(serverless_internet_access_enabled=d.get('serverless_internet_access_enabled', None)) @dataclass class CreateIpAccessList: label: str - list_type: 'ListType' - ip_addresses: 'List[str]' + """Label for the IP access list. This **cannot** be empty.""" + + list_type: ListType + """Type of IP access list. Valid values are as follows and are case-sensitive: + + * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or + range. IP addresses in the block list are excluded even if they are included in an allow list.""" + + ip_addresses: List[str] + """Array of IP addresses or CIDR values to be added to the IP access list.""" def as_dict(self) -> dict: + """Serializes the CreateIpAccessList into a dictionary suitable for use as a JSON request body.""" body = {} if self.ip_addresses: body['ip_addresses'] = [v for v in self.ip_addresses] if self.label is not None: body['label'] = self.label @@ -41,7 +57,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateIpAccessList': + def from_dict(cls, d: Dict[str, any]) -> CreateIpAccessList: + """Deserializes the CreateIpAccessList from a dictionary.""" return cls(ip_addresses=d.get('ip_addresses', None), label=d.get('label', None), list_type=_enum(d, 'list_type', ListType)) @@ -49,41 +66,57 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateIpAccessList': @dataclass class CreateIpAccessListResponse: - ip_access_list: Optional['IpAccessListInfo'] = None + ip_access_list: Optional[IpAccessListInfo] = None def as_dict(self) -> dict: + """Serializes the CreateIpAccessListResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateIpAccessListResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateIpAccessListResponse: + """Deserializes the CreateIpAccessListResponse from a dictionary.""" return cls(ip_access_list=_from_dict(d, 'ip_access_list', IpAccessListInfo)) @dataclass class CreateNetworkConnectivityConfigRequest: name: str + """The name of the network connectivity configuration. The name can contain alphanumeric + characters, hyphens, and underscores. The length must be between 3 and 30 characters. The name + must match the regular expression `^[0-9a-zA-Z-_]{3,30}$`.""" + region: str + """The Azure region for this network connectivity configuration. Only workspaces in the same Azure + region can be attached to this network connectivity configuration.""" def as_dict(self) -> dict: + """Serializes the CreateNetworkConnectivityConfigRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.region is not None: body['region'] = self.region return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateNetworkConnectivityConfigRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateNetworkConnectivityConfigRequest: + """Deserializes the CreateNetworkConnectivityConfigRequest from a dictionary.""" return cls(name=d.get('name', None), region=d.get('region', None)) @dataclass class CreateOboTokenRequest: application_id: str + """Application ID of the service principal.""" + lifetime_seconds: int + """The number of seconds before the token expires.""" + comment: Optional[str] = None + """Comment that describes the purpose of the token.""" def as_dict(self) -> dict: + """Serializes the CreateOboTokenRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.application_id is not None: body['application_id'] = self.application_id if self.comment is not None: body['comment'] = self.comment @@ -91,7 +124,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateOboTokenRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateOboTokenRequest: + """Deserializes the CreateOboTokenRequest from a dictionary.""" return cls(application_id=d.get('application_id', None), comment=d.get('comment', None), lifetime_seconds=d.get('lifetime_seconds', None)) @@ -99,27 +133,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateOboTokenRequest': @dataclass class CreateOboTokenResponse: - token_info: Optional['TokenInfo'] = None + token_info: Optional[TokenInfo] = None + token_value: Optional[str] = None + """Value of the token.""" def as_dict(self) -> dict: + """Serializes the CreateOboTokenResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.token_info: body['token_info'] = self.token_info.as_dict() if self.token_value is not None: body['token_value'] = self.token_value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateOboTokenResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateOboTokenResponse: + """Deserializes the CreateOboTokenResponse from a dictionary.""" return cls(token_info=_from_dict(d, 'token_info', TokenInfo), token_value=d.get('token_value', None)) @dataclass class CreatePrivateEndpointRuleRequest: resource_id: str - group_id: 'CreatePrivateEndpointRuleRequestGroupId' + """The Azure resource ID of the target resource.""" + + group_id: CreatePrivateEndpointRuleRequestGroupId + """The sub-resource type (group ID) of the target resource. Note that to connect to workspace root + storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`.""" + network_connectivity_config_id: Optional[str] = None + """Your Network Connectvity Configuration ID.""" def as_dict(self) -> dict: + """Serializes the CreatePrivateEndpointRuleRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_id is not None: body['group_id'] = self.group_id.value if self.network_connectivity_config_id is not None: @@ -128,7 +173,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreatePrivateEndpointRuleRequest': + def from_dict(cls, d: Dict[str, any]) -> CreatePrivateEndpointRuleRequest: + """Deserializes the CreatePrivateEndpointRuleRequest from a dictionary.""" return cls(group_id=_enum(d, 'group_id', CreatePrivateEndpointRuleRequestGroupId), network_connectivity_config_id=d.get('network_connectivity_config_id', None), resource_id=d.get('resource_id', None)) @@ -147,32 +193,44 @@ class CreatePrivateEndpointRuleRequestGroupId(Enum): @dataclass class CreateTokenRequest: comment: Optional[str] = None + """Optional description to attach to the token.""" + lifetime_seconds: Optional[int] = None + """The lifetime of the token, in seconds. + + If the ifetime is not specified, this token remains valid indefinitely.""" def as_dict(self) -> dict: + """Serializes the CreateTokenRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.lifetime_seconds is not None: body['lifetime_seconds'] = self.lifetime_seconds return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateTokenRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateTokenRequest: + """Deserializes the CreateTokenRequest from a dictionary.""" return cls(comment=d.get('comment', None), lifetime_seconds=d.get('lifetime_seconds', None)) @dataclass class CreateTokenResponse: - token_info: Optional['PublicTokenInfo'] = None + token_info: Optional[PublicTokenInfo] = None + """The information for the new token.""" + token_value: Optional[str] = None + """The value of the new token.""" def as_dict(self) -> dict: + """Serializes the CreateTokenResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.token_info: body['token_info'] = self.token_info.as_dict() if self.token_value is not None: body['token_value'] = self.token_value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateTokenResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateTokenResponse: + """Deserializes the CreateTokenResponse from a dictionary.""" return cls(token_info=_from_dict(d, 'token_info', PublicTokenInfo), token_value=d.get('token_value', None)) @@ -187,11 +245,24 @@ class DefaultNamespaceSetting: restart of clusters and SQL warehouses to take effect. Additionally, the default namespace only applies when using Unity Catalog-enabled compute.""" - namespace: 'StringMessage' + namespace: StringMessage + etag: Optional[str] = None + """etag used for versioning. The response is at least as fresh as the eTag provided. This is used + for optimistic concurrency control as a way to help prevent simultaneous writes of a setting + overwriting each other. It is strongly suggested that systems make use of the etag in the read + -> update pattern to perform setting updates in order to avoid race conditions. That is, get an + etag from a GET request, and pass it with the PATCH request to identify the setting version you + are updating.""" + setting_name: Optional[str] = None + """Name of the corresponding setting. This field is populated in the response, but it will not be + respected even if it's set in the request body. The setting name in the path parameter will be + respected instead. Setting name is required to be 'default' if the setting only has one instance + per workspace.""" def as_dict(self) -> dict: + """Serializes the DefaultNamespaceSetting into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag if self.namespace: body['namespace'] = self.namespace.as_dict() @@ -199,7 +270,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DefaultNamespaceSetting': + def from_dict(cls, d: Dict[str, any]) -> DefaultNamespaceSetting: + """Deserializes the DefaultNamespaceSetting from a dictionary.""" return cls(etag=d.get('etag', None), namespace=_from_dict(d, 'namespace', StringMessage), setting_name=d.get('setting_name', None)) @@ -208,54 +280,88 @@ def from_dict(cls, d: Dict[str, any]) -> 'DefaultNamespaceSetting': @dataclass class DeleteAccountNetworkPolicyResponse: etag: str + """etag used for versioning. The response is at least as fresh as the eTag provided. This is used + for optimistic concurrency control as a way to help prevent simultaneous writes of a setting + overwriting each other. It is strongly suggested that systems make use of the etag in the read + -> update pattern to perform setting updates in order to avoid race conditions. That is, get an + etag from a GET request, and pass it with the PATCH request to identify the setting version you + are updating.""" def as_dict(self) -> dict: + """Serializes the DeleteAccountNetworkPolicyResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteAccountNetworkPolicyResponse': + def from_dict(cls, d: Dict[str, any]) -> DeleteAccountNetworkPolicyResponse: + """Deserializes the DeleteAccountNetworkPolicyResponse from a dictionary.""" return cls(etag=d.get('etag', None)) @dataclass class DeleteDefaultWorkspaceNamespaceResponse: etag: str + """etag used for versioning. The response is at least as fresh as the eTag provided. This is used + for optimistic concurrency control as a way to help prevent simultaneous writes of a setting + overwriting each other. It is strongly suggested that systems make use of the etag in the read + -> update pattern to perform setting updates in order to avoid race conditions. That is, get an + etag from a GET request, and pass it with the PATCH request to identify the setting version you + are updating.""" def as_dict(self) -> dict: + """Serializes the DeleteDefaultWorkspaceNamespaceResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteDefaultWorkspaceNamespaceResponse': + def from_dict(cls, d: Dict[str, any]) -> DeleteDefaultWorkspaceNamespaceResponse: + """Deserializes the DeleteDefaultWorkspaceNamespaceResponse from a dictionary.""" return cls(etag=d.get('etag', None)) @dataclass class DeletePersonalComputeSettingResponse: etag: str + """etag used for versioning. The response is at least as fresh as the eTag provided. This is used + for optimistic concurrency control as a way to help prevent simultaneous writes of a setting + overwriting each other. It is strongly suggested that systems make use of the etag in the read + -> update pattern to perform setting updates in order to avoid race conditions. That is, get an + etag from a GET request, and pass it with the PATCH request to identify the setting version you + are updating.""" def as_dict(self) -> dict: + """Serializes the DeletePersonalComputeSettingResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeletePersonalComputeSettingResponse': + def from_dict(cls, d: Dict[str, any]) -> DeletePersonalComputeSettingResponse: + """Deserializes the DeletePersonalComputeSettingResponse from a dictionary.""" return cls(etag=d.get('etag', None)) @dataclass class ExchangeToken: credential: Optional[str] = None + """The requested token.""" + credential_eol_time: Optional[int] = None + """The end-of-life timestamp of the token. The value is in milliseconds since the Unix epoch.""" + owner_id: Optional[int] = None - scopes: Optional['List[str]'] = None - token_type: Optional['TokenType'] = None + """User ID of the user that owns this token.""" + + scopes: Optional[List[str]] = None + """The scopes of access granted in the token.""" + + token_type: Optional[TokenType] = None + """The type of token request. As of now, only `AZURE_ACTIVE_DIRECTORY_TOKEN` is supported.""" def as_dict(self) -> dict: + """Serializes the ExchangeToken into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential is not None: body['credential'] = self.credential if self.credential_eol_time is not None: body['credentialEolTime'] = self.credential_eol_time @@ -265,7 +371,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExchangeToken': + def from_dict(cls, d: Dict[str, any]) -> ExchangeToken: + """Deserializes the ExchangeToken from a dictionary.""" return cls(credential=d.get('credential', None), credential_eol_time=d.get('credentialEolTime', None), owner_id=d.get('ownerId', None), @@ -275,11 +382,15 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExchangeToken': @dataclass class ExchangeTokenRequest: - partition_id: 'PartitionId' - token_type: 'List[TokenType]' - scopes: 'List[str]' + partition_id: PartitionId + + token_type: List[TokenType] + + scopes: List[str] + """Array of scopes for the token request.""" def as_dict(self) -> dict: + """Serializes the ExchangeTokenRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.partition_id: body['partitionId'] = self.partition_id.as_dict() if self.scopes: body['scopes'] = [v for v in self.scopes] @@ -287,7 +398,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExchangeTokenRequest': + def from_dict(cls, d: Dict[str, any]) -> ExchangeTokenRequest: + """Deserializes the ExchangeTokenRequest from a dictionary.""" return cls(partition_id=_from_dict(d, 'partitionId', PartitionId), scopes=d.get('scopes', None), token_type=_repeated_enum(d, 'tokenType', TokenType)) @@ -295,88 +407,122 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExchangeTokenRequest': @dataclass class ExchangeTokenResponse: - values: Optional['List[ExchangeToken]'] = None + values: Optional[List[ExchangeToken]] = None def as_dict(self) -> dict: + """Serializes the ExchangeTokenResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.values: body['values'] = [v.as_dict() for v in self.values] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExchangeTokenResponse': + def from_dict(cls, d: Dict[str, any]) -> ExchangeTokenResponse: + """Deserializes the ExchangeTokenResponse from a dictionary.""" return cls(values=_repeated_dict(d, 'values', ExchangeToken)) @dataclass class FetchIpAccessListResponse: - ip_access_list: Optional['IpAccessListInfo'] = None + ip_access_list: Optional[IpAccessListInfo] = None def as_dict(self) -> dict: + """Serializes the FetchIpAccessListResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'FetchIpAccessListResponse': + def from_dict(cls, d: Dict[str, any]) -> FetchIpAccessListResponse: + """Deserializes the FetchIpAccessListResponse from a dictionary.""" return cls(ip_access_list=_from_dict(d, 'ip_access_list', IpAccessListInfo)) @dataclass class GetIpAccessListResponse: - ip_access_list: Optional['IpAccessListInfo'] = None + ip_access_list: Optional[IpAccessListInfo] = None def as_dict(self) -> dict: + """Serializes the GetIpAccessListResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetIpAccessListResponse': + def from_dict(cls, d: Dict[str, any]) -> GetIpAccessListResponse: + """Deserializes the GetIpAccessListResponse from a dictionary.""" return cls(ip_access_list=_from_dict(d, 'ip_access_list', IpAccessListInfo)) @dataclass class GetIpAccessListsResponse: - ip_access_lists: Optional['List[IpAccessListInfo]'] = None + ip_access_lists: Optional[List[IpAccessListInfo]] = None def as_dict(self) -> dict: + """Serializes the GetIpAccessListsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.ip_access_lists: body['ip_access_lists'] = [v.as_dict() for v in self.ip_access_lists] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetIpAccessListsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetIpAccessListsResponse: + """Deserializes the GetIpAccessListsResponse from a dictionary.""" return cls(ip_access_lists=_repeated_dict(d, 'ip_access_lists', IpAccessListInfo)) @dataclass class GetTokenPermissionLevelsResponse: - permission_levels: Optional['List[TokenPermissionsDescription]'] = None + permission_levels: Optional[List[TokenPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetTokenPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetTokenPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetTokenPermissionLevelsResponse: + """Deserializes the GetTokenPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', TokenPermissionsDescription)) @dataclass class IpAccessListInfo: address_count: Optional[int] = None + """Total number of IP or CIDR values.""" + created_at: Optional[int] = None + """Creation timestamp in milliseconds.""" + created_by: Optional[int] = None + """User ID of the user who created this list.""" + enabled: Optional[bool] = None - ip_addresses: Optional['List[str]'] = None + """Specifies whether this IP access list is enabled.""" + + ip_addresses: Optional[List[str]] = None + """Array of IP addresses or CIDR values to be added to the IP access list.""" + label: Optional[str] = None + """Label for the IP access list. This **cannot** be empty.""" + list_id: Optional[str] = None - list_type: Optional['ListType'] = None + """Universally unique identifier (UUID) of the IP access list.""" + + list_type: Optional[ListType] = None + """Type of IP access list. Valid values are as follows and are case-sensitive: + + * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or + range. IP addresses in the block list are excluded even if they are included in an allow list.""" + updated_at: Optional[int] = None + """Update timestamp in milliseconds.""" + updated_by: Optional[int] = None + """User ID of the user who updated this list.""" def as_dict(self) -> dict: + """Serializes the IpAccessListInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.address_count is not None: body['address_count'] = self.address_count if self.created_at is not None: body['created_at'] = self.created_at @@ -391,7 +537,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'IpAccessListInfo': + def from_dict(cls, d: Dict[str, any]) -> IpAccessListInfo: + """Deserializes the IpAccessListInfo from a dictionary.""" return cls(address_count=d.get('address_count', None), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -406,63 +553,77 @@ def from_dict(cls, d: Dict[str, any]) -> 'IpAccessListInfo': @dataclass class ListIpAccessListResponse: - ip_access_lists: Optional['List[IpAccessListInfo]'] = None + ip_access_lists: Optional[List[IpAccessListInfo]] = None def as_dict(self) -> dict: + """Serializes the ListIpAccessListResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.ip_access_lists: body['ip_access_lists'] = [v.as_dict() for v in self.ip_access_lists] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListIpAccessListResponse': + def from_dict(cls, d: Dict[str, any]) -> ListIpAccessListResponse: + """Deserializes the ListIpAccessListResponse from a dictionary.""" return cls(ip_access_lists=_repeated_dict(d, 'ip_access_lists', IpAccessListInfo)) @dataclass class ListNccAzurePrivateEndpointRulesResponse: - items: Optional['List[NccAzurePrivateEndpointRule]'] = None + items: Optional[List[NccAzurePrivateEndpointRule]] = None + next_page_token: Optional[str] = None + """A token that can be used to get the next page of results. If null, there are no more results to + show.""" def as_dict(self) -> dict: + """Serializes the ListNccAzurePrivateEndpointRulesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.items: body['items'] = [v.as_dict() for v in self.items] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListNccAzurePrivateEndpointRulesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListNccAzurePrivateEndpointRulesResponse: + """Deserializes the ListNccAzurePrivateEndpointRulesResponse from a dictionary.""" return cls(items=_repeated_dict(d, 'items', NccAzurePrivateEndpointRule), next_page_token=d.get('next_page_token', None)) @dataclass class ListNetworkConnectivityConfigurationsResponse: - items: Optional['List[NetworkConnectivityConfiguration]'] = None + items: Optional[List[NetworkConnectivityConfiguration]] = None + next_page_token: Optional[str] = None + """A token that can be used to get the next page of results. If null, there are no more results to + show.""" def as_dict(self) -> dict: + """Serializes the ListNetworkConnectivityConfigurationsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.items: body['items'] = [v.as_dict() for v in self.items] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListNetworkConnectivityConfigurationsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListNetworkConnectivityConfigurationsResponse: + """Deserializes the ListNetworkConnectivityConfigurationsResponse from a dictionary.""" return cls(items=_repeated_dict(d, 'items', NetworkConnectivityConfiguration), next_page_token=d.get('next_page_token', None)) @dataclass class ListTokensResponse: - token_infos: Optional['List[TokenInfo]'] = None + token_infos: Optional[List[TokenInfo]] = None def as_dict(self) -> dict: + """Serializes the ListTokensResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.token_infos: body['token_infos'] = [v.as_dict() for v in self.token_infos] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListTokensResponse': + def from_dict(cls, d: Dict[str, any]) -> ListTokensResponse: + """Deserializes the ListTokensResponse from a dictionary.""" return cls(token_infos=_repeated_dict(d, 'token_infos', TokenInfo)) @@ -478,18 +639,49 @@ class ListType(Enum): @dataclass class NccAzurePrivateEndpointRule: - connection_state: Optional['NccAzurePrivateEndpointRuleConnectionState'] = None + connection_state: Optional[NccAzurePrivateEndpointRuleConnectionState] = None + """The current status of this private endpoint. The private endpoint rules are effective only if + the connection state is `ESTABLISHED`. Remember that you must approve new endpoints on your + resources in the Azure portal before they take effect. + + The possible values are: - INIT: (deprecated) The endpoint has been created and pending + approval. - PENDING: The endpoint has been created and pending approval. - ESTABLISHED: The + endpoint has been approved and is ready to use in your serverless compute resources. - REJECTED: + Connection was rejected by the private link resource owner. - DISCONNECTED: Connection was + removed by the private link resource owner, the private endpoint becomes informative and should + be deleted for clean-up.""" + creation_time: Optional[int] = None + """Time in epoch milliseconds when this object was created.""" + deactivated: Optional[bool] = None + """Whether this private endpoint is deactivated.""" + deactivated_at: Optional[int] = None + """Time in epoch milliseconds when this object was deactivated.""" + endpoint_name: Optional[str] = None - group_id: Optional['NccAzurePrivateEndpointRuleGroupId'] = None + """The name of the Azure private endpoint resource.""" + + group_id: Optional[NccAzurePrivateEndpointRuleGroupId] = None + """The sub-resource type (group ID) of the target resource. Note that to connect to workspace root + storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`.""" + network_connectivity_config_id: Optional[str] = None + """The ID of a network connectivity configuration, which is the parent resource of this private + endpoint rule object.""" + resource_id: Optional[str] = None + """The Azure resource ID of the target resource.""" + rule_id: Optional[str] = None + """The ID of a private endpoint rule.""" + updated_time: Optional[int] = None + """Time in epoch milliseconds when this object was updated.""" def as_dict(self) -> dict: + """Serializes the NccAzurePrivateEndpointRule into a dictionary suitable for use as a JSON request body.""" body = {} if self.connection_state is not None: body['connection_state'] = self.connection_state.value if self.creation_time is not None: body['creation_time'] = self.creation_time @@ -505,7 +697,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NccAzurePrivateEndpointRule': + def from_dict(cls, d: Dict[str, any]) -> NccAzurePrivateEndpointRule: + """Deserializes the NccAzurePrivateEndpointRule from a dictionary.""" return cls(connection_state=_enum(d, 'connection_state', NccAzurePrivateEndpointRuleConnectionState), creation_time=d.get('creation_time', None), deactivated=d.get('deactivated', None), @@ -552,11 +745,18 @@ class NccAzureServiceEndpointRule: """The stable Azure service endpoints. You can configure the firewall of your Azure resources to allow traffic from your Databricks serverless compute resources.""" - subnets: Optional['List[str]'] = None + subnets: Optional[List[str]] = None + """The list of subnets from which Databricks network traffic originates when accessing your Azure + resources.""" + target_region: Optional[str] = None - target_services: Optional['List[str]'] = None + """The Azure region in which this service endpoint rule applies.""" + + target_services: Optional[List[str]] = None + """The Azure services to which this service endpoint rule applies to.""" def as_dict(self) -> dict: + """Serializes the NccAzureServiceEndpointRule into a dictionary suitable for use as a JSON request body.""" body = {} if self.subnets: body['subnets'] = [v for v in self.subnets] if self.target_region is not None: body['target_region'] = self.target_region @@ -564,7 +764,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NccAzureServiceEndpointRule': + def from_dict(cls, d: Dict[str, any]) -> NccAzureServiceEndpointRule: + """Deserializes the NccAzureServiceEndpointRule from a dictionary.""" return cls(subnets=d.get('subnets', None), target_region=d.get('target_region', None), target_services=d.get('target_services', None)) @@ -575,17 +776,25 @@ class NccEgressConfig: """The network connectivity rules that apply to network traffic from your serverless compute resources.""" - default_rules: Optional['NccEgressDefaultRules'] = None - target_rules: Optional['NccEgressTargetRules'] = None + default_rules: Optional[NccEgressDefaultRules] = None + """The network connectivity rules that are applied by default without resource specific + configurations. You can find the stable network information of your serverless compute resources + here.""" + + target_rules: Optional[NccEgressTargetRules] = None + """The network connectivity rules that configured for each destinations. These rules override + default rules.""" def as_dict(self) -> dict: + """Serializes the NccEgressConfig into a dictionary suitable for use as a JSON request body.""" body = {} if self.default_rules: body['default_rules'] = self.default_rules.as_dict() if self.target_rules: body['target_rules'] = self.target_rules.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NccEgressConfig': + def from_dict(cls, d: Dict[str, any]) -> NccEgressConfig: + """Deserializes the NccEgressConfig from a dictionary.""" return cls(default_rules=_from_dict(d, 'default_rules', NccEgressDefaultRules), target_rules=_from_dict(d, 'target_rules', NccEgressTargetRules)) @@ -596,16 +805,20 @@ class NccEgressDefaultRules: configurations. You can find the stable network information of your serverless compute resources here.""" - azure_service_endpoint_rule: Optional['NccAzureServiceEndpointRule'] = None + azure_service_endpoint_rule: Optional[NccAzureServiceEndpointRule] = None + """The stable Azure service endpoints. You can configure the firewall of your Azure resources to + allow traffic from your Databricks serverless compute resources.""" def as_dict(self) -> dict: + """Serializes the NccEgressDefaultRules into a dictionary suitable for use as a JSON request body.""" body = {} if self.azure_service_endpoint_rule: body['azure_service_endpoint_rule'] = self.azure_service_endpoint_rule.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NccEgressDefaultRules': + def from_dict(cls, d: Dict[str, any]) -> NccEgressDefaultRules: + """Deserializes the NccEgressDefaultRules from a dictionary.""" return cls(azure_service_endpoint_rule=_from_dict(d, 'azure_service_endpoint_rule', NccAzureServiceEndpointRule)) @@ -615,16 +828,18 @@ class NccEgressTargetRules: """The network connectivity rules that configured for each destinations. These rules override default rules.""" - azure_private_endpoint_rules: Optional['List[NccAzurePrivateEndpointRule]'] = None + azure_private_endpoint_rules: Optional[List[NccAzurePrivateEndpointRule]] = None def as_dict(self) -> dict: + """Serializes the NccEgressTargetRules into a dictionary suitable for use as a JSON request body.""" body = {} if self.azure_private_endpoint_rules: body['azure_private_endpoint_rules'] = [v.as_dict() for v in self.azure_private_endpoint_rules] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NccEgressTargetRules': + def from_dict(cls, d: Dict[str, any]) -> NccEgressTargetRules: + """Deserializes the NccEgressTargetRules from a dictionary.""" return cls(azure_private_endpoint_rules=_repeated_dict(d, 'azure_private_endpoint_rules', NccAzurePrivateEndpointRule)) @@ -632,14 +847,32 @@ def from_dict(cls, d: Dict[str, any]) -> 'NccEgressTargetRules': @dataclass class NetworkConnectivityConfiguration: account_id: Optional[str] = None + """The Databricks account ID that hosts the credential.""" + creation_time: Optional[int] = None - egress_config: Optional['NccEgressConfig'] = None + """Time in epoch milliseconds when this object was created.""" + + egress_config: Optional[NccEgressConfig] = None + """The network connectivity rules that apply to network traffic from your serverless compute + resources.""" + name: Optional[str] = None + """The name of the network connectivity configuration. The name can contain alphanumeric + characters, hyphens, and underscores. The length must be between 3 and 30 characters. The name + must match the regular expression `^[0-9a-zA-Z-_]{3,30}$`.""" + network_connectivity_config_id: Optional[str] = None + """Databricks network connectivity configuration ID.""" + region: Optional[str] = None + """The Azure region for this network connectivity configuration. Only workspaces in the same Azure + region can be attached to this network connectivity configuration.""" + updated_time: Optional[int] = None + """Time in epoch milliseconds when this object was updated.""" def as_dict(self) -> dict: + """Serializes the NetworkConnectivityConfiguration into a dictionary suitable for use as a JSON request body.""" body = {} if self.account_id is not None: body['account_id'] = self.account_id if self.creation_time is not None: body['creation_time'] = self.creation_time @@ -652,7 +885,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'NetworkConnectivityConfiguration': + def from_dict(cls, d: Dict[str, any]) -> NetworkConnectivityConfiguration: + """Deserializes the NetworkConnectivityConfiguration from a dictionary.""" return cls(account_id=d.get('account_id', None), creation_time=d.get('creation_time', None), egress_config=_from_dict(d, 'egress_config', NccEgressConfig), @@ -665,28 +899,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'NetworkConnectivityConfiguration': @dataclass class PartitionId: workspace_id: Optional[int] = None + """The ID of the workspace.""" def as_dict(self) -> dict: + """Serializes the PartitionId into a dictionary suitable for use as a JSON request body.""" body = {} if self.workspace_id is not None: body['workspaceId'] = self.workspace_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PartitionId': + def from_dict(cls, d: Dict[str, any]) -> PartitionId: + """Deserializes the PartitionId from a dictionary.""" return cls(workspace_id=d.get('workspaceId', None)) @dataclass class PersonalComputeMessage: - value: 'PersonalComputeMessageEnum' + value: PersonalComputeMessageEnum + """ON: Grants all users in all workspaces access to the Personal Compute default policy, allowing + all users to create single-machine compute resources. DELEGATE: Moves access control for the + Personal Compute default policy to individual workspaces and requires a workspace’s users or + groups to be added to the ACLs of that workspace’s Personal Compute default policy before they + will be able to create compute resources through that policy.""" def as_dict(self) -> dict: + """Serializes the PersonalComputeMessage into a dictionary suitable for use as a JSON request body.""" body = {} if self.value is not None: body['value'] = self.value.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PersonalComputeMessage': + def from_dict(cls, d: Dict[str, any]) -> PersonalComputeMessage: + """Deserializes the PersonalComputeMessage from a dictionary.""" return cls(value=_enum(d, 'value', PersonalComputeMessageEnum)) @@ -703,11 +947,23 @@ class PersonalComputeMessageEnum(Enum): @dataclass class PersonalComputeSetting: - personal_compute: 'PersonalComputeMessage' + personal_compute: PersonalComputeMessage + etag: Optional[str] = None + """etag used for versioning. The response is at least as fresh as the eTag provided. This is used + for optimistic concurrency control as a way to help prevent simultaneous writes of a setting + overwriting each other. It is strongly suggested that systems make use of the etag in the read + -> update pattern to perform setting updates in order to avoid race conditions. That is, get an + etag from a GET request, and pass it with the PATCH request to identify the setting version you + are updating.""" + setting_name: Optional[str] = None + """Name of the corresponding setting. This field is populated in the response, but it will not be + respected even if it's set in the request body. The setting name in the path parameter will be + respected instead.""" def as_dict(self) -> dict: + """Serializes the PersonalComputeSetting into a dictionary suitable for use as a JSON request body.""" body = {} if self.etag is not None: body['etag'] = self.etag if self.personal_compute: body['personal_compute'] = self.personal_compute.as_dict() @@ -715,7 +971,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PersonalComputeSetting': + def from_dict(cls, d: Dict[str, any]) -> PersonalComputeSetting: + """Deserializes the PersonalComputeSetting from a dictionary.""" return cls(etag=d.get('etag', None), personal_compute=_from_dict(d, 'personal_compute', PersonalComputeMessage), setting_name=d.get('setting_name', None)) @@ -724,11 +981,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'PersonalComputeSetting': @dataclass class PublicTokenInfo: comment: Optional[str] = None + """Comment the token was created with, if applicable.""" + creation_time: Optional[int] = None + """Server time (in epoch milliseconds) when the token was created.""" + expiry_time: Optional[int] = None + """Server time (in epoch milliseconds) when the token will expire, or -1 if not applicable.""" + token_id: Optional[str] = None + """The ID of this token.""" def as_dict(self) -> dict: + """Serializes the PublicTokenInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.creation_time is not None: body['creation_time'] = self.creation_time @@ -737,7 +1002,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PublicTokenInfo': + def from_dict(cls, d: Dict[str, any]) -> PublicTokenInfo: + """Deserializes the PublicTokenInfo from a dictionary.""" return cls(comment=d.get('comment', None), creation_time=d.get('creation_time', None), expiry_time=d.get('expiry_time', None), @@ -747,13 +1013,28 @@ def from_dict(cls, d: Dict[str, any]) -> 'PublicTokenInfo': @dataclass class ReplaceIpAccessList: label: str - list_type: 'ListType' - ip_addresses: 'List[str]' + """Label for the IP access list. This **cannot** be empty.""" + + list_type: ListType + """Type of IP access list. Valid values are as follows and are case-sensitive: + + * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or + range. IP addresses in the block list are excluded even if they are included in an allow list.""" + + ip_addresses: List[str] + """Array of IP addresses or CIDR values to be added to the IP access list.""" + enabled: bool + """Specifies whether this IP access list is enabled.""" + ip_access_list_id: Optional[str] = None + """The ID for the corresponding IP access list to modify.""" + list_id: Optional[str] = None + """Universally unique identifier (UUID) of the IP access list.""" def as_dict(self) -> dict: + """Serializes the ReplaceIpAccessList into a dictionary suitable for use as a JSON request body.""" body = {} if self.enabled is not None: body['enabled'] = self.enabled if self.ip_access_list_id is not None: body['ip_access_list_id'] = self.ip_access_list_id @@ -764,7 +1045,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ReplaceIpAccessList': + def from_dict(cls, d: Dict[str, any]) -> ReplaceIpAccessList: + """Deserializes the ReplaceIpAccessList from a dictionary.""" return cls(enabled=d.get('enabled', None), ip_access_list_id=d.get('ip_access_list_id', None), ip_addresses=d.get('ip_addresses', None), @@ -776,39 +1058,54 @@ def from_dict(cls, d: Dict[str, any]) -> 'ReplaceIpAccessList': @dataclass class RevokeTokenRequest: token_id: str + """The ID of the token to be revoked.""" def as_dict(self) -> dict: + """Serializes the RevokeTokenRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.token_id is not None: body['token_id'] = self.token_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RevokeTokenRequest': + def from_dict(cls, d: Dict[str, any]) -> RevokeTokenRequest: + """Deserializes the RevokeTokenRequest from a dictionary.""" return cls(token_id=d.get('token_id', None)) @dataclass class StringMessage: value: Optional[str] = None + """Represents a generic string value.""" def as_dict(self) -> dict: + """Serializes the StringMessage into a dictionary suitable for use as a JSON request body.""" body = {} if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StringMessage': + def from_dict(cls, d: Dict[str, any]) -> StringMessage: + """Deserializes the StringMessage from a dictionary.""" return cls(value=d.get('value', None)) @dataclass class TokenAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['TokenPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[TokenPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the TokenAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -818,7 +1115,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> TokenAccessControlRequest: + """Deserializes the TokenAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', TokenPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -827,13 +1125,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'TokenAccessControlRequest': @dataclass class TokenAccessControlResponse: - all_permissions: Optional['List[TokenPermission]'] = None + all_permissions: Optional[List[TokenPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the TokenAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -844,7 +1152,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> TokenAccessControlResponse: + """Deserializes the TokenAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', TokenPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -855,14 +1164,28 @@ def from_dict(cls, d: Dict[str, any]) -> 'TokenAccessControlResponse': @dataclass class TokenInfo: comment: Optional[str] = None + """Comment that describes the purpose of the token, specified by the token creator.""" + created_by_id: Optional[int] = None + """User ID of the user that created the token.""" + created_by_username: Optional[str] = None + """Username of the user that created the token.""" + creation_time: Optional[int] = None + """Timestamp when the token was created.""" + expiry_time: Optional[int] = None + """Timestamp when the token expires.""" + owner_id: Optional[int] = None + """User ID of the user that owns the token.""" + token_id: Optional[str] = None + """ID of the token.""" def as_dict(self) -> dict: + """Serializes the TokenInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.created_by_id is not None: body['created_by_id'] = self.created_by_id @@ -874,7 +1197,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenInfo': + def from_dict(cls, d: Dict[str, any]) -> TokenInfo: + """Deserializes the TokenInfo from a dictionary.""" return cls(comment=d.get('comment', None), created_by_id=d.get('created_by_id', None), created_by_username=d.get('created_by_username', None), @@ -887,10 +1211,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'TokenInfo': @dataclass class TokenPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['TokenPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[TokenPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the TokenPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -898,7 +1226,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenPermission': + def from_dict(cls, d: Dict[str, any]) -> TokenPermission: + """Deserializes the TokenPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', TokenPermissionLevel)) @@ -912,11 +1241,14 @@ class TokenPermissionLevel(Enum): @dataclass class TokenPermissions: - access_control_list: Optional['List[TokenAccessControlResponse]'] = None + access_control_list: Optional[List[TokenAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the TokenPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -925,7 +1257,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenPermissions': + def from_dict(cls, d: Dict[str, any]) -> TokenPermissions: + """Deserializes the TokenPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', TokenAccessControlResponse), object_id=d.get('object_id', None), object_type=d.get('object_type', None)) @@ -934,32 +1267,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'TokenPermissions': @dataclass class TokenPermissionsDescription: description: Optional[str] = None - permission_level: Optional['TokenPermissionLevel'] = None + + permission_level: Optional[TokenPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the TokenPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> TokenPermissionsDescription: + """Deserializes the TokenPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', TokenPermissionLevel)) @dataclass class TokenPermissionsRequest: - access_control_list: Optional['List[TokenAccessControlRequest]'] = None + access_control_list: Optional[List[TokenAccessControlRequest]] = None def as_dict(self) -> dict: + """Serializes the TokenPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TokenPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> TokenPermissionsRequest: + """Deserializes the TokenPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', TokenAccessControlRequest)) @@ -972,13 +1311,28 @@ class TokenType(Enum): @dataclass class UpdateIpAccessList: label: str - list_type: 'ListType' - ip_addresses: 'List[str]' + """Label for the IP access list. This **cannot** be empty.""" + + list_type: ListType + """Type of IP access list. Valid values are as follows and are case-sensitive: + + * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or + range. IP addresses in the block list are excluded even if they are included in an allow list.""" + + ip_addresses: List[str] + """Array of IP addresses or CIDR values to be added to the IP access list.""" + enabled: bool + """Specifies whether this IP access list is enabled.""" + ip_access_list_id: Optional[str] = None + """The ID for the corresponding IP access list to modify.""" + list_id: Optional[str] = None + """Universally unique identifier (UUID) of the IP access list.""" def as_dict(self) -> dict: + """Serializes the UpdateIpAccessList into a dictionary suitable for use as a JSON request body.""" body = {} if self.enabled is not None: body['enabled'] = self.enabled if self.ip_access_list_id is not None: body['ip_access_list_id'] = self.ip_access_list_id @@ -989,7 +1343,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateIpAccessList': + def from_dict(cls, d: Dict[str, any]) -> UpdateIpAccessList: + """Deserializes the UpdateIpAccessList from a dictionary.""" return cls(enabled=d.get('enabled', None), ip_access_list_id=d.get('ip_access_list_id', None), ip_addresses=d.get('ip_addresses', None), @@ -1097,7 +1452,7 @@ def get(self, ip_access_list_id: str) -> GetIpAccessListResponse: headers=headers) return GetIpAccessListResponse.from_dict(res) - def list(self) -> Iterator['IpAccessListInfo']: + def list(self) -> Iterator[IpAccessListInfo]: """Get access lists. Gets all IP access lists for the specified account. @@ -1516,7 +1871,7 @@ def get(self, ip_access_list_id: str) -> FetchIpAccessListResponse: res = self._api.do('GET', f'/api/2.0/ip-access-lists/{ip_access_list_id}', headers=headers) return FetchIpAccessListResponse.from_dict(res) - def list(self) -> Iterator['IpAccessListInfo']: + def list(self) -> Iterator[IpAccessListInfo]: """Get access lists. Gets all IP access lists for the specified workspace. @@ -1798,7 +2153,7 @@ def get_private_endpoint_rule(self, network_connectivity_config_id: str, def list_network_connectivity_configurations(self, *, page_token: Optional[str] = None - ) -> Iterator['NetworkConnectivityConfiguration']: + ) -> Iterator[NetworkConnectivityConfiguration]: """List network connectivity configurations. Gets an array of network connectivity configurations. @@ -1830,7 +2185,7 @@ def list_private_endpoint_rules( self, network_connectivity_config_id: str, *, - page_token: Optional[str] = None) -> Iterator['NccAzurePrivateEndpointRule']: + page_token: Optional[str] = None) -> Iterator[NccAzurePrivateEndpointRule]: """List private endpoint rules. Gets an array of private endpoint rules. @@ -2069,7 +2424,7 @@ def get_permissions(self) -> TokenPermissions: def list(self, *, created_by_id: Optional[str] = None, - created_by_username: Optional[str] = None) -> Iterator['TokenInfo']: + created_by_username: Optional[str] = None) -> Iterator[TokenInfo]: """List all tokens. Lists all tokens associated with the specified workspace or user. @@ -2179,7 +2534,7 @@ def delete(self, token_id: str): headers = {'Accept': 'application/json', 'Content-Type': 'application/json', } self._api.do('POST', '/api/2.0/token/delete', body=body, headers=headers) - def list(self) -> Iterator['TokenInfo']: + def list(self) -> Iterator[TokenInfo]: """List tokens. Lists all the valid tokens for a user-workspace pair. diff --git a/databricks/sdk/service/sharing.py b/databricks/sdk/service/sharing.py index b6d6f24e0..fb53a510f 100755 --- a/databricks/sdk/service/sharing.py +++ b/databricks/sdk/service/sharing.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -23,13 +25,24 @@ class AuthenticationType(Enum): @dataclass class CentralCleanRoomInfo: - clean_room_assets: Optional['List[CleanRoomAssetInfo]'] = None - collaborators: Optional['List[CleanRoomCollaboratorInfo]'] = None - creator: Optional['CleanRoomCollaboratorInfo'] = None + clean_room_assets: Optional[List[CleanRoomAssetInfo]] = None + """All assets from all collaborators that are available in the clean room. Only one of table_info + or notebook_info will be filled in.""" + + collaborators: Optional[List[CleanRoomCollaboratorInfo]] = None + """All collaborators who are in the clean room.""" + + creator: Optional[CleanRoomCollaboratorInfo] = None + """The collaborator who created the clean room.""" + station_cloud: Optional[str] = None + """The cloud where clean room tasks will be run.""" + station_region: Optional[str] = None + """The region where clean room tasks will be run.""" def as_dict(self) -> dict: + """Serializes the CentralCleanRoomInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.clean_room_assets: body['clean_room_assets'] = [v.as_dict() for v in self.clean_room_assets] if self.collaborators: body['collaborators'] = [v.as_dict() for v in self.collaborators] @@ -39,7 +52,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CentralCleanRoomInfo': + def from_dict(cls, d: Dict[str, any]) -> CentralCleanRoomInfo: + """Deserializes the CentralCleanRoomInfo from a dictionary.""" return cls(clean_room_assets=_repeated_dict(d, 'clean_room_assets', CleanRoomAssetInfo), collaborators=_repeated_dict(d, 'collaborators', CleanRoomCollaboratorInfo), creator=_from_dict(d, 'creator', CleanRoomCollaboratorInfo), @@ -50,12 +64,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CentralCleanRoomInfo': @dataclass class CleanRoomAssetInfo: added_at: Optional[int] = None - notebook_info: Optional['CleanRoomNotebookInfo'] = None - owner: Optional['CleanRoomCollaboratorInfo'] = None - table_info: Optional['CleanRoomTableInfo'] = None + """Time at which this asset was added, in epoch milliseconds.""" + + notebook_info: Optional[CleanRoomNotebookInfo] = None + """Details about the notebook asset.""" + + owner: Optional[CleanRoomCollaboratorInfo] = None + """The collaborator who owns the asset.""" + + table_info: Optional[CleanRoomTableInfo] = None + """Details about the table asset.""" + updated_at: Optional[int] = None + """Time at which this asset was updated, in epoch milliseconds.""" def as_dict(self) -> dict: + """Serializes the CleanRoomAssetInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.added_at is not None: body['added_at'] = self.added_at if self.notebook_info: body['notebook_info'] = self.notebook_info.as_dict() @@ -65,7 +89,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomAssetInfo': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomAssetInfo: + """Deserializes the CleanRoomAssetInfo from a dictionary.""" return cls(added_at=d.get('added_at', None), notebook_info=_from_dict(d, 'notebook_info', CleanRoomNotebookInfo), owner=_from_dict(d, 'owner', CleanRoomCollaboratorInfo), @@ -76,10 +101,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomAssetInfo': @dataclass class CleanRoomCatalog: catalog_name: Optional[str] = None - notebook_files: Optional['List[SharedDataObject]'] = None - tables: Optional['List[SharedDataObject]'] = None + """Name of the catalog in the clean room station. Empty for notebooks.""" + + notebook_files: Optional[List[SharedDataObject]] = None + """The details of the shared notebook files.""" + + tables: Optional[List[SharedDataObject]] = None + """The details of the shared tables.""" def as_dict(self) -> dict: + """Serializes the CleanRoomCatalog into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.notebook_files: body['notebook_files'] = [v.as_dict() for v in self.notebook_files] @@ -87,7 +118,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomCatalog': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomCatalog: + """Deserializes the CleanRoomCatalog from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), notebook_files=_repeated_dict(d, 'notebook_files', SharedDataObject), tables=_repeated_dict(d, 'tables', SharedDataObject)) @@ -96,16 +128,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomCatalog': @dataclass class CleanRoomCatalogUpdate: catalog_name: Optional[str] = None - updates: Optional['SharedDataObjectUpdate'] = None + """The name of the catalog to update assets.""" + + updates: Optional[SharedDataObjectUpdate] = None + """The updates to the assets in the catalog.""" def as_dict(self) -> dict: + """Serializes the CleanRoomCatalogUpdate into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.updates: body['updates'] = self.updates.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomCatalogUpdate': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomCatalogUpdate: + """Deserializes the CleanRoomCatalogUpdate from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), updates=_from_dict(d, 'updates', SharedDataObjectUpdate)) @@ -113,16 +150,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomCatalogUpdate': @dataclass class CleanRoomCollaboratorInfo: global_metastore_id: Optional[str] = None + """The global Unity Catalog metastore id of the collaborator. Also known as the sharing identifier. + The identifier is of format __cloud__:__region__:__metastore-uuid__.""" + organization_name: Optional[str] = None + """The organization name of the collaborator. This is configured in the metastore for Delta Sharing + and is used to identify the organization to other collaborators.""" def as_dict(self) -> dict: + """Serializes the CleanRoomCollaboratorInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.global_metastore_id is not None: body['global_metastore_id'] = self.global_metastore_id if self.organization_name is not None: body['organization_name'] = self.organization_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomCollaboratorInfo': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomCollaboratorInfo: + """Deserializes the CleanRoomCollaboratorInfo from a dictionary.""" return cls(global_metastore_id=d.get('global_metastore_id', None), organization_name=d.get('organization_name', None)) @@ -130,16 +174,34 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomCollaboratorInfo': @dataclass class CleanRoomInfo: comment: Optional[str] = None + """User-provided free-form text description.""" + created_at: Optional[int] = None + """Time at which this clean room was created, in epoch milliseconds.""" + created_by: Optional[str] = None - local_catalogs: Optional['List[CleanRoomCatalog]'] = None + """Username of clean room creator.""" + + local_catalogs: Optional[List[CleanRoomCatalog]] = None + """Catalog aliases shared by the current collaborator with asset details.""" + name: Optional[str] = None + """Name of the clean room.""" + owner: Optional[str] = None - remote_detailed_info: Optional['CentralCleanRoomInfo'] = None + """Username of current owner of clean room.""" + + remote_detailed_info: Optional[CentralCleanRoomInfo] = None + """Central clean room details.""" + updated_at: Optional[int] = None + """Time at which this clean room was updated, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of clean room updater.""" def as_dict(self) -> dict: + """Serializes the CleanRoomInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.created_at is not None: body['created_at'] = self.created_at @@ -153,7 +215,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomInfo': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomInfo: + """Deserializes the CleanRoomInfo from a dictionary.""" return cls(comment=d.get('comment', None), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -168,16 +231,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomInfo': @dataclass class CleanRoomNotebookInfo: notebook_content: Optional[str] = None + """The base64 representation of the notebook content in HTML.""" + notebook_name: Optional[str] = None + """The name of the notebook.""" def as_dict(self) -> dict: + """Serializes the CleanRoomNotebookInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.notebook_content is not None: body['notebook_content'] = self.notebook_content if self.notebook_name is not None: body['notebook_name'] = self.notebook_name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomNotebookInfo': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomNotebookInfo: + """Deserializes the CleanRoomNotebookInfo from a dictionary.""" return cls(notebook_content=d.get('notebook_content', None), notebook_name=d.get('notebook_name', None)) @@ -185,12 +253,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomNotebookInfo': @dataclass class CleanRoomTableInfo: catalog_name: Optional[str] = None - columns: Optional['List[ColumnInfo]'] = None + """Name of parent catalog.""" + + columns: Optional[List[ColumnInfo]] = None + """The array of __ColumnInfo__ definitions of the table's columns.""" + full_name: Optional[str] = None + """Full name of table, in form of __catalog_name__.__schema_name__.__table_name__""" + name: Optional[str] = None + """Name of table, relative to parent schema.""" + schema_name: Optional[str] = None + """Name of parent schema relative to its parent catalog.""" def as_dict(self) -> dict: + """Serializes the CleanRoomTableInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_name is not None: body['catalog_name'] = self.catalog_name if self.columns: body['columns'] = [v.as_dict() for v in self.columns] @@ -200,7 +278,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomTableInfo': + def from_dict(cls, d: Dict[str, any]) -> CleanRoomTableInfo: + """Deserializes the CleanRoomTableInfo from a dictionary.""" return cls(catalog_name=d.get('catalog_name', None), columns=_repeated_dict(d, 'columns', ColumnInfo), full_name=d.get('full_name', None), @@ -211,19 +290,42 @@ def from_dict(cls, d: Dict[str, any]) -> 'CleanRoomTableInfo': @dataclass class ColumnInfo: comment: Optional[str] = None - mask: Optional['ColumnMask'] = None + """User-provided free-form text description.""" + + mask: Optional[ColumnMask] = None + name: Optional[str] = None + """Name of Column.""" + nullable: Optional[bool] = None + """Whether field may be Null (default: true).""" + partition_index: Optional[int] = None + """Partition index for column.""" + position: Optional[int] = None + """Ordinal position of column (starting at position 0).""" + type_interval_type: Optional[str] = None + """Format of IntervalType.""" + type_json: Optional[str] = None - type_name: Optional['ColumnTypeName'] = None + """Full data type specification, JSON-serialized.""" + + type_name: Optional[ColumnTypeName] = None + """Name of type (INT, STRUCT, MAP, etc.).""" + type_precision: Optional[int] = None + """Digits of precision; required for DecimalTypes.""" + type_scale: Optional[int] = None + """Digits to right of decimal; Required for DecimalTypes.""" + type_text: Optional[str] = None + """Full data type specification as SQL/catalogString text.""" def as_dict(self) -> dict: + """Serializes the ColumnInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.mask: body['mask'] = self.mask.as_dict() @@ -240,7 +342,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ColumnInfo': + def from_dict(cls, d: Dict[str, any]) -> ColumnInfo: + """Deserializes the ColumnInfo from a dictionary.""" return cls(comment=d.get('comment', None), mask=_from_dict(d, 'mask', ColumnMask), name=d.get('name', None), @@ -258,16 +361,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'ColumnInfo': @dataclass class ColumnMask: function_name: Optional[str] = None - using_column_names: Optional['List[str]'] = None + """The full name of the column mask SQL UDF.""" + + using_column_names: Optional[List[str]] = None + """The list of additional table columns to be passed as input to the column mask function. The + first arg of the mask function should be of the type of the column being masked and the types of + the rest of the args should match the types of columns in 'using_column_names'.""" def as_dict(self) -> dict: + """Serializes the ColumnMask into a dictionary suitable for use as a JSON request body.""" body = {} if self.function_name is not None: body['function_name'] = self.function_name if self.using_column_names: body['using_column_names'] = [v for v in self.using_column_names] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ColumnMask': + def from_dict(cls, d: Dict[str, any]) -> ColumnMask: + """Deserializes the ColumnMask from a dictionary.""" return cls(function_name=d.get('function_name', None), using_column_names=d.get('using_column_names', None)) @@ -301,10 +411,16 @@ class ColumnTypeName(Enum): @dataclass class CreateCleanRoom: name: str - remote_detailed_info: 'CentralCleanRoomInfo' + """Name of the clean room.""" + + remote_detailed_info: CentralCleanRoomInfo + """Central clean room details.""" + comment: Optional[str] = None + """User-provided free-form text description.""" def as_dict(self) -> dict: + """Serializes the CreateCleanRoom into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -312,7 +428,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCleanRoom': + def from_dict(cls, d: Dict[str, any]) -> CreateCleanRoom: + """Deserializes the CreateCleanRoom from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), remote_detailed_info=_from_dict(d, 'remote_detailed_info', CentralCleanRoomInfo)) @@ -321,11 +438,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCleanRoom': @dataclass class CreateProvider: name: str - authentication_type: 'AuthenticationType' + """The name of the Provider.""" + + authentication_type: AuthenticationType + """The delta sharing authentication type.""" + comment: Optional[str] = None + """Description about the provider.""" + recipient_profile_str: Optional[str] = None + """This field is required when the __authentication_type__ is **TOKEN** or not provided.""" def as_dict(self) -> dict: + """Serializes the CreateProvider into a dictionary suitable for use as a JSON request body.""" body = {} if self.authentication_type is not None: body['authentication_type'] = self.authentication_type.value if self.comment is not None: body['comment'] = self.comment @@ -334,7 +459,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateProvider': + def from_dict(cls, d: Dict[str, any]) -> CreateProvider: + """Deserializes the CreateProvider from a dictionary.""" return cls(authentication_type=_enum(d, 'authentication_type', AuthenticationType), comment=d.get('comment', None), name=d.get('name', None), @@ -344,15 +470,34 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateProvider': @dataclass class CreateRecipient: name: str - authentication_type: 'AuthenticationType' + """Name of Recipient.""" + + authentication_type: AuthenticationType + """The delta sharing authentication type.""" + comment: Optional[str] = None + """Description about the recipient.""" + data_recipient_global_metastore_id: Optional[str] = None - ip_access_list: Optional['IpAccessList'] = None + """The global Unity Catalog metastore id provided by the data recipient. This field is required + when the __authentication_type__ is **DATABRICKS**. The identifier is of format + __cloud__:__region__:__metastore-uuid__.""" + + ip_access_list: Optional[IpAccessList] = None + """IP Access List""" + owner: Optional[str] = None - properties_kvpairs: Optional['SecurablePropertiesKvPairs'] = None + """Username of the recipient owner.""" + + properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None + """Recipient properties as map of string key-value pairs.""" + sharing_code: Optional[str] = None + """The one-time sharing code provided by the data recipient. This field is required when the + __authentication_type__ is **DATABRICKS**.""" def as_dict(self) -> dict: + """Serializes the CreateRecipient into a dictionary suitable for use as a JSON request body.""" body = {} if self.authentication_type is not None: body['authentication_type'] = self.authentication_type.value if self.comment is not None: body['comment'] = self.comment @@ -366,7 +511,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateRecipient': + def from_dict(cls, d: Dict[str, any]) -> CreateRecipient: + """Deserializes the CreateRecipient from a dictionary.""" return cls(authentication_type=_enum(d, 'authentication_type', AuthenticationType), comment=d.get('comment', None), data_recipient_global_metastore_id=d.get('data_recipient_global_metastore_id', None), @@ -380,142 +526,183 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateRecipient': @dataclass class CreateShare: name: str + """Name of the share.""" + comment: Optional[str] = None + """User-provided free-form text description.""" def as_dict(self) -> dict: + """Serializes the CreateShare into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateShare': + def from_dict(cls, d: Dict[str, any]) -> CreateShare: + """Deserializes the CreateShare from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None)) @dataclass class GetRecipientSharePermissionsResponse: - permissions_out: Optional['List[ShareToPrivilegeAssignment]'] = None + permissions_out: Optional[List[ShareToPrivilegeAssignment]] = None + """An array of data share permissions for a recipient.""" def as_dict(self) -> dict: + """Serializes the GetRecipientSharePermissionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permissions_out: body['permissions_out'] = [v.as_dict() for v in self.permissions_out] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetRecipientSharePermissionsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetRecipientSharePermissionsResponse: + """Deserializes the GetRecipientSharePermissionsResponse from a dictionary.""" return cls(permissions_out=_repeated_dict(d, 'permissions_out', ShareToPrivilegeAssignment)) @dataclass class IpAccessList: - allowed_ip_addresses: Optional['List[str]'] = None + allowed_ip_addresses: Optional[List[str]] = None + """Allowed IP Addresses in CIDR notation. Limit of 100.""" def as_dict(self) -> dict: + """Serializes the IpAccessList into a dictionary suitable for use as a JSON request body.""" body = {} if self.allowed_ip_addresses: body['allowed_ip_addresses'] = [v for v in self.allowed_ip_addresses] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'IpAccessList': + def from_dict(cls, d: Dict[str, any]) -> IpAccessList: + """Deserializes the IpAccessList from a dictionary.""" return cls(allowed_ip_addresses=d.get('allowed_ip_addresses', None)) @dataclass class ListCleanRoomsResponse: - clean_rooms: Optional['List[CleanRoomInfo]'] = None + clean_rooms: Optional[List[CleanRoomInfo]] = None + """An array of clean rooms. Remote details (central) are not included.""" + next_page_token: Optional[str] = None + """Token to retrieve the next page of results. Absent if there are no more pages.""" def as_dict(self) -> dict: + """Serializes the ListCleanRoomsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.clean_rooms: body['clean_rooms'] = [v.as_dict() for v in self.clean_rooms] if self.next_page_token is not None: body['next_page_token'] = self.next_page_token return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListCleanRoomsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListCleanRoomsResponse: + """Deserializes the ListCleanRoomsResponse from a dictionary.""" return cls(clean_rooms=_repeated_dict(d, 'clean_rooms', CleanRoomInfo), next_page_token=d.get('next_page_token', None)) @dataclass class ListProviderSharesResponse: - shares: Optional['List[ProviderShare]'] = None + shares: Optional[List[ProviderShare]] = None + """An array of provider shares.""" def as_dict(self) -> dict: + """Serializes the ListProviderSharesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.shares: body['shares'] = [v.as_dict() for v in self.shares] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListProviderSharesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListProviderSharesResponse: + """Deserializes the ListProviderSharesResponse from a dictionary.""" return cls(shares=_repeated_dict(d, 'shares', ProviderShare)) @dataclass class ListProvidersResponse: - providers: Optional['List[ProviderInfo]'] = None + providers: Optional[List[ProviderInfo]] = None + """An array of provider information objects.""" def as_dict(self) -> dict: + """Serializes the ListProvidersResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.providers: body['providers'] = [v.as_dict() for v in self.providers] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListProvidersResponse': + def from_dict(cls, d: Dict[str, any]) -> ListProvidersResponse: + """Deserializes the ListProvidersResponse from a dictionary.""" return cls(providers=_repeated_dict(d, 'providers', ProviderInfo)) @dataclass class ListRecipientsResponse: - recipients: Optional['List[RecipientInfo]'] = None + recipients: Optional[List[RecipientInfo]] = None + """An array of recipient information objects.""" def as_dict(self) -> dict: + """Serializes the ListRecipientsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.recipients: body['recipients'] = [v.as_dict() for v in self.recipients] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListRecipientsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListRecipientsResponse: + """Deserializes the ListRecipientsResponse from a dictionary.""" return cls(recipients=_repeated_dict(d, 'recipients', RecipientInfo)) @dataclass class ListSharesResponse: - shares: Optional['List[ShareInfo]'] = None + shares: Optional[List[ShareInfo]] = None + """An array of data share information objects.""" def as_dict(self) -> dict: + """Serializes the ListSharesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.shares: body['shares'] = [v.as_dict() for v in self.shares] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListSharesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListSharesResponse: + """Deserializes the ListSharesResponse from a dictionary.""" return cls(shares=_repeated_dict(d, 'shares', ShareInfo)) @dataclass class Partition: - values: Optional['List[PartitionValue]'] = None + values: Optional[List[PartitionValue]] = None + """An array of partition values.""" def as_dict(self) -> dict: + """Serializes the Partition into a dictionary suitable for use as a JSON request body.""" body = {} if self.values: body['values'] = [v.as_dict() for v in self.values] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Partition': + def from_dict(cls, d: Dict[str, any]) -> Partition: + """Deserializes the Partition from a dictionary.""" return cls(values=_repeated_dict(d, 'values', PartitionValue)) @dataclass class PartitionValue: name: Optional[str] = None - op: Optional['PartitionValueOp'] = None + """The name of the partition column.""" + + op: Optional[PartitionValueOp] = None + """The operator to apply for the value.""" + recipient_property_key: Optional[str] = None + """The key of a Delta Sharing recipient's property. For example `databricks-account-id`. When this + field is set, field `value` can not be set.""" + value: Optional[str] = None + """The value of the partition column. When this value is not set, it means `null` value. When this + field is set, field `recipient_property_key` can not be set.""" def as_dict(self) -> dict: + """Serializes the PartitionValue into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.op is not None: body['op'] = self.op.value @@ -525,7 +712,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PartitionValue': + def from_dict(cls, d: Dict[str, any]) -> PartitionValue: + """Deserializes the PartitionValue from a dictionary.""" return cls(name=d.get('name', None), op=_enum(d, 'op', PartitionValueOp), recipient_property_key=d.get('recipient_property_key', None), @@ -587,37 +775,75 @@ class Privilege(Enum): @dataclass class PrivilegeAssignment: principal: Optional[str] = None - privileges: Optional['List[Privilege]'] = None + """The principal (user email address or group name).""" + + privileges: Optional[List[Privilege]] = None + """The privileges assigned to the principal.""" def as_dict(self) -> dict: + """Serializes the PrivilegeAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.principal is not None: body['principal'] = self.principal if self.privileges: body['privileges'] = [v.value for v in self.privileges] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PrivilegeAssignment': + def from_dict(cls, d: Dict[str, any]) -> PrivilegeAssignment: + """Deserializes the PrivilegeAssignment from a dictionary.""" return cls(principal=d.get('principal', None), privileges=_repeated_enum(d, 'privileges', Privilege)) @dataclass class ProviderInfo: - authentication_type: Optional['AuthenticationType'] = None + authentication_type: Optional[AuthenticationType] = None + """The delta sharing authentication type.""" + cloud: Optional[str] = None + """Cloud vendor of the provider's UC metastore. This field is only present when the + __authentication_type__ is **DATABRICKS**.""" + comment: Optional[str] = None + """Description about the provider.""" + created_at: Optional[int] = None + """Time at which this Provider was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of Provider creator.""" + data_provider_global_metastore_id: Optional[str] = None + """The global UC metastore id of the data provider. This field is only present when the + __authentication_type__ is **DATABRICKS**. The identifier is of format + ::.""" + metastore_id: Optional[str] = None + """UUID of the provider's UC metastore. This field is only present when the __authentication_type__ + is **DATABRICKS**.""" + name: Optional[str] = None + """The name of the Provider.""" + owner: Optional[str] = None - recipient_profile: Optional['RecipientProfile'] = None + """Username of Provider owner.""" + + recipient_profile: Optional[RecipientProfile] = None + """The recipient profile. This field is only present when the authentication_type is `TOKEN`.""" + recipient_profile_str: Optional[str] = None + """This field is only present when the authentication_type is `TOKEN` or not provided.""" + region: Optional[str] = None + """Cloud region of the provider's UC metastore. This field is only present when the + __authentication_type__ is **DATABRICKS**.""" + updated_at: Optional[int] = None + """Time at which this Provider was created, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of user who last modified Share.""" def as_dict(self) -> dict: + """Serializes the ProviderInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.authentication_type is not None: body['authentication_type'] = self.authentication_type.value if self.cloud is not None: body['cloud'] = self.cloud @@ -637,7 +863,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ProviderInfo': + def from_dict(cls, d: Dict[str, any]) -> ProviderInfo: + """Deserializes the ProviderInfo from a dictionary.""" return cls(authentication_type=_enum(d, 'authentication_type', AuthenticationType), cloud=d.get('cloud', None), comment=d.get('comment', None), @@ -657,39 +884,85 @@ def from_dict(cls, d: Dict[str, any]) -> 'ProviderInfo': @dataclass class ProviderShare: name: Optional[str] = None + """The name of the Provider Share.""" def as_dict(self) -> dict: + """Serializes the ProviderShare into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ProviderShare': + def from_dict(cls, d: Dict[str, any]) -> ProviderShare: + """Deserializes the ProviderShare from a dictionary.""" return cls(name=d.get('name', None)) @dataclass class RecipientInfo: activated: Optional[bool] = None + """A boolean status field showing whether the Recipient's activation URL has been exercised or not.""" + activation_url: Optional[str] = None - authentication_type: Optional['AuthenticationType'] = None + """Full activation url to retrieve the access token. It will be empty if the token is already + retrieved.""" + + authentication_type: Optional[AuthenticationType] = None + """The delta sharing authentication type.""" + cloud: Optional[str] = None + """Cloud vendor of the recipient's Unity Catalog Metstore. This field is only present when the + __authentication_type__ is **DATABRICKS**`.""" + comment: Optional[str] = None + """Description about the recipient.""" + created_at: Optional[int] = None + """Time at which this recipient was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of recipient creator.""" + data_recipient_global_metastore_id: Optional[str] = None - ip_access_list: Optional['IpAccessList'] = None + """The global Unity Catalog metastore id provided by the data recipient. This field is only present + when the __authentication_type__ is **DATABRICKS**. The identifier is of format + __cloud__:__region__:__metastore-uuid__.""" + + ip_access_list: Optional[IpAccessList] = None + """IP Access List""" + metastore_id: Optional[str] = None + """Unique identifier of recipient's Unity Catalog metastore. This field is only present when the + __authentication_type__ is **DATABRICKS**""" + name: Optional[str] = None + """Name of Recipient.""" + owner: Optional[str] = None - properties_kvpairs: Optional['SecurablePropertiesKvPairs'] = None + """Username of the recipient owner.""" + + properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None + """Recipient properties as map of string key-value pairs.""" + region: Optional[str] = None + """Cloud region of the recipient's Unity Catalog Metstore. This field is only present when the + __authentication_type__ is **DATABRICKS**.""" + sharing_code: Optional[str] = None - tokens: Optional['List[RecipientTokenInfo]'] = None + """The one-time sharing code provided by the data recipient. This field is only present when the + __authentication_type__ is **DATABRICKS**.""" + + tokens: Optional[List[RecipientTokenInfo]] = None + """This field is only present when the __authentication_type__ is **TOKEN**.""" + updated_at: Optional[int] = None + """Time at which the recipient was updated, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of recipient updater.""" def as_dict(self) -> dict: + """Serializes the RecipientInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.activated is not None: body['activated'] = self.activated if self.activation_url is not None: body['activation_url'] = self.activation_url @@ -713,7 +986,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RecipientInfo': + def from_dict(cls, d: Dict[str, any]) -> RecipientInfo: + """Deserializes the RecipientInfo from a dictionary.""" return cls(activated=d.get('activated', None), activation_url=d.get('activation_url', None), authentication_type=_enum(d, 'authentication_type', AuthenticationType), @@ -737,10 +1011,16 @@ def from_dict(cls, d: Dict[str, any]) -> 'RecipientInfo': @dataclass class RecipientProfile: bearer_token: Optional[str] = None + """The token used to authorize the recipient.""" + endpoint: Optional[str] = None + """The endpoint for the share to be used by the recipient.""" + share_credentials_version: Optional[int] = None + """The version number of the recipient's credentials on a share.""" def as_dict(self) -> dict: + """Serializes the RecipientProfile into a dictionary suitable for use as a JSON request body.""" body = {} if self.bearer_token is not None: body['bearer_token'] = self.bearer_token if self.endpoint is not None: body['endpoint'] = self.endpoint @@ -749,7 +1029,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RecipientProfile': + def from_dict(cls, d: Dict[str, any]) -> RecipientProfile: + """Deserializes the RecipientProfile from a dictionary.""" return cls(bearer_token=d.get('bearer_token', None), endpoint=d.get('endpoint', None), share_credentials_version=d.get('share_credentials_version', None)) @@ -758,14 +1039,29 @@ def from_dict(cls, d: Dict[str, any]) -> 'RecipientProfile': @dataclass class RecipientTokenInfo: activation_url: Optional[str] = None + """Full activation URL to retrieve the access token. It will be empty if the token is already + retrieved.""" + created_at: Optional[int] = None + """Time at which this recipient Token was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of recipient token creator.""" + expiration_time: Optional[int] = None + """Expiration timestamp of the token in epoch milliseconds.""" + id: Optional[str] = None + """Unique ID of the recipient token.""" + updated_at: Optional[int] = None + """Time at which this recipient Token was updated, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of recipient Token updater.""" def as_dict(self) -> dict: + """Serializes the RecipientTokenInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.activation_url is not None: body['activation_url'] = self.activation_url if self.created_at is not None: body['created_at'] = self.created_at @@ -777,7 +1073,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RecipientTokenInfo': + def from_dict(cls, d: Dict[str, any]) -> RecipientTokenInfo: + """Deserializes the RecipientTokenInfo from a dictionary.""" return cls(activation_url=d.get('activation_url', None), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -790,11 +1087,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'RecipientTokenInfo': @dataclass class RetrieveTokenResponse: bearer_token: Optional[str] = None + """The token used to authorize the recipient.""" + endpoint: Optional[str] = None + """The endpoint for the share to be used by the recipient.""" + expiration_time: Optional[str] = None + """Expiration timestamp of the token in epoch milliseconds.""" + share_credentials_version: Optional[int] = None + """These field names must follow the delta sharing protocol.""" def as_dict(self) -> dict: + """Serializes the RetrieveTokenResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.bearer_token is not None: body['bearerToken'] = self.bearer_token if self.endpoint is not None: body['endpoint'] = self.endpoint @@ -804,7 +1109,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RetrieveTokenResponse': + def from_dict(cls, d: Dict[str, any]) -> RetrieveTokenResponse: + """Deserializes the RetrieveTokenResponse from a dictionary.""" return cls(bearer_token=d.get('bearerToken', None), endpoint=d.get('endpoint', None), expiration_time=d.get('expirationTime', None), @@ -814,9 +1120,15 @@ def from_dict(cls, d: Dict[str, any]) -> 'RetrieveTokenResponse': @dataclass class RotateRecipientToken: existing_token_expire_in_seconds: int + """The expiration time of the bearer token in ISO 8601 format. This will set the expiration_time of + existing token only to a smaller timestamp, it cannot extend the expiration_time. Use 0 to + expire the existing token immediately, negative number will return an error.""" + name: Optional[str] = None + """The name of the recipient.""" def as_dict(self) -> dict: + """Serializes the RotateRecipientToken into a dictionary suitable for use as a JSON request body.""" body = {} if self.existing_token_expire_in_seconds is not None: body['existing_token_expire_in_seconds'] = self.existing_token_expire_in_seconds @@ -824,7 +1136,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RotateRecipientToken': + def from_dict(cls, d: Dict[str, any]) -> RotateRecipientToken: + """Deserializes the RotateRecipientToken from a dictionary.""" return cls(existing_token_expire_in_seconds=d.get('existing_token_expire_in_seconds', None), name=d.get('name', None)) @@ -833,15 +1146,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'RotateRecipientToken': class SecurablePropertiesKvPairs: """An object with __properties__ containing map of key-value properties attached to the securable.""" - properties: 'Dict[str,str]' + properties: Dict[str, str] + """A map of key-value properties attached to the securable.""" def as_dict(self) -> dict: + """Serializes the SecurablePropertiesKvPairs into a dictionary suitable for use as a JSON request body.""" body = {} if self.properties: body['properties'] = self.properties return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SecurablePropertiesKvPairs': + def from_dict(cls, d: Dict[str, any]) -> SecurablePropertiesKvPairs: + """Deserializes the SecurablePropertiesKvPairs from a dictionary.""" return cls(properties=d.get('properties', None)) @@ -851,15 +1167,31 @@ def from_dict(cls, d: Dict[str, any]) -> 'SecurablePropertiesKvPairs': @dataclass class ShareInfo: comment: Optional[str] = None + """User-provided free-form text description.""" + created_at: Optional[int] = None + """Time at which this share was created, in epoch milliseconds.""" + created_by: Optional[str] = None + """Username of share creator.""" + name: Optional[str] = None - objects: Optional['List[SharedDataObject]'] = None + """Name of the share.""" + + objects: Optional[List[SharedDataObject]] = None + """A list of shared data objects within the share.""" + owner: Optional[str] = None + """Username of current owner of share.""" + updated_at: Optional[int] = None + """Time at which this share was updated, in epoch milliseconds.""" + updated_by: Optional[str] = None + """Username of share updater.""" def as_dict(self) -> dict: + """Serializes the ShareInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.created_at is not None: body['created_at'] = self.created_at @@ -872,7 +1204,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ShareInfo': + def from_dict(cls, d: Dict[str, any]) -> ShareInfo: + """Deserializes the ShareInfo from a dictionary.""" return cls(comment=d.get('comment', None), created_at=d.get('created_at', None), created_by=d.get('created_by', None), @@ -885,10 +1218,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'ShareInfo': @dataclass class ShareToPrivilegeAssignment: - privilege_assignments: Optional['List[PrivilegeAssignment]'] = None + privilege_assignments: Optional[List[PrivilegeAssignment]] = None + """The privileges assigned to the principal.""" + share_name: Optional[str] = None + """The share name.""" def as_dict(self) -> dict: + """Serializes the ShareToPrivilegeAssignment into a dictionary suitable for use as a JSON request body.""" body = {} if self.privilege_assignments: body['privilege_assignments'] = [v.as_dict() for v in self.privilege_assignments] @@ -896,7 +1233,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ShareToPrivilegeAssignment': + def from_dict(cls, d: Dict[str, any]) -> ShareToPrivilegeAssignment: + """Deserializes the ShareToPrivilegeAssignment from a dictionary.""" return cls(privilege_assignments=_repeated_dict(d, 'privilege_assignments', PrivilegeAssignment), share_name=d.get('share_name', None)) @@ -904,19 +1242,56 @@ def from_dict(cls, d: Dict[str, any]) -> 'ShareToPrivilegeAssignment': @dataclass class SharedDataObject: name: str + """A fully qualified name that uniquely identifies a data object. + + For example, a table's fully qualified name is in the format of `..`.""" + added_at: Optional[int] = None + """The time when this data object is added to the share, in epoch milliseconds.""" + added_by: Optional[str] = None + """Username of the sharer.""" + cdf_enabled: Optional[bool] = None + """Whether to enable cdf or indicate if cdf is enabled on the shared object.""" + comment: Optional[str] = None + """A user-provided comment when adding the data object to the share. [Update:OPT]""" + data_object_type: Optional[str] = None - history_data_sharing_status: Optional['SharedDataObjectHistoryDataSharingStatus'] = None - partitions: Optional['List[Partition]'] = None + """The type of the data object.""" + + history_data_sharing_status: Optional[SharedDataObjectHistoryDataSharingStatus] = None + """Whether to enable or disable sharing of data history. If not specified, the default is + **DISABLED**.""" + + partitions: Optional[List[Partition]] = None + """Array of partitions for the shared data.""" + shared_as: Optional[str] = None + """A user-provided new name for the data object within the share. If this new name is not provided, + the object's original name will be used as the `shared_as` name. The `shared_as` name must be + unique within a share. For tables, the new name must follow the format of `.
`.""" + start_version: Optional[int] = None - status: Optional['SharedDataObjectStatus'] = None + """The start version associated with the object. This allows data providers to control the lowest + object version that is accessible by clients. If specified, clients can query snapshots or + changes for versions >= start_version. If not specified, clients can only query starting from + the version of the object at the time it was added to the share. + + NOTE: The start_version should be <= the `current` version of the object.""" + + status: Optional[SharedDataObjectStatus] = None + """One of: **ACTIVE**, **PERMISSION_DENIED**.""" + string_shared_as: Optional[str] = None + """A user-provided new name for the data object within the share. If this new name is not provided, + the object's original name will be used as the `string_shared_as` name. The `string_shared_as` + name must be unique within a share. For notebooks, the new name should be the new notebook file + name.""" def as_dict(self) -> dict: + """Serializes the SharedDataObject into a dictionary suitable for use as a JSON request body.""" body = {} if self.added_at is not None: body['added_at'] = self.added_at if self.added_by is not None: body['added_by'] = self.added_by @@ -934,7 +1309,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SharedDataObject': + def from_dict(cls, d: Dict[str, any]) -> SharedDataObject: + """Deserializes the SharedDataObject from a dictionary.""" return cls(added_at=d.get('added_at', None), added_by=d.get('added_by', None), cdf_enabled=d.get('cdf_enabled', None), @@ -967,17 +1343,22 @@ class SharedDataObjectStatus(Enum): @dataclass class SharedDataObjectUpdate: - action: Optional['SharedDataObjectUpdateAction'] = None - data_object: Optional['SharedDataObject'] = None + action: Optional[SharedDataObjectUpdateAction] = None + """One of: **ADD**, **REMOVE**, **UPDATE**.""" + + data_object: Optional[SharedDataObject] = None + """The data object that is being added, removed, or updated.""" def as_dict(self) -> dict: + """Serializes the SharedDataObjectUpdate into a dictionary suitable for use as a JSON request body.""" body = {} if self.action is not None: body['action'] = self.action.value if self.data_object: body['data_object'] = self.data_object.as_dict() return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SharedDataObjectUpdate': + def from_dict(cls, d: Dict[str, any]) -> SharedDataObjectUpdate: + """Deserializes the SharedDataObjectUpdate from a dictionary.""" return cls(action=_enum(d, 'action', SharedDataObjectUpdateAction), data_object=_from_dict(d, 'data_object', SharedDataObject)) @@ -992,13 +1373,23 @@ class SharedDataObjectUpdateAction(Enum): @dataclass class UpdateCleanRoom: - catalog_updates: Optional['List[CleanRoomCatalogUpdate]'] = None + catalog_updates: Optional[List[CleanRoomCatalogUpdate]] = None + """Array of shared data object updates.""" + comment: Optional[str] = None + """User-provided free-form text description.""" + name: Optional[str] = None + """Name of the clean room.""" + name_arg: Optional[str] = None + """The name of the clean room.""" + owner: Optional[str] = None + """Username of current owner of clean room.""" def as_dict(self) -> dict: + """Serializes the UpdateCleanRoom into a dictionary suitable for use as a JSON request body.""" body = {} if self.catalog_updates: body['catalog_updates'] = [v.as_dict() for v in self.catalog_updates] if self.comment is not None: body['comment'] = self.comment @@ -1008,7 +1399,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateCleanRoom': + def from_dict(cls, d: Dict[str, any]) -> UpdateCleanRoom: + """Deserializes the UpdateCleanRoom from a dictionary.""" return cls(catalog_updates=_repeated_dict(d, 'catalog_updates', CleanRoomCatalogUpdate), comment=d.get('comment', None), name=d.get('name', None), @@ -1019,11 +1411,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateCleanRoom': @dataclass class UpdateProvider: comment: Optional[str] = None + """Description about the provider.""" + name: Optional[str] = None + """The name of the Provider.""" + owner: Optional[str] = None + """Username of Provider owner.""" + recipient_profile_str: Optional[str] = None + """This field is required when the __authentication_type__ is **TOKEN** or not provided.""" def as_dict(self) -> dict: + """Serializes the UpdateProvider into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -1032,7 +1432,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateProvider': + def from_dict(cls, d: Dict[str, any]) -> UpdateProvider: + """Deserializes the UpdateProvider from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), owner=d.get('owner', None), @@ -1042,12 +1443,24 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateProvider': @dataclass class UpdateRecipient: comment: Optional[str] = None - ip_access_list: Optional['IpAccessList'] = None + """Description about the recipient.""" + + ip_access_list: Optional[IpAccessList] = None + """IP Access List""" + name: Optional[str] = None + """Name of Recipient.""" + owner: Optional[str] = None - properties_kvpairs: Optional['SecurablePropertiesKvPairs'] = None + """Username of the recipient owner.""" + + properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None + """Recipient properties as map of string key-value pairs. When provided in update request, the + specified properties will override the existing properties. To add and remove properties, one + would need to perform a read-modify-write.""" def as_dict(self) -> dict: + """Serializes the UpdateRecipient into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict() @@ -1057,7 +1470,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRecipient': + def from_dict(cls, d: Dict[str, any]) -> UpdateRecipient: + """Deserializes the UpdateRecipient from a dictionary.""" return cls(comment=d.get('comment', None), ip_access_list=_from_dict(d, 'ip_access_list', IpAccessList), name=d.get('name', None), @@ -1068,11 +1482,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateRecipient': @dataclass class UpdateShare: comment: Optional[str] = None + """User-provided free-form text description.""" + name: Optional[str] = None + """Name of the share.""" + owner: Optional[str] = None - updates: Optional['List[SharedDataObjectUpdate]'] = None + """Username of current owner of share.""" + + updates: Optional[List[SharedDataObjectUpdate]] = None + """Array of shared data object updates.""" def as_dict(self) -> dict: + """Serializes the UpdateShare into a dictionary suitable for use as a JSON request body.""" body = {} if self.comment is not None: body['comment'] = self.comment if self.name is not None: body['name'] = self.name @@ -1081,7 +1503,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateShare': + def from_dict(cls, d: Dict[str, any]) -> UpdateShare: + """Deserializes the UpdateShare from a dictionary.""" return cls(comment=d.get('comment', None), name=d.get('name', None), owner=d.get('owner', None), @@ -1090,17 +1513,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateShare': @dataclass class UpdateSharePermissions: - changes: Optional['List[catalog.PermissionsChange]'] = None + changes: Optional[List[catalog.PermissionsChange]] = None + """Array of permission changes.""" + name: Optional[str] = None + """The name of the share.""" def as_dict(self) -> dict: + """Serializes the UpdateSharePermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.changes: body['changes'] = [v.as_dict() for v in self.changes] if self.name is not None: body['name'] = self.name return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateSharePermissions': + def from_dict(cls, d: Dict[str, any]) -> UpdateSharePermissions: + """Deserializes the UpdateSharePermissions from a dictionary.""" return cls(changes=_repeated_dict(d, 'changes', catalog.PermissionsChange), name=d.get('name', None)) @@ -1180,7 +1608,7 @@ def get(self, name_arg: str, *, include_remote_details: Optional[bool] = None) - def list(self, *, max_results: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['CleanRoomInfo']: + page_token: Optional[str] = None) -> Iterator[CleanRoomInfo]: """List clean rooms. Gets an array of data object clean rooms from the metastore. The caller must be a metastore admin or @@ -1328,7 +1756,7 @@ def get(self, name: str) -> ProviderInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/providers/{name}', headers=headers) return ProviderInfo.from_dict(res) - def list(self, *, data_provider_global_metastore_id: Optional[str] = None) -> Iterator['ProviderInfo']: + def list(self, *, data_provider_global_metastore_id: Optional[str] = None) -> Iterator[ProviderInfo]: """List providers. Gets an array of available authentication providers. The caller must either be a metastore admin or @@ -1350,7 +1778,7 @@ def list(self, *, data_provider_global_metastore_id: Optional[str] = None) -> It parsed = ListProvidersResponse.from_dict(json).providers return parsed if parsed is not None else [] - def list_shares(self, name: str) -> Iterator['ProviderShare']: + def list_shares(self, name: str) -> Iterator[ProviderShare]: """List shares by Provider. Gets an array of a specified provider's shares within the metastore where: @@ -1546,7 +1974,7 @@ def get(self, name: str) -> RecipientInfo: res = self._api.do('GET', f'/api/2.1/unity-catalog/recipients/{name}', headers=headers) return RecipientInfo.from_dict(res) - def list(self, *, data_recipient_global_metastore_id: Optional[str] = None) -> Iterator['RecipientInfo']: + def list(self, *, data_recipient_global_metastore_id: Optional[str] = None) -> Iterator[RecipientInfo]: """List share recipients. Gets an array of all share recipients within the current metastore where: @@ -1712,7 +2140,7 @@ def get(self, name: str, *, include_shared_data: Optional[bool] = None) -> Share res = self._api.do('GET', f'/api/2.1/unity-catalog/shares/{name}', query=query, headers=headers) return ShareInfo.from_dict(res) - def list(self) -> Iterator['ShareInfo']: + def list(self) -> Iterator[ShareInfo]: """List shares. Gets an array of data object shares from the metastore. The caller must be a metastore admin or the diff --git a/databricks/sdk/service/sql.py b/databricks/sdk/service/sql.py index 1946b37f8..a461f53fc 100755 --- a/databricks/sdk/service/sql.py +++ b/databricks/sdk/service/sql.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging import random import time @@ -19,10 +21,15 @@ @dataclass class AccessControl: group_name: Optional[str] = None - permission_level: Optional['PermissionLevel'] = None + + permission_level: Optional[PermissionLevel] = None + """* `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * `CAN_MANAGE`: Can manage the + query""" + user_name: Optional[str] = None def as_dict(self) -> dict: + """Serializes the AccessControl into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -30,7 +37,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AccessControl': + def from_dict(cls, d: Dict[str, any]) -> AccessControl: + """Deserializes the AccessControl from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', PermissionLevel), user_name=d.get('user_name', None)) @@ -39,18 +47,40 @@ def from_dict(cls, d: Dict[str, any]) -> 'AccessControl': @dataclass class Alert: created_at: Optional[str] = None + """Timestamp when the alert was created.""" + id: Optional[str] = None + """Alert ID.""" + last_triggered_at: Optional[str] = None + """Timestamp when the alert was last triggered.""" + name: Optional[str] = None - options: Optional['AlertOptions'] = None + """Name of the alert.""" + + options: Optional[AlertOptions] = None + """Alert configuration options.""" + parent: Optional[str] = None - query: Optional['AlertQuery'] = None + """The identifier of the workspace folder containing the object.""" + + query: Optional[AlertQuery] = None + rearm: Optional[int] = None - state: Optional['AlertState'] = None + """Number of seconds after being triggered before the alert rearms itself and can be triggered + again. If `null`, alert will never be triggered again.""" + + state: Optional[AlertState] = None + """State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated + and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions).""" + updated_at: Optional[str] = None - user: Optional['User'] = None + """Timestamp when the alert was last updated.""" + + user: Optional[User] = None def as_dict(self) -> dict: + """Serializes the Alert into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.id is not None: body['id'] = self.id @@ -66,7 +96,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Alert': + def from_dict(cls, d: Dict[str, any]) -> Alert: + """Deserializes the Alert from a dictionary.""" return cls(created_at=d.get('created_at', None), id=d.get('id', None), last_triggered_at=d.get('last_triggered_at', None), @@ -85,14 +116,35 @@ class AlertOptions: """Alert configuration options.""" column: str + """Name of column in the query result to compare in alert evaluation.""" + op: str + """Operator used to compare in alert evaluation: `>`, `>=`, `<`, `<=`, `==`, `!=`""" + value: Any + """Value used to compare in alert evaluation. Supported types include strings (eg. 'foobar'), + floats (eg. 123.4), and booleans (true).""" + custom_body: Optional[str] = None + """Custom body of alert notification, if it exists. See [here] for custom templating instructions. + + [here]: https://docs.databricks.com/sql/user/alerts/index.html""" + custom_subject: Optional[str] = None - empty_result_state: Optional['AlertOptionsEmptyResultState'] = None + """Custom subject of alert notification, if it exists. This includes email subject, Slack + notification header, etc. See [here] for custom templating instructions. + + [here]: https://docs.databricks.com/sql/user/alerts/index.html""" + + empty_result_state: Optional[AlertOptionsEmptyResultState] = None + """State that alert evaluates to when query result is empty.""" + muted: Optional[bool] = None + """Whether or not the alert is muted. If an alert is muted, it will not notify users and + notification destinations when triggered.""" def as_dict(self) -> dict: + """Serializes the AlertOptions into a dictionary suitable for use as a JSON request body.""" body = {} if self.column is not None: body['column'] = self.column if self.custom_body is not None: body['custom_body'] = self.custom_body @@ -104,7 +156,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AlertOptions': + def from_dict(cls, d: Dict[str, any]) -> AlertOptions: + """Deserializes the AlertOptions from a dictionary.""" return cls(column=d.get('column', None), custom_body=d.get('custom_body', None), custom_subject=d.get('custom_subject', None), @@ -125,20 +178,49 @@ class AlertOptionsEmptyResultState(Enum): @dataclass class AlertQuery: created_at: Optional[str] = None + """The timestamp when this query was created.""" + data_source_id: Optional[str] = None + """Data source ID.""" + description: Optional[str] = None + """General description that conveys additional information about this query such as usage notes.""" + id: Optional[str] = None + """Query ID.""" + is_archived: Optional[bool] = None + """Indicates whether the query is trashed. Trashed queries can't be used in dashboards, or appear + in search results. If this boolean is `true`, the `options` property for this query includes a + `moved_to_trash_at` timestamp. Trashed queries are permanently deleted after 30 days.""" + is_draft: Optional[bool] = None + """Whether the query is a draft. Draft queries only appear in list views for their owners. + Visualizations from draft queries cannot appear on dashboards.""" + is_safe: Optional[bool] = None + """Text parameter types are not safe from SQL injection for all types of data source. Set this + Boolean parameter to `true` if a query either does not use any text type parameters or uses a + data source type where text type parameters are handled safely.""" + name: Optional[str] = None - options: Optional['QueryOptions'] = None + """The title of this query that appears in list views, widget headings, and on the query page.""" + + options: Optional[QueryOptions] = None + query: Optional[str] = None - tags: Optional['List[str]'] = None + """The text of the query to be run.""" + + tags: Optional[List[str]] = None + updated_at: Optional[str] = None + """The timestamp at which this query was last updated.""" + user_id: Optional[int] = None + """The ID of the user who created this query.""" def as_dict(self) -> dict: + """Serializes the AlertQuery into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.data_source_id is not None: body['data_source_id'] = self.data_source_id @@ -156,7 +238,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AlertQuery': + def from_dict(cls, d: Dict[str, any]) -> AlertQuery: + """Deserializes the AlertQuery from a dictionary.""" return cls(created_at=d.get('created_at', None), data_source_id=d.get('data_source_id', None), description=d.get('description', None), @@ -187,11 +270,19 @@ class BaseChunkInfo: within a manifest, and when fetching individual chunk data or links.""" byte_count: Optional[int] = None + """The number of bytes in the result chunk.""" + chunk_index: Optional[int] = None + """The position within the sequence of result set chunks.""" + row_count: Optional[int] = None + """The number of rows within the result chunk.""" + row_offset: Optional[int] = None + """The starting row offset within the result set.""" def as_dict(self) -> dict: + """Serializes the BaseChunkInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.byte_count is not None: body['byte_count'] = self.byte_count if self.chunk_index is not None: body['chunk_index'] = self.chunk_index @@ -200,7 +291,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'BaseChunkInfo': + def from_dict(cls, d: Dict[str, any]) -> BaseChunkInfo: + """Deserializes the BaseChunkInfo from a dictionary.""" return cls(byte_count=d.get('byte_count', None), chunk_index=d.get('chunk_index', None), row_count=d.get('row_count', None), @@ -210,16 +302,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'BaseChunkInfo': @dataclass class Channel: dbsql_version: Optional[str] = None - name: Optional['ChannelName'] = None + + name: Optional[ChannelName] = None def as_dict(self) -> dict: + """Serializes the Channel into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbsql_version is not None: body['dbsql_version'] = self.dbsql_version if self.name is not None: body['name'] = self.name.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Channel': + def from_dict(cls, d: Dict[str, any]) -> Channel: + """Deserializes the Channel from a dictionary.""" return cls(dbsql_version=d.get('dbsql_version', None), name=_enum(d, 'name', ChannelName)) @@ -228,16 +323,21 @@ class ChannelInfo: """Channel information for the SQL warehouse at the time of query execution""" dbsql_version: Optional[str] = None - name: Optional['ChannelName'] = None + """DBSQL Version the channel is mapped to""" + + name: Optional[ChannelName] = None + """Name of the channel""" def as_dict(self) -> dict: + """Serializes the ChannelInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.dbsql_version is not None: body['dbsql_version'] = self.dbsql_version if self.name is not None: body['name'] = self.name.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ChannelInfo': + def from_dict(cls, d: Dict[str, any]) -> ChannelInfo: + """Deserializes the ChannelInfo from a dictionary.""" return cls(dbsql_version=d.get('dbsql_version', None), name=_enum(d, 'name', ChannelName)) @@ -254,14 +354,30 @@ class ChannelName(Enum): @dataclass class ColumnInfo: name: Optional[str] = None + """The name of the column.""" + position: Optional[int] = None + """The ordinal position of the column (starting at position 0).""" + type_interval_type: Optional[str] = None - type_name: Optional['ColumnInfoTypeName'] = None + """The format of the interval type.""" + + type_name: Optional[ColumnInfoTypeName] = None + """The name of the base data type. This doesn't include details for complex types such as STRUCT, + MAP or ARRAY.""" + type_precision: Optional[int] = None + """Specifies the number of digits in a number. This applies to the DECIMAL type.""" + type_scale: Optional[int] = None + """Specifies the number of digits to the right of the decimal point in a number. This applies to + the DECIMAL type.""" + type_text: Optional[str] = None + """The full SQL type specification.""" def as_dict(self) -> dict: + """Serializes the ColumnInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.position is not None: body['position'] = self.position @@ -273,7 +389,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ColumnInfo': + def from_dict(cls, d: Dict[str, any]) -> ColumnInfo: + """Deserializes the ColumnInfo from a dictionary.""" return cls(name=d.get('name', None), position=d.get('position', None), type_interval_type=d.get('type_interval_type', None), @@ -311,12 +428,23 @@ class ColumnInfoTypeName(Enum): @dataclass class CreateAlert: name: str - options: 'AlertOptions' + """Name of the alert.""" + + options: AlertOptions + """Alert configuration options.""" + query_id: str + """Query ID.""" + parent: Optional[str] = None + """The identifier of the workspace folder containing the object.""" + rearm: Optional[int] = None + """Number of seconds after being triggered before the alert rearms itself and can be triggered + again. If `null`, alert will never be triggered again.""" def as_dict(self) -> dict: + """Serializes the CreateAlert into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.options: body['options'] = self.options.as_dict() @@ -326,7 +454,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateAlert': + def from_dict(cls, d: Dict[str, any]) -> CreateAlert: + """Deserializes the CreateAlert from a dictionary.""" return cls(name=d.get('name', None), options=_from_dict(d, 'options', AlertOptions), parent=d.get('parent', None), @@ -337,20 +466,75 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateAlert': @dataclass class CreateWarehouseRequest: auto_stop_mins: Optional[int] = None - channel: Optional['Channel'] = None + """The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) + before it is automatically stopped. + + Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. + + Defaults to 120 mins""" + + channel: Optional[Channel] = None + """Channel Details""" + cluster_size: Optional[str] = None + """Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows + you to run larger queries on it. If you want to increase the number of concurrent queries, + please tune max_num_clusters. + + Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large + - 4X-Large""" + creator_name: Optional[str] = None + """warehouse creator name""" + enable_photon: Optional[bool] = None + """Configures whether the warehouse should use Photon optimized clusters. + + Defaults to false.""" + enable_serverless_compute: Optional[bool] = None + """Configures whether the warehouse should use serverless compute""" + instance_profile_arn: Optional[str] = None + """Deprecated. Instance profile used to pass IAM role to the cluster""" + max_num_clusters: Optional[int] = None + """Maximum number of clusters that the autoscaler will create to handle concurrent queries. + + Supported values: - Must be >= min_num_clusters - Must be <= 30. + + Defaults to min_clusters if unset.""" + min_num_clusters: Optional[int] = None + """Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing + this will ensure that a larger number of clusters are always running and therefore may reduce + the cold start time for new queries. This is similar to reserved vs. revocable cores in a + resource manager. + + Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) + + Defaults to 1""" + name: Optional[str] = None - spot_instance_policy: Optional['SpotInstancePolicy'] = None - tags: Optional['EndpointTags'] = None - warehouse_type: Optional['CreateWarehouseRequestWarehouseType'] = None + """Logical name for the cluster. + + Supported values: - Must be unique within an org. - Must be less than 100 characters.""" + + spot_instance_policy: Optional[SpotInstancePolicy] = None + """Configurations whether the warehouse should use spot instances.""" + + tags: Optional[EndpointTags] = None + """A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS + volumes) associated with this SQL warehouse. + + Supported values: - Number of tags < 45.""" + + warehouse_type: Optional[CreateWarehouseRequestWarehouseType] = None + """Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` + and also set the field `enable_serverless_compute` to `true`.""" def as_dict(self) -> dict: + """Serializes the CreateWarehouseRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.auto_stop_mins is not None: body['auto_stop_mins'] = self.auto_stop_mins if self.channel: body['channel'] = self.channel.as_dict() @@ -370,7 +554,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateWarehouseRequest': + def from_dict(cls, d: Dict[str, any]) -> CreateWarehouseRequest: + """Deserializes the CreateWarehouseRequest from a dictionary.""" return cls(auto_stop_mins=d.get('auto_stop_mins', None), channel=_from_dict(d, 'channel', Channel), cluster_size=d.get('cluster_size', None), @@ -398,27 +583,41 @@ class CreateWarehouseRequestWarehouseType(Enum): @dataclass class CreateWarehouseResponse: id: Optional[str] = None + """Id for the SQL warehouse. This value is unique across all SQL warehouses.""" def as_dict(self) -> dict: + """Serializes the CreateWarehouseResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateWarehouseResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateWarehouseResponse: + """Deserializes the CreateWarehouseResponse from a dictionary.""" return cls(id=d.get('id', None)) @dataclass class CreateWidget: dashboard_id: str - options: 'WidgetOptions' + """Dashboard ID returned by :method:dashboards/create.""" + + options: WidgetOptions + width: int + """Width of a widget""" + id: Optional[str] = None + text: Optional[str] = None + """If this is a textbox widget, the application displays this text. This field is ignored if the + widget contains a visualization in the `visualization` field.""" + visualization_id: Optional[str] = None + """Query Vizualization ID returned by :method:queryvisualizations/create.""" def as_dict(self) -> dict: + """Serializes the CreateWidget into a dictionary suitable for use as a JSON request body.""" body = {} if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id if self.id is not None: body['id'] = self.id @@ -429,7 +628,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateWidget': + def from_dict(cls, d: Dict[str, any]) -> CreateWidget: + """Deserializes the CreateWidget from a dictionary.""" return cls(dashboard_id=d.get('dashboard_id', None), id=d.get('id', None), options=_from_dict(d, 'options', WidgetOptions), @@ -443,24 +643,60 @@ class Dashboard: """A JSON representing a dashboard containing widgets of visualizations and text boxes.""" can_edit: Optional[bool] = None + """Whether the authenticated user can edit the query definition.""" + created_at: Optional[str] = None + """Timestamp when this dashboard was created.""" + dashboard_filters_enabled: Optional[bool] = None + """In the web application, query filters that share a name are coupled to a single selection box if + this value is `true`.""" + id: Optional[str] = None + """The ID for this dashboard.""" + is_archived: Optional[bool] = None + """Indicates whether a dashboard is trashed. Trashed dashboards won't appear in list views. If this + boolean is `true`, the `options` property for this dashboard includes a `moved_to_trash_at` + timestamp. Items in trash are permanently deleted after 30 days.""" + is_draft: Optional[bool] = None + """Whether a dashboard is a draft. Draft dashboards only appear in list views for their owners.""" + is_favorite: Optional[bool] = None + """Indicates whether this query object appears in the current user's favorites list. This flag + determines whether the star icon for favorites is selected.""" + name: Optional[str] = None - options: Optional['DashboardOptions'] = None + """The title of the dashboard that appears in list views and at the top of the dashboard page.""" + + options: Optional[DashboardOptions] = None + parent: Optional[str] = None - permission_tier: Optional['PermissionLevel'] = None + """The identifier of the workspace folder containing the object.""" + + permission_tier: Optional[PermissionLevel] = None + """* `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * `CAN_MANAGE`: Can manage the + query""" + slug: Optional[str] = None - tags: Optional['List[str]'] = None + """URL slug. Usually mirrors the query name with dashes (`-`) instead of spaces. Appears in the URL + for this query.""" + + tags: Optional[List[str]] = None + updated_at: Optional[str] = None - user: Optional['User'] = None + """Timestamp when this dashboard was last updated.""" + + user: Optional[User] = None + user_id: Optional[int] = None - widgets: Optional['List[Widget]'] = None + """The ID of the user that created and owns this dashboard.""" + + widgets: Optional[List[Widget]] = None def as_dict(self) -> dict: + """Serializes the Dashboard into a dictionary suitable for use as a JSON request body.""" body = {} if self.can_edit is not None: body['can_edit'] = self.can_edit if self.created_at is not None: body['created_at'] = self.created_at @@ -483,7 +719,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Dashboard': + def from_dict(cls, d: Dict[str, any]) -> Dashboard: + """Deserializes the Dashboard from a dictionary.""" return cls(can_edit=d.get('can_edit', None), created_at=d.get('created_at', None), dashboard_filters_enabled=d.get('dashboard_filters_enabled', None), @@ -506,14 +743,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'Dashboard': @dataclass class DashboardOptions: moved_to_trash_at: Optional[str] = None + """The timestamp when this dashboard was moved to trash. Only present when the `is_archived` + property is `true`. Trashed items are deleted after thirty days.""" def as_dict(self) -> dict: + """Serializes the DashboardOptions into a dictionary suitable for use as a JSON request body.""" body = {} if self.moved_to_trash_at is not None: body['moved_to_trash_at'] = self.moved_to_trash_at return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DashboardOptions': + def from_dict(cls, d: Dict[str, any]) -> DashboardOptions: + """Deserializes the DashboardOptions from a dictionary.""" return cls(moved_to_trash_at=d.get('moved_to_trash_at', None)) @@ -522,16 +763,35 @@ class DataSource: """A JSON object representing a DBSQL data source / SQL warehouse.""" id: Optional[str] = None + """Data source ID.""" + name: Optional[str] = None + """The string name of this data source / SQL warehouse as it appears in the Databricks SQL web + application.""" + pause_reason: Optional[str] = None + """Reserved for internal use.""" + paused: Optional[int] = None + """Reserved for internal use.""" + supports_auto_limit: Optional[bool] = None + """Reserved for internal use.""" + syntax: Optional[str] = None + """Reserved for internal use.""" + type: Optional[str] = None + """The type of data source. For SQL warehouses, this will be `databricks_internal`.""" + view_only: Optional[bool] = None + """Reserved for internal use.""" + warehouse_id: Optional[str] = None + """The ID of the associated SQL warehouse, if this data source is backed by a SQL warehouse.""" def as_dict(self) -> dict: + """Serializes the DataSource into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id if self.name is not None: body['name'] = self.name @@ -545,7 +805,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DataSource': + def from_dict(cls, d: Dict[str, any]) -> DataSource: + """Deserializes the DataSource from a dictionary.""" return cls(id=d.get('id', None), name=d.get('name', None), pause_reason=d.get('pause_reason', None), @@ -586,12 +847,22 @@ class Disposition(Enum): @dataclass class EditAlert: name: str - options: 'AlertOptions' + """Name of the alert.""" + + options: AlertOptions + """Alert configuration options.""" + query_id: str + """Query ID.""" + alert_id: Optional[str] = None + rearm: Optional[int] = None + """Number of seconds after being triggered before the alert rearms itself and can be triggered + again. If `null`, alert will never be triggered again.""" def as_dict(self) -> dict: + """Serializes the EditAlert into a dictionary suitable for use as a JSON request body.""" body = {} if self.alert_id is not None: body['alert_id'] = self.alert_id if self.name is not None: body['name'] = self.name @@ -601,7 +872,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EditAlert': + def from_dict(cls, d: Dict[str, any]) -> EditAlert: + """Deserializes the EditAlert from a dictionary.""" return cls(alert_id=d.get('alert_id', None), name=d.get('name', None), options=_from_dict(d, 'options', AlertOptions), @@ -612,21 +884,78 @@ def from_dict(cls, d: Dict[str, any]) -> 'EditAlert': @dataclass class EditWarehouseRequest: auto_stop_mins: Optional[int] = None - channel: Optional['Channel'] = None + """The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) + before it is automatically stopped. + + Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. + + Defaults to 120 mins""" + + channel: Optional[Channel] = None + """Channel Details""" + cluster_size: Optional[str] = None + """Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows + you to run larger queries on it. If you want to increase the number of concurrent queries, + please tune max_num_clusters. + + Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large + - 4X-Large""" + creator_name: Optional[str] = None + """warehouse creator name""" + enable_photon: Optional[bool] = None + """Configures whether the warehouse should use Photon optimized clusters. + + Defaults to false.""" + enable_serverless_compute: Optional[bool] = None + """Configures whether the warehouse should use serverless compute.""" + id: Optional[str] = None + """Required. Id of the warehouse to configure.""" + instance_profile_arn: Optional[str] = None + """Deprecated. Instance profile used to pass IAM role to the cluster""" + max_num_clusters: Optional[int] = None + """Maximum number of clusters that the autoscaler will create to handle concurrent queries. + + Supported values: - Must be >= min_num_clusters - Must be <= 30. + + Defaults to min_clusters if unset.""" + min_num_clusters: Optional[int] = None + """Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing + this will ensure that a larger number of clusters are always running and therefore may reduce + the cold start time for new queries. This is similar to reserved vs. revocable cores in a + resource manager. + + Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) + + Defaults to 1""" + name: Optional[str] = None - spot_instance_policy: Optional['SpotInstancePolicy'] = None - tags: Optional['EndpointTags'] = None - warehouse_type: Optional['EditWarehouseRequestWarehouseType'] = None + """Logical name for the cluster. + + Supported values: - Must be unique within an org. - Must be less than 100 characters.""" + + spot_instance_policy: Optional[SpotInstancePolicy] = None + """Configurations whether the warehouse should use spot instances.""" + + tags: Optional[EndpointTags] = None + """A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS + volumes) associated with this SQL warehouse. + + Supported values: - Number of tags < 45.""" + + warehouse_type: Optional[EditWarehouseRequestWarehouseType] = None + """Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` + and also set the field `enable_serverless_compute` to `true`.""" def as_dict(self) -> dict: + """Serializes the EditWarehouseRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.auto_stop_mins is not None: body['auto_stop_mins'] = self.auto_stop_mins if self.channel: body['channel'] = self.channel.as_dict() @@ -647,7 +976,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EditWarehouseRequest': + def from_dict(cls, d: Dict[str, any]) -> EditWarehouseRequest: + """Deserializes the EditWarehouseRequest from a dictionary.""" return cls(auto_stop_mins=d.get('auto_stop_mins', None), channel=_from_dict(d, 'channel', Channel), cluster_size=d.get('cluster_size', None), @@ -676,28 +1006,42 @@ class EditWarehouseRequestWarehouseType(Enum): @dataclass class EndpointConfPair: key: Optional[str] = None + value: Optional[str] = None def as_dict(self) -> dict: + """Serializes the EndpointConfPair into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointConfPair': + def from_dict(cls, d: Dict[str, any]) -> EndpointConfPair: + """Deserializes the EndpointConfPair from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class EndpointHealth: details: Optional[str] = None - failure_reason: Optional['TerminationReason'] = None + """Details about errors that are causing current degraded/failed status.""" + + failure_reason: Optional[TerminationReason] = None + """The reason for failure to bring up clusters for this warehouse. This is available when status is + 'FAILED' and sometimes when it is DEGRADED.""" + message: Optional[str] = None - status: Optional['Status'] = None + """Deprecated. split into summary and details for security""" + + status: Optional[Status] = None + """Health status of the warehouse.""" + summary: Optional[str] = None + """A short summary of the health status in case of degraded/failed warehouses.""" def as_dict(self) -> dict: + """Serializes the EndpointHealth into a dictionary suitable for use as a JSON request body.""" body = {} if self.details is not None: body['details'] = self.details if self.failure_reason: body['failure_reason'] = self.failure_reason.as_dict() @@ -707,7 +1051,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointHealth': + def from_dict(cls, d: Dict[str, any]) -> EndpointHealth: + """Deserializes the EndpointHealth from a dictionary.""" return cls(details=d.get('details', None), failure_reason=_from_dict(d, 'failure_reason', TerminationReason), message=d.get('message', None), @@ -718,27 +1063,96 @@ def from_dict(cls, d: Dict[str, any]) -> 'EndpointHealth': @dataclass class EndpointInfo: auto_stop_mins: Optional[int] = None - channel: Optional['Channel'] = None + """The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) + before it is automatically stopped. + + Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. + + Defaults to 120 mins""" + + channel: Optional[Channel] = None + """Channel Details""" + cluster_size: Optional[str] = None + """Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows + you to run larger queries on it. If you want to increase the number of concurrent queries, + please tune max_num_clusters. + + Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large + - 4X-Large""" + creator_name: Optional[str] = None + """warehouse creator name""" + enable_photon: Optional[bool] = None + """Configures whether the warehouse should use Photon optimized clusters. + + Defaults to false.""" + enable_serverless_compute: Optional[bool] = None - health: Optional['EndpointHealth'] = None + """Configures whether the warehouse should use serverless compute""" + + health: Optional[EndpointHealth] = None + """Optional health status. Assume the warehouse is healthy if this field is not set.""" + id: Optional[str] = None + """unique identifier for warehouse""" + instance_profile_arn: Optional[str] = None + """Deprecated. Instance profile used to pass IAM role to the cluster""" + jdbc_url: Optional[str] = None + """the jdbc connection string for this warehouse""" + max_num_clusters: Optional[int] = None + """Maximum number of clusters that the autoscaler will create to handle concurrent queries. + + Supported values: - Must be >= min_num_clusters - Must be <= 30. + + Defaults to min_clusters if unset.""" + min_num_clusters: Optional[int] = None + """Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing + this will ensure that a larger number of clusters are always running and therefore may reduce + the cold start time for new queries. This is similar to reserved vs. revocable cores in a + resource manager. + + Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) + + Defaults to 1""" + name: Optional[str] = None + """Logical name for the cluster. + + Supported values: - Must be unique within an org. - Must be less than 100 characters.""" + num_active_sessions: Optional[int] = None + """current number of active sessions for the warehouse""" + num_clusters: Optional[int] = None - odbc_params: Optional['OdbcParams'] = None - spot_instance_policy: Optional['SpotInstancePolicy'] = None - state: Optional['State'] = None - tags: Optional['EndpointTags'] = None - warehouse_type: Optional['EndpointInfoWarehouseType'] = None + """current number of clusters running for the service""" + + odbc_params: Optional[OdbcParams] = None + """ODBC parameters for the SQL warehouse""" + + spot_instance_policy: Optional[SpotInstancePolicy] = None + """Configurations whether the warehouse should use spot instances.""" + + state: Optional[State] = None + """State of the warehouse""" + + tags: Optional[EndpointTags] = None + """A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS + volumes) associated with this SQL warehouse. + + Supported values: - Number of tags < 45.""" + + warehouse_type: Optional[EndpointInfoWarehouseType] = None + """Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` + and also set the field `enable_serverless_compute` to `true`.""" def as_dict(self) -> dict: + """Serializes the EndpointInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.auto_stop_mins is not None: body['auto_stop_mins'] = self.auto_stop_mins if self.channel: body['channel'] = self.channel.as_dict() @@ -765,7 +1179,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointInfo': + def from_dict(cls, d: Dict[str, any]) -> EndpointInfo: + """Deserializes the EndpointInfo from a dictionary.""" return cls(auto_stop_mins=d.get('auto_stop_mins', None), channel=_from_dict(d, 'channel', Channel), cluster_size=d.get('cluster_size', None), @@ -800,48 +1215,176 @@ class EndpointInfoWarehouseType(Enum): @dataclass class EndpointTagPair: key: Optional[str] = None + value: Optional[str] = None def as_dict(self) -> dict: + """Serializes the EndpointTagPair into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointTagPair': + def from_dict(cls, d: Dict[str, any]) -> EndpointTagPair: + """Deserializes the EndpointTagPair from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class EndpointTags: - custom_tags: Optional['List[EndpointTagPair]'] = None + custom_tags: Optional[List[EndpointTagPair]] = None def as_dict(self) -> dict: + """Serializes the EndpointTags into a dictionary suitable for use as a JSON request body.""" body = {} if self.custom_tags: body['custom_tags'] = [v.as_dict() for v in self.custom_tags] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'EndpointTags': + def from_dict(cls, d: Dict[str, any]) -> EndpointTags: + """Deserializes the EndpointTags from a dictionary.""" return cls(custom_tags=_repeated_dict(d, 'custom_tags', EndpointTagPair)) @dataclass class ExecuteStatementRequest: statement: str + """The SQL statement to execute. The statement can optionally be parameterized, see `parameters`.""" + warehouse_id: str + """Warehouse upon which to execute a statement. See also [What are SQL + warehouses?](/sql/admin/warehouse-type.html)""" + byte_limit: Optional[int] = None + """Applies the given byte limit to the statement's result size. Byte counts are based on internal + data representations and might not match the final size in the requested `format`. If the result + was truncated due to the byte limit, then `truncated` in the response is set to `true`. When + using `EXTERNAL_LINKS` disposition, a default `byte_limit` of 100 GiB is applied if `byte_limit` + is not explcitly set.""" + catalog: Optional[str] = None - disposition: Optional['Disposition'] = None - format: Optional['Format'] = None - on_wait_timeout: Optional['ExecuteStatementRequestOnWaitTimeout'] = None - parameters: Optional['List[StatementParameterListItem]'] = None + """Sets default catalog for statement execution, similar to [`USE CATALOG`] in SQL. + + [`USE CATALOG`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-catalog.html""" + + disposition: Optional[Disposition] = None + """The fetch disposition provides two modes of fetching results: `INLINE` and `EXTERNAL_LINKS`. + + Statements executed with `INLINE` disposition will return result data inline, in `JSON_ARRAY` + format, in a series of chunks. If a given statement produces a result set with a size larger + than 25 MiB, that statement execution is aborted, and no result set will be available. + + **NOTE** Byte limits are computed based upon internal representations of the result set data, + and might not match the sizes visible in JSON responses. + + Statements executed with `EXTERNAL_LINKS` disposition will return result data as external links: + URLs that point to cloud storage internal to the workspace. Using `EXTERNAL_LINKS` disposition + allows statements to generate arbitrarily sized result sets for fetching up to 100 GiB. The + resulting links have two important properties: + + 1. They point to resources _external_ to the Databricks compute; therefore any associated + authentication information (typically a personal access token, OAuth token, or similar) _must be + removed_ when fetching from these links. + + 2. These are presigned URLs with a specific expiration, indicated in the response. The behavior + when attempting to use an expired link is cloud specific.""" + + format: Optional[Format] = None + """Statement execution supports three result formats: `JSON_ARRAY` (default), `ARROW_STREAM`, and + `CSV`. + + Important: The formats `ARROW_STREAM` and `CSV` are supported only with `EXTERNAL_LINKS` + disposition. `JSON_ARRAY` is supported in `INLINE` and `EXTERNAL_LINKS` disposition. + + When specifying `format=JSON_ARRAY`, result data will be formatted as an array of arrays of + values, where each value is either the *string representation* of a value, or `null`. For + example, the output of `SELECT concat('id-', id) AS strCol, id AS intCol, null AS nullCol FROM + range(3)` would look like this: + + ``` [ [ "id-1", "1", null ], [ "id-2", "2", null ], [ "id-3", "3", null ], ] ``` + + When specifying `format=JSON_ARRAY` and `disposition=EXTERNAL_LINKS`, each chunk in the result + contains compact JSON with no indentation or extra whitespace. + + When specifying `format=ARROW_STREAM` and `disposition=EXTERNAL_LINKS`, each chunk in the result + will be formatted as Apache Arrow Stream. See the [Apache Arrow streaming format]. + + When specifying `format=CSV` and `disposition=EXTERNAL_LINKS`, each chunk in the result will be + a CSV according to [RFC 4180] standard. All the columns values will have *string representation* + similar to the `JSON_ARRAY` format, and `null` values will be encoded as “null”. Only the + first chunk in the result would contain a header row with column names. For example, the output + of `SELECT concat('id-', id) AS strCol, id AS intCol, null as nullCol FROM range(3)` would look + like this: + + ``` strCol,intCol,nullCol id-1,1,null id-2,2,null id-3,3,null ``` + + [Apache Arrow streaming format]: https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format + [RFC 4180]: https://www.rfc-editor.org/rfc/rfc4180""" + + on_wait_timeout: Optional[ExecuteStatementRequestOnWaitTimeout] = None + """When `wait_timeout > 0s`, the call will block up to the specified time. If the statement + execution doesn't finish within this time, `on_wait_timeout` determines whether the execution + should continue or be canceled. When set to `CONTINUE`, the statement execution continues + asynchronously and the call returns a statement ID which can be used for polling with + :method:statementexecution/getStatement. When set to `CANCEL`, the statement execution is + canceled and the call returns with a `CANCELED` state.""" + + parameters: Optional[List[StatementParameterListItem]] = None + """A list of parameters to pass into a SQL statement containing parameter markers. A parameter + consists of a name, a value, and optionally a type. To represent a NULL value, the `value` field + may be omitted or set to `null` explicitly. If the `type` field is omitted, the value is + interpreted as a string. + + If the type is given, parameters will be checked for type correctness according to the given + type. A value is correct if the provided string can be converted to the requested type using the + `cast` function. The exact semantics are described in the section [`cast` function] of the SQL + language reference. + + For example, the following statement contains two parameters, `my_name` and `my_date`: + + SELECT * FROM my_table WHERE name = :my_name AND date = :my_date + + The parameters can be passed in the request body as follows: + + { ..., "statement": "SELECT * FROM my_table WHERE name = :my_name AND date = :my_date", + "parameters": [ { "name": "my_name", "value": "the name" }, { "name": "my_date", "value": + "2020-01-01", "type": "DATE" } ] } + + Currently, positional parameters denoted by a `?` marker are not supported by the Databricks SQL + Statement Execution API. + + Also see the section [Parameter markers] of the SQL language reference. + + [Parameter markers]: https://docs.databricks.com/sql/language-manual/sql-ref-parameter-marker.html + [`cast` function]: https://docs.databricks.com/sql/language-manual/functions/cast.html""" + row_limit: Optional[int] = None + """Applies the given row limit to the statement's result set, but unlike the `LIMIT` clause in SQL, + it also sets the `truncated` field in the response to indicate whether the result was trimmed + due to the limit or not.""" + schema: Optional[str] = None + """Sets default schema for statement execution, similar to [`USE SCHEMA`] in SQL. + + [`USE SCHEMA`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-schema.html""" + wait_timeout: Optional[str] = None + """The time in seconds the call will wait for the statement's result set as `Ns`, where `N` can be + set to 0 or to a value between 5 and 50. + + When set to `0s`, the statement will execute in asynchronous mode and the call will not wait for + the execution to finish. In this case, the call returns directly with `PENDING` state and a + statement ID which can be used for polling with :method:statementexecution/getStatement. + + When set between 5 and 50 seconds, the call will behave synchronously up to this timeout and + wait for the statement execution to finish. If the execution finishes within this time, the call + returns immediately with a manifest and result data (or a `FAILED` state in case of an execution + error). If the statement takes longer to execute, `on_wait_timeout` determines what should + happen after the timeout is reached.""" def as_dict(self) -> dict: + """Serializes the ExecuteStatementRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.byte_limit is not None: body['byte_limit'] = self.byte_limit if self.catalog is not None: body['catalog'] = self.catalog @@ -857,7 +1400,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExecuteStatementRequest': + def from_dict(cls, d: Dict[str, any]) -> ExecuteStatementRequest: + """Deserializes the ExecuteStatementRequest from a dictionary.""" return cls(byte_limit=d.get('byte_limit', None), catalog=d.get('catalog', None), disposition=_enum(d, 'disposition', Disposition), @@ -885,12 +1429,25 @@ class ExecuteStatementRequestOnWaitTimeout(Enum): @dataclass class ExecuteStatementResponse: - manifest: Optional['ResultManifest'] = None - result: Optional['ResultData'] = None + manifest: Optional[ResultManifest] = None + """The result manifest provides schema and metadata for the result set.""" + + result: Optional[ResultData] = None + """Contains the result data of a single chunk when using `INLINE` disposition. When using + `EXTERNAL_LINKS` disposition, the array `external_links` is used instead to provide presigned + URLs to the result data in cloud storage. Exactly one of these alternatives is used. (While the + `external_links` array prepares the API to return multiple links in a single response. Currently + only a single link is returned.)""" + statement_id: Optional[str] = None - status: Optional['StatementStatus'] = None + """The statement ID is returned upon successfully submitting a SQL statement, and is a required + reference for all subsequent calls.""" + + status: Optional[StatementStatus] = None + """The status response includes execution state and if relevant, error information.""" def as_dict(self) -> dict: + """Serializes the ExecuteStatementResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.manifest: body['manifest'] = self.manifest.as_dict() if self.result: body['result'] = self.result.as_dict() @@ -899,7 +1456,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExecuteStatementResponse': + def from_dict(cls, d: Dict[str, any]) -> ExecuteStatementResponse: + """Deserializes the ExecuteStatementResponse from a dictionary.""" return cls(manifest=_from_dict(d, 'manifest', ResultManifest), result=_from_dict(d, 'result', ResultData), statement_id=d.get('statement_id', None), @@ -909,15 +1467,38 @@ def from_dict(cls, d: Dict[str, any]) -> 'ExecuteStatementResponse': @dataclass class ExternalLink: byte_count: Optional[int] = None + """The number of bytes in the result chunk.""" + chunk_index: Optional[int] = None + """The position within the sequence of result set chunks.""" + expiration: Optional[str] = None + """Indicates the date-time that the given external link will expire and becomes invalid, after + which point a new `external_link` must be requested.""" + external_link: Optional[str] = None + """A presigned URL pointing to a chunk of result data, hosted by an external service, with a short + expiration time (<= 15 minutes). As this URL contains a temporary credential, it should be + considered sensitive and the client should expose this URL in a log.""" + next_chunk_index: Optional[int] = None + """When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are + no more chunks. The next chunk can be fetched with a + :method:statementexecution/getStatementResultChunkN request.""" + next_chunk_internal_link: Optional[str] = None + """When fetching, provides a link to fetch the _next_ chunk. If absent, indicates there are no more + chunks. This link is an absolute `path` to be joined with your `$DATABRICKS_HOST`, and should be + treated as an opaque link. This is an alternative to using `next_chunk_index`.""" + row_count: Optional[int] = None + """The number of rows within the result chunk.""" + row_offset: Optional[int] = None + """The starting row offset within the result set.""" def as_dict(self) -> dict: + """Serializes the ExternalLink into a dictionary suitable for use as a JSON request body.""" body = {} if self.byte_count is not None: body['byte_count'] = self.byte_count if self.chunk_index is not None: body['chunk_index'] = self.chunk_index @@ -931,7 +1512,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExternalLink': + def from_dict(cls, d: Dict[str, any]) -> ExternalLink: + """Deserializes the ExternalLink from a dictionary.""" return cls(byte_count=d.get('byte_count', None), chunk_index=d.get('chunk_index', None), expiration=d.get('expiration', None), @@ -951,11 +1533,16 @@ class Format(Enum): @dataclass class GetResponse: - access_control_list: Optional['List[AccessControl]'] = None + access_control_list: Optional[List[AccessControl]] = None + object_id: Optional[str] = None - object_type: Optional['ObjectType'] = None + """An object's type and UUID, separated by a forward slash (/) character.""" + + object_type: Optional[ObjectType] = None + """A singular noun object type.""" def as_dict(self) -> dict: + """Serializes the GetResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -964,7 +1551,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetResponse': + def from_dict(cls, d: Dict[str, any]) -> GetResponse: + """Deserializes the GetResponse from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', AccessControl), object_id=d.get('object_id', None), object_type=_enum(d, 'object_type', ObjectType)) @@ -972,12 +1560,25 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetResponse': @dataclass class GetStatementResponse: - manifest: Optional['ResultManifest'] = None - result: Optional['ResultData'] = None + manifest: Optional[ResultManifest] = None + """The result manifest provides schema and metadata for the result set.""" + + result: Optional[ResultData] = None + """Contains the result data of a single chunk when using `INLINE` disposition. When using + `EXTERNAL_LINKS` disposition, the array `external_links` is used instead to provide presigned + URLs to the result data in cloud storage. Exactly one of these alternatives is used. (While the + `external_links` array prepares the API to return multiple links in a single response. Currently + only a single link is returned.)""" + statement_id: Optional[str] = None - status: Optional['StatementStatus'] = None + """The statement ID is returned upon successfully submitting a SQL statement, and is a required + reference for all subsequent calls.""" + + status: Optional[StatementStatus] = None + """The status response includes execution state and if relevant, error information.""" def as_dict(self) -> dict: + """Serializes the GetStatementResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.manifest: body['manifest'] = self.manifest.as_dict() if self.result: body['result'] = self.result.as_dict() @@ -986,7 +1587,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetStatementResponse': + def from_dict(cls, d: Dict[str, any]) -> GetStatementResponse: + """Deserializes the GetStatementResponse from a dictionary.""" return cls(manifest=_from_dict(d, 'manifest', ResultManifest), result=_from_dict(d, 'result', ResultData), statement_id=d.get('statement_id', None), @@ -995,42 +1597,114 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetStatementResponse': @dataclass class GetWarehousePermissionLevelsResponse: - permission_levels: Optional['List[WarehousePermissionsDescription]'] = None + permission_levels: Optional[List[WarehousePermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetWarehousePermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetWarehousePermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetWarehousePermissionLevelsResponse: + """Deserializes the GetWarehousePermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', WarehousePermissionsDescription)) @dataclass class GetWarehouseResponse: auto_stop_mins: Optional[int] = None - channel: Optional['Channel'] = None + """The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) + before it is automatically stopped. + + Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. + + Defaults to 120 mins""" + + channel: Optional[Channel] = None + """Channel Details""" + cluster_size: Optional[str] = None + """Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows + you to run larger queries on it. If you want to increase the number of concurrent queries, + please tune max_num_clusters. + + Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large + - 4X-Large""" + creator_name: Optional[str] = None + """warehouse creator name""" + enable_photon: Optional[bool] = None + """Configures whether the warehouse should use Photon optimized clusters. + + Defaults to false.""" + enable_serverless_compute: Optional[bool] = None - health: Optional['EndpointHealth'] = None + """Configures whether the warehouse should use serverless compute""" + + health: Optional[EndpointHealth] = None + """Optional health status. Assume the warehouse is healthy if this field is not set.""" + id: Optional[str] = None + """unique identifier for warehouse""" + instance_profile_arn: Optional[str] = None + """Deprecated. Instance profile used to pass IAM role to the cluster""" + jdbc_url: Optional[str] = None + """the jdbc connection string for this warehouse""" + max_num_clusters: Optional[int] = None + """Maximum number of clusters that the autoscaler will create to handle concurrent queries. + + Supported values: - Must be >= min_num_clusters - Must be <= 30. + + Defaults to min_clusters if unset.""" + min_num_clusters: Optional[int] = None + """Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing + this will ensure that a larger number of clusters are always running and therefore may reduce + the cold start time for new queries. This is similar to reserved vs. revocable cores in a + resource manager. + + Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) + + Defaults to 1""" + name: Optional[str] = None + """Logical name for the cluster. + + Supported values: - Must be unique within an org. - Must be less than 100 characters.""" + num_active_sessions: Optional[int] = None + """current number of active sessions for the warehouse""" + num_clusters: Optional[int] = None - odbc_params: Optional['OdbcParams'] = None - spot_instance_policy: Optional['SpotInstancePolicy'] = None - state: Optional['State'] = None - tags: Optional['EndpointTags'] = None - warehouse_type: Optional['GetWarehouseResponseWarehouseType'] = None + """current number of clusters running for the service""" + + odbc_params: Optional[OdbcParams] = None + """ODBC parameters for the SQL warehouse""" + + spot_instance_policy: Optional[SpotInstancePolicy] = None + """Configurations whether the warehouse should use spot instances.""" + + state: Optional[State] = None + """State of the warehouse""" + + tags: Optional[EndpointTags] = None + """A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS + volumes) associated with this SQL warehouse. + + Supported values: - Number of tags < 45.""" + + warehouse_type: Optional[GetWarehouseResponseWarehouseType] = None + """Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` + and also set the field `enable_serverless_compute` to `true`.""" def as_dict(self) -> dict: + """Serializes the GetWarehouseResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.auto_stop_mins is not None: body['auto_stop_mins'] = self.auto_stop_mins if self.channel: body['channel'] = self.channel.as_dict() @@ -1057,7 +1731,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetWarehouseResponse': + def from_dict(cls, d: Dict[str, any]) -> GetWarehouseResponse: + """Deserializes the GetWarehouseResponse from a dictionary.""" return cls(auto_stop_mins=d.get('auto_stop_mins', None), channel=_from_dict(d, 'channel', Channel), cluster_size=d.get('cluster_size', None), @@ -1091,17 +1766,40 @@ class GetWarehouseResponseWarehouseType(Enum): @dataclass class GetWorkspaceWarehouseConfigResponse: - channel: Optional['Channel'] = None - config_param: Optional['RepeatedEndpointConfPairs'] = None - data_access_config: Optional['List[EndpointConfPair]'] = None - enabled_warehouse_types: Optional['List[WarehouseTypePair]'] = None - global_param: Optional['RepeatedEndpointConfPairs'] = None + channel: Optional[Channel] = None + """Optional: Channel selection details""" + + config_param: Optional[RepeatedEndpointConfPairs] = None + """Deprecated: Use sql_configuration_parameters""" + + data_access_config: Optional[List[EndpointConfPair]] = None + """Spark confs for external hive metastore configuration JSON serialized size must be less than <= + 512K""" + + enabled_warehouse_types: Optional[List[WarehouseTypePair]] = None + """List of Warehouse Types allowed in this workspace (limits allowed value of the type field in + CreateWarehouse and EditWarehouse). Note: Some types cannot be disabled, they don't need to be + specified in SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing warehouses + to be converted to another type. Used by frontend to save specific type availability in the + warehouse create and edit form UI.""" + + global_param: Optional[RepeatedEndpointConfPairs] = None + """Deprecated: Use sql_configuration_parameters""" + google_service_account: Optional[str] = None + """GCP only: Google Service Account used to pass to cluster to access Google Cloud Storage""" + instance_profile_arn: Optional[str] = None - security_policy: Optional['GetWorkspaceWarehouseConfigResponseSecurityPolicy'] = None - sql_configuration_parameters: Optional['RepeatedEndpointConfPairs'] = None + """AWS Only: Instance profile used to pass IAM role to the cluster""" + + security_policy: Optional[GetWorkspaceWarehouseConfigResponseSecurityPolicy] = None + """Security policy for warehouses""" + + sql_configuration_parameters: Optional[RepeatedEndpointConfPairs] = None + """SQL configuration parameters""" def as_dict(self) -> dict: + """Serializes the GetWorkspaceWarehouseConfigResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.channel: body['channel'] = self.channel.as_dict() if self.config_param: body['config_param'] = self.config_param.as_dict() @@ -1119,7 +1817,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetWorkspaceWarehouseConfigResponse': + def from_dict(cls, d: Dict[str, any]) -> GetWorkspaceWarehouseConfigResponse: + """Deserializes the GetWorkspaceWarehouseConfigResponse from a dictionary.""" return cls(channel=_from_dict(d, 'channel', Channel), config_param=_from_dict(d, 'config_param', RepeatedEndpointConfPairs), data_access_config=_repeated_dict(d, 'data_access_config', EndpointConfPair), @@ -1150,10 +1849,15 @@ class ListOrder(Enum): @dataclass class ListQueriesResponse: has_next_page: Optional[bool] = None + """Whether there is another page of results.""" + next_page_token: Optional[str] = None - res: Optional['List[QueryInfo]'] = None + """A token that can be used to get the next page of results.""" + + res: Optional[List[QueryInfo]] = None def as_dict(self) -> dict: + """Serializes the ListQueriesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.has_next_page is not None: body['has_next_page'] = self.has_next_page if self.next_page_token is not None: body['next_page_token'] = self.next_page_token @@ -1161,7 +1865,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListQueriesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListQueriesResponse: + """Deserializes the ListQueriesResponse from a dictionary.""" return cls(has_next_page=d.get('has_next_page', None), next_page_token=d.get('next_page_token', None), res=_repeated_dict(d, 'res', QueryInfo)) @@ -1170,11 +1875,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListQueriesResponse': @dataclass class ListResponse: count: Optional[int] = None + """The total number of dashboards.""" + page: Optional[int] = None + """The current page being displayed.""" + page_size: Optional[int] = None - results: Optional['List[Dashboard]'] = None + """The number of dashboards per page.""" + + results: Optional[List[Dashboard]] = None + """List of dashboards returned.""" def as_dict(self) -> dict: + """Serializes the ListResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.count is not None: body['count'] = self.count if self.page is not None: body['page'] = self.page @@ -1183,7 +1896,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListResponse': + def from_dict(cls, d: Dict[str, any]) -> ListResponse: + """Deserializes the ListResponse from a dictionary.""" return cls(count=d.get('count', None), page=d.get('page', None), page_size=d.get('page_size', None), @@ -1192,15 +1906,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'ListResponse': @dataclass class ListWarehousesResponse: - warehouses: Optional['List[EndpointInfo]'] = None + warehouses: Optional[List[EndpointInfo]] = None + """A list of warehouses and their configurations.""" def as_dict(self) -> dict: + """Serializes the ListWarehousesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.warehouses: body['warehouses'] = [v.as_dict() for v in self.warehouses] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListWarehousesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListWarehousesResponse: + """Deserializes the ListWarehousesResponse from a dictionary.""" return cls(warehouses=_repeated_dict(d, 'warehouses', EndpointInfo)) @@ -1225,11 +1942,15 @@ class ObjectTypePlural(Enum): @dataclass class OdbcParams: hostname: Optional[str] = None + path: Optional[str] = None + port: Optional[int] = None + protocol: Optional[str] = None def as_dict(self) -> dict: + """Serializes the OdbcParams into a dictionary suitable for use as a JSON request body.""" body = {} if self.hostname is not None: body['hostname'] = self.hostname if self.path is not None: body['path'] = self.path @@ -1238,7 +1959,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'OdbcParams': + def from_dict(cls, d: Dict[str, any]) -> OdbcParams: + """Deserializes the OdbcParams from a dictionary.""" return cls(hostname=d.get('hostname', None), path=d.get('path', None), port=d.get('port', None), @@ -1256,11 +1978,19 @@ class OwnableObjectType(Enum): @dataclass class Parameter: name: Optional[str] = None + """The literal parameter marker that appears between double curly braces in the query text.""" + title: Optional[str] = None - type: Optional['ParameterType'] = None + """The text displayed in a parameter picking widget.""" + + type: Optional[ParameterType] = None + """Parameters can have several different types.""" + value: Optional[Any] = None + """The default value for this parameter.""" def as_dict(self) -> dict: + """Serializes the Parameter into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.title is not None: body['title'] = self.title @@ -1269,7 +1999,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Parameter': + def from_dict(cls, d: Dict[str, any]) -> Parameter: + """Deserializes the Parameter from a dictionary.""" return cls(name=d.get('name', None), title=d.get('title', None), type=_enum(d, 'type', ParameterType), @@ -1307,31 +2038,82 @@ class PlansState(Enum): @dataclass class Query: can_edit: Optional[bool] = None + """Describes whether the authenticated user is allowed to edit the definition of this query.""" + created_at: Optional[str] = None + """The timestamp when this query was created.""" + data_source_id: Optional[str] = None + """Data source ID.""" + description: Optional[str] = None + """General description that conveys additional information about this query such as usage notes.""" + id: Optional[str] = None + """Query ID.""" + is_archived: Optional[bool] = None + """Indicates whether the query is trashed. Trashed queries can't be used in dashboards, or appear + in search results. If this boolean is `true`, the `options` property for this query includes a + `moved_to_trash_at` timestamp. Trashed queries are permanently deleted after 30 days.""" + is_draft: Optional[bool] = None + """Whether the query is a draft. Draft queries only appear in list views for their owners. + Visualizations from draft queries cannot appear on dashboards.""" + is_favorite: Optional[bool] = None + """Whether this query object appears in the current user's favorites list. This flag determines + whether the star icon for favorites is selected.""" + is_safe: Optional[bool] = None - last_modified_by: Optional['User'] = None + """Text parameter types are not safe from SQL injection for all types of data source. Set this + Boolean parameter to `true` if a query either does not use any text type parameters or uses a + data source type where text type parameters are handled safely.""" + + last_modified_by: Optional[User] = None + last_modified_by_id: Optional[int] = None + """The ID of the user who last saved changes to this query.""" + latest_query_data_id: Optional[str] = None + """If there is a cached result for this query and user, this field includes the query result ID. If + this query uses parameters, this field is always null.""" + name: Optional[str] = None - options: Optional['QueryOptions'] = None + """The title of this query that appears in list views, widget headings, and on the query page.""" + + options: Optional[QueryOptions] = None + parent: Optional[str] = None - permission_tier: Optional['PermissionLevel'] = None + """The identifier of the workspace folder containing the object.""" + + permission_tier: Optional[PermissionLevel] = None + """* `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * `CAN_MANAGE`: Can manage the + query""" + query: Optional[str] = None + """The text of the query to be run.""" + query_hash: Optional[str] = None - run_as_role: Optional['RunAsRole'] = None - tags: Optional['List[str]'] = None + """A SHA-256 hash of the query text along with the authenticated user ID.""" + + run_as_role: Optional[RunAsRole] = None + """Run as role""" + + tags: Optional[List[str]] = None + updated_at: Optional[str] = None - user: Optional['User'] = None + """The timestamp at which this query was last updated.""" + + user: Optional[User] = None + user_id: Optional[int] = None - visualizations: Optional['List[Visualization]'] = None + """The ID of the user who created this query.""" + + visualizations: Optional[List[Visualization]] = None def as_dict(self) -> dict: + """Serializes the Query into a dictionary suitable for use as a JSON request body.""" body = {} if self.can_edit is not None: body['can_edit'] = self.can_edit if self.created_at is not None: body['created_at'] = self.created_at @@ -1360,7 +2142,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Query': + def from_dict(cls, d: Dict[str, any]) -> Query: + """Deserializes the Query from a dictionary.""" return cls(can_edit=d.get('can_edit', None), created_at=d.get('created_at', None), data_source_id=d.get('data_source_id', None), @@ -1390,13 +2173,26 @@ def from_dict(cls, d: Dict[str, any]) -> 'Query': @dataclass class QueryEditContent: data_source_id: Optional[str] = None + """Data source ID.""" + description: Optional[str] = None + """General description that conveys additional information about this query such as usage notes.""" + name: Optional[str] = None + """The title of this query that appears in list views, widget headings, and on the query page.""" + options: Optional[Any] = None + """Exclusively used for storing a list parameter definitions. A parameter is an object with + `title`, `name`, `type`, and `value` properties. The `value` field here is the default value. It + can be overridden at runtime.""" + query: Optional[str] = None + """The text of the query to be run.""" + query_id: Optional[str] = None def as_dict(self) -> dict: + """Serializes the QueryEditContent into a dictionary suitable for use as a JSON request body.""" body = {} if self.data_source_id is not None: body['data_source_id'] = self.data_source_id if self.description is not None: body['description'] = self.description @@ -1407,7 +2203,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryEditContent': + def from_dict(cls, d: Dict[str, any]) -> QueryEditContent: + """Deserializes the QueryEditContent from a dictionary.""" return cls(data_source_id=d.get('data_source_id', None), description=d.get('description', None), name=d.get('name', None), @@ -1420,12 +2217,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'QueryEditContent': class QueryFilter: """A filter to limit query history results. This field is optional.""" - query_start_time_range: Optional['TimeRange'] = None - statuses: Optional['List[QueryStatus]'] = None - user_ids: Optional['List[int]'] = None - warehouse_ids: Optional['List[str]'] = None + query_start_time_range: Optional[TimeRange] = None + + statuses: Optional[List[QueryStatus]] = None + + user_ids: Optional[List[int]] = None + """A list of user IDs who ran the queries.""" + + warehouse_ids: Optional[List[str]] = None + """A list of warehouse IDs.""" def as_dict(self) -> dict: + """Serializes the QueryFilter into a dictionary suitable for use as a JSON request body.""" body = {} if self.query_start_time_range: body['query_start_time_range'] = self.query_start_time_range.as_dict() if self.statuses: body['statuses'] = [v.value for v in self.statuses] @@ -1434,7 +2237,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryFilter': + def from_dict(cls, d: Dict[str, any]) -> QueryFilter: + """Deserializes the QueryFilter from a dictionary.""" return cls(query_start_time_range=_from_dict(d, 'query_start_time_range', TimeRange), statuses=_repeated_enum(d, 'statuses', QueryStatus), user_ids=d.get('user_ids', None), @@ -1444,30 +2248,78 @@ def from_dict(cls, d: Dict[str, any]) -> 'QueryFilter': @dataclass class QueryInfo: can_subscribe_to_live_query: Optional[bool] = None - channel_used: Optional['ChannelInfo'] = None + """Reserved for internal use.""" + + channel_used: Optional[ChannelInfo] = None + """Channel information for the SQL warehouse at the time of query execution""" + duration: Optional[int] = None + """Total execution time of the query from the client’s point of view, in milliseconds.""" + endpoint_id: Optional[str] = None + """Alias for `warehouse_id`.""" + error_message: Optional[str] = None + """Message describing why the query could not complete.""" + executed_as_user_id: Optional[int] = None + """The ID of the user whose credentials were used to run the query.""" + executed_as_user_name: Optional[str] = None + """The email address or username of the user whose credentials were used to run the query.""" + execution_end_time_ms: Optional[int] = None + """The time execution of the query ended.""" + is_final: Optional[bool] = None + """Whether more updates for the query are expected.""" + lookup_key: Optional[str] = None - metrics: Optional['QueryMetrics'] = None - plans_state: Optional['PlansState'] = None + """A key that can be used to look up query details.""" + + metrics: Optional[QueryMetrics] = None + """Metrics about query execution.""" + + plans_state: Optional[PlansState] = None + """Whether plans exist for the execution, or the reason why they are missing""" + query_end_time_ms: Optional[int] = None + """The time the query ended.""" + query_id: Optional[str] = None + """The query ID.""" + query_start_time_ms: Optional[int] = None + """The time the query started.""" + query_text: Optional[str] = None + """The text of the query.""" + rows_produced: Optional[int] = None + """The number of results returned by the query.""" + spark_ui_url: Optional[str] = None - statement_type: Optional['QueryStatementType'] = None - status: Optional['QueryStatus'] = None + """URL to the query plan.""" + + statement_type: Optional[QueryStatementType] = None + """Type of statement for this query""" + + status: Optional[QueryStatus] = None + """Query status with one the following values: * `QUEUED`: Query has been received and queued. * + `RUNNING`: Query has started. * `CANCELED`: Query has been cancelled by the user. * `FAILED`: + Query has failed. * `FINISHED`: Query has completed.""" + user_id: Optional[int] = None + """The ID of the user who ran the query.""" + user_name: Optional[str] = None + """The email address or username of the user who ran the query.""" + warehouse_id: Optional[str] = None + """Warehouse ID.""" def as_dict(self) -> dict: + """Serializes the QueryInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.can_subscribe_to_live_query is not None: body['canSubscribeToLiveQuery'] = self.can_subscribe_to_live_query @@ -1496,7 +2348,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryInfo': + def from_dict(cls, d: Dict[str, any]) -> QueryInfo: + """Deserializes the QueryInfo from a dictionary.""" return cls(can_subscribe_to_live_query=d.get('canSubscribeToLiveQuery', None), channel_used=_from_dict(d, 'channel_used', ChannelInfo), duration=d.get('duration', None), @@ -1525,11 +2378,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'QueryInfo': @dataclass class QueryList: count: Optional[int] = None + """The total number of queries.""" + page: Optional[int] = None + """The page number that is currently displayed.""" + page_size: Optional[int] = None - results: Optional['List[Query]'] = None + """The number of queries per page.""" + + results: Optional[List[Query]] = None + """List of queries returned.""" def as_dict(self) -> dict: + """Serializes the QueryList into a dictionary suitable for use as a JSON request body.""" body = {} if self.count is not None: body['count'] = self.count if self.page is not None: body['page'] = self.page @@ -1538,7 +2399,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryList': + def from_dict(cls, d: Dict[str, any]) -> QueryList: + """Deserializes the QueryList from a dictionary.""" return cls(count=d.get('count', None), page=d.get('page', None), page_size=d.get('page_size', None), @@ -1550,33 +2412,88 @@ class QueryMetrics: """Metrics about query execution.""" compilation_time_ms: Optional[int] = None + """Time spent loading metadata and optimizing the query, in milliseconds.""" + execution_time_ms: Optional[int] = None + """Time spent executing the query, in milliseconds.""" + metadata_time_ms: Optional[int] = None + """Reserved for internal use.""" + network_sent_bytes: Optional[int] = None + """Total amount of data sent over the network between executor nodes during shuffle, in bytes.""" + overloading_queue_start_timestamp: Optional[int] = None + """Timestamp of when the query was enqueued waiting while the warehouse was at max load. This field + is optional and will not appear if the query skipped the overloading queue.""" + photon_total_time_ms: Optional[int] = None - planning_phases: Optional['List[Any]'] = None + """Total execution time for all individual Photon query engine tasks in the query, in milliseconds.""" + + planning_phases: Optional[List[Any]] = None + """Reserved for internal use.""" + planning_time_ms: Optional[int] = None + """Reserved for internal use.""" + provisioning_queue_start_timestamp: Optional[int] = None + """Timestamp of when the query was enqueued waiting for a cluster to be provisioned for the + warehouse. This field is optional and will not appear if the query skipped the provisioning + queue.""" + pruned_bytes: Optional[int] = None + """Total number of bytes in all tables not read due to pruning""" + pruned_files_count: Optional[int] = None + """Total number of files from all tables not read due to pruning""" + query_compilation_start_timestamp: Optional[int] = None + """Timestamp of when the underlying compute started compilation of the query.""" + query_execution_time_ms: Optional[int] = None + """Reserved for internal use.""" + read_bytes: Optional[int] = None + """Total size of data read by the query, in bytes.""" + read_cache_bytes: Optional[int] = None + """Size of persistent data read from the cache, in bytes.""" + read_files_count: Optional[int] = None + """Number of files read after pruning.""" + read_partitions_count: Optional[int] = None + """Number of partitions read after pruning.""" + read_remote_bytes: Optional[int] = None + """Size of persistent data read from cloud object storage on your cloud tenant, in bytes.""" + result_fetch_time_ms: Optional[int] = None + """Time spent fetching the query results after the execution finished, in milliseconds.""" + result_from_cache: Optional[bool] = None + """true if the query result was fetched from cache, false otherwise.""" + rows_produced_count: Optional[int] = None + """Total number of rows returned by the query.""" + rows_read_count: Optional[int] = None + """Total number of rows read by the query.""" + spill_to_disk_bytes: Optional[int] = None + """Size of data temporarily written to disk while executing the query, in bytes.""" + task_total_time_ms: Optional[int] = None + """Sum of execution time for all of the query’s tasks, in milliseconds.""" + total_time_ms: Optional[int] = None + """Total execution time of the query from the client’s point of view, in milliseconds.""" + write_remote_bytes: Optional[int] = None + """Size pf persistent data written to cloud object storage in your cloud tenant, in bytes.""" def as_dict(self) -> dict: + """Serializes the QueryMetrics into a dictionary suitable for use as a JSON request body.""" body = {} if self.compilation_time_ms is not None: body['compilation_time_ms'] = self.compilation_time_ms if self.execution_time_ms is not None: body['execution_time_ms'] = self.execution_time_ms @@ -1611,7 +2528,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryMetrics': + def from_dict(cls, d: Dict[str, any]) -> QueryMetrics: + """Deserializes the QueryMetrics from a dictionary.""" return cls(compilation_time_ms=d.get('compilation_time_ms', None), execution_time_ms=d.get('execution_time_ms', None), metadata_time_ms=d.get('metadata_time_ms', None), @@ -1643,16 +2561,21 @@ def from_dict(cls, d: Dict[str, any]) -> 'QueryMetrics': @dataclass class QueryOptions: moved_to_trash_at: Optional[str] = None - parameters: Optional['List[Parameter]'] = None + """The timestamp when this query was moved to trash. Only present when the `is_archived` property + is `true`. Trashed items are deleted after thirty days.""" + + parameters: Optional[List[Parameter]] = None def as_dict(self) -> dict: + """Serializes the QueryOptions into a dictionary suitable for use as a JSON request body.""" body = {} if self.moved_to_trash_at is not None: body['moved_to_trash_at'] = self.moved_to_trash_at if self.parameters: body['parameters'] = [v.as_dict() for v in self.parameters] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryOptions': + def from_dict(cls, d: Dict[str, any]) -> QueryOptions: + """Deserializes the QueryOptions from a dictionary.""" return cls(moved_to_trash_at=d.get('moved_to_trash_at', None), parameters=_repeated_dict(d, 'parameters', Parameter)) @@ -1660,14 +2583,30 @@ def from_dict(cls, d: Dict[str, any]) -> 'QueryOptions': @dataclass class QueryPostContent: data_source_id: Optional[str] = None + """Data source ID.""" + description: Optional[str] = None + """General description that conveys additional information about this query such as usage notes.""" + name: Optional[str] = None + """The title of this query that appears in list views, widget headings, and on the query page.""" + options: Optional[Any] = None + """Exclusively used for storing a list parameter definitions. A parameter is an object with + `title`, `name`, `type`, and `value` properties. The `value` field here is the default value. It + can be overridden at runtime.""" + parent: Optional[str] = None + """The identifier of the workspace folder containing the object.""" + query: Optional[str] = None - run_as_role: Optional['RunAsRole'] = None + """The text of the query to be run.""" + + run_as_role: Optional[RunAsRole] = None + """Run as role""" def as_dict(self) -> dict: + """Serializes the QueryPostContent into a dictionary suitable for use as a JSON request body.""" body = {} if self.data_source_id is not None: body['data_source_id'] = self.data_source_id if self.description is not None: body['description'] = self.description @@ -1679,7 +2618,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'QueryPostContent': + def from_dict(cls, d: Dict[str, any]) -> QueryPostContent: + """Deserializes the QueryPostContent from a dictionary.""" return cls(data_source_id=d.get('data_source_id', None), description=d.get('description', None), name=d.get('name', None), @@ -1730,10 +2670,13 @@ class QueryStatus(Enum): @dataclass class RepeatedEndpointConfPairs: - config_pair: Optional['List[EndpointConfPair]'] = None - configuration_pairs: Optional['List[EndpointConfPair]'] = None + config_pair: Optional[List[EndpointConfPair]] = None + """Deprecated: Use configuration_pairs""" + + configuration_pairs: Optional[List[EndpointConfPair]] = None def as_dict(self) -> dict: + """Serializes the RepeatedEndpointConfPairs into a dictionary suitable for use as a JSON request body.""" body = {} if self.config_pair: body['config_pair'] = [v.as_dict() for v in self.config_pair] if self.configuration_pairs: @@ -1741,7 +2684,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepeatedEndpointConfPairs': + def from_dict(cls, d: Dict[str, any]) -> RepeatedEndpointConfPairs: + """Deserializes the RepeatedEndpointConfPairs from a dictionary.""" return cls(config_pair=_repeated_dict(d, 'config_pair', EndpointConfPair), configuration_pairs=_repeated_dict(d, 'configuration_pairs', EndpointConfPair)) @@ -1755,15 +2699,35 @@ class ResultData: only a single link is returned.)""" byte_count: Optional[int] = None + """The number of bytes in the result chunk.""" + chunk_index: Optional[int] = None - data_array: Optional['List[List[str]]'] = None - external_links: Optional['List[ExternalLink]'] = None + """The position within the sequence of result set chunks.""" + + data_array: Optional[List[List[str]]] = None + """The `JSON_ARRAY` format is an array of arrays of values, where each non-null value is formatted + as a string. Null values are encoded as JSON `null`.""" + + external_links: Optional[List[ExternalLink]] = None + next_chunk_index: Optional[int] = None + """When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are + no more chunks. The next chunk can be fetched with a + :method:statementexecution/getStatementResultChunkN request.""" + next_chunk_internal_link: Optional[str] = None + """When fetching, provides a link to fetch the _next_ chunk. If absent, indicates there are no more + chunks. This link is an absolute `path` to be joined with your `$DATABRICKS_HOST`, and should be + treated as an opaque link. This is an alternative to using `next_chunk_index`.""" + row_count: Optional[int] = None + """The number of rows within the result chunk.""" + row_offset: Optional[int] = None + """The starting row offset within the result set.""" def as_dict(self) -> dict: + """Serializes the ResultData into a dictionary suitable for use as a JSON request body.""" body = {} if self.byte_count is not None: body['byte_count'] = self.byte_count if self.chunk_index is not None: body['chunk_index'] = self.chunk_index @@ -1777,7 +2741,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResultData': + def from_dict(cls, d: Dict[str, any]) -> ResultData: + """Deserializes the ResultData from a dictionary.""" return cls(byte_count=d.get('byte_count', None), chunk_index=d.get('chunk_index', None), data_array=d.get('data_array', None), @@ -1792,15 +2757,29 @@ def from_dict(cls, d: Dict[str, any]) -> 'ResultData': class ResultManifest: """The result manifest provides schema and metadata for the result set.""" - chunks: Optional['List[BaseChunkInfo]'] = None - format: Optional['Format'] = None - schema: Optional['ResultSchema'] = None + chunks: Optional[List[BaseChunkInfo]] = None + """Array of result set chunk metadata.""" + + format: Optional[Format] = None + + schema: Optional[ResultSchema] = None + """The schema is an ordered list of column descriptions.""" + total_byte_count: Optional[int] = None + """The total number of bytes in the result set. This field is not available when using `INLINE` + disposition.""" + total_chunk_count: Optional[int] = None + """The total number of chunks that the result set has been divided into.""" + total_row_count: Optional[int] = None + """The total number of rows in the result set.""" + truncated: Optional[bool] = None + """Indicates whether the result is truncated due to `row_limit` or `byte_limit`.""" def as_dict(self) -> dict: + """Serializes the ResultManifest into a dictionary suitable for use as a JSON request body.""" body = {} if self.chunks: body['chunks'] = [v.as_dict() for v in self.chunks] if self.format is not None: body['format'] = self.format.value @@ -1812,7 +2791,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResultManifest': + def from_dict(cls, d: Dict[str, any]) -> ResultManifest: + """Deserializes the ResultManifest from a dictionary.""" return cls(chunks=_repeated_dict(d, 'chunks', BaseChunkInfo), format=_enum(d, 'format', Format), schema=_from_dict(d, 'schema', ResultSchema), @@ -1827,16 +2807,19 @@ class ResultSchema: """The schema is an ordered list of column descriptions.""" column_count: Optional[int] = None - columns: Optional['List[ColumnInfo]'] = None + + columns: Optional[List[ColumnInfo]] = None def as_dict(self) -> dict: + """Serializes the ResultSchema into a dictionary suitable for use as a JSON request body.""" body = {} if self.column_count is not None: body['column_count'] = self.column_count if self.columns: body['columns'] = [v.as_dict() for v in self.columns] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ResultSchema': + def from_dict(cls, d: Dict[str, any]) -> ResultSchema: + """Deserializes the ResultSchema from a dictionary.""" return cls(column_count=d.get('column_count', None), columns=_repeated_dict(d, 'columns', ColumnInfo)) @@ -1849,17 +2832,21 @@ class RunAsRole(Enum): @dataclass class ServiceError: - error_code: Optional['ServiceErrorCode'] = None + error_code: Optional[ServiceErrorCode] = None + message: Optional[str] = None + """A brief summary of the error condition.""" def as_dict(self) -> dict: + """Serializes the ServiceError into a dictionary suitable for use as a JSON request body.""" body = {} if self.error_code is not None: body['error_code'] = self.error_code.value if self.message is not None: body['message'] = self.message return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ServiceError': + def from_dict(cls, d: Dict[str, any]) -> ServiceError: + """Deserializes the ServiceError from a dictionary.""" return cls(error_code=_enum(d, 'error_code', ServiceErrorCode), message=d.get('message', None)) @@ -1883,11 +2870,16 @@ class ServiceErrorCode(Enum): @dataclass class SetResponse: - access_control_list: Optional['List[AccessControl]'] = None + access_control_list: Optional[List[AccessControl]] = None + object_id: Optional[str] = None - object_type: Optional['ObjectType'] = None + """An object's type and UUID, separated by a forward slash (/) character.""" + + object_type: Optional[ObjectType] = None + """A singular noun object type.""" def as_dict(self) -> dict: + """Serializes the SetResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -1896,7 +2888,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetResponse': + def from_dict(cls, d: Dict[str, any]) -> SetResponse: + """Deserializes the SetResponse from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', AccessControl), object_id=d.get('object_id', None), object_type=_enum(d, 'object_type', ObjectType)) @@ -1904,17 +2897,40 @@ def from_dict(cls, d: Dict[str, any]) -> 'SetResponse': @dataclass class SetWorkspaceWarehouseConfigRequest: - channel: Optional['Channel'] = None - config_param: Optional['RepeatedEndpointConfPairs'] = None - data_access_config: Optional['List[EndpointConfPair]'] = None - enabled_warehouse_types: Optional['List[WarehouseTypePair]'] = None - global_param: Optional['RepeatedEndpointConfPairs'] = None + channel: Optional[Channel] = None + """Optional: Channel selection details""" + + config_param: Optional[RepeatedEndpointConfPairs] = None + """Deprecated: Use sql_configuration_parameters""" + + data_access_config: Optional[List[EndpointConfPair]] = None + """Spark confs for external hive metastore configuration JSON serialized size must be less than <= + 512K""" + + enabled_warehouse_types: Optional[List[WarehouseTypePair]] = None + """List of Warehouse Types allowed in this workspace (limits allowed value of the type field in + CreateWarehouse and EditWarehouse). Note: Some types cannot be disabled, they don't need to be + specified in SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing warehouses + to be converted to another type. Used by frontend to save specific type availability in the + warehouse create and edit form UI.""" + + global_param: Optional[RepeatedEndpointConfPairs] = None + """Deprecated: Use sql_configuration_parameters""" + google_service_account: Optional[str] = None + """GCP only: Google Service Account used to pass to cluster to access Google Cloud Storage""" + instance_profile_arn: Optional[str] = None - security_policy: Optional['SetWorkspaceWarehouseConfigRequestSecurityPolicy'] = None - sql_configuration_parameters: Optional['RepeatedEndpointConfPairs'] = None + """AWS Only: Instance profile used to pass IAM role to the cluster""" + + security_policy: Optional[SetWorkspaceWarehouseConfigRequestSecurityPolicy] = None + """Security policy for warehouses""" + + sql_configuration_parameters: Optional[RepeatedEndpointConfPairs] = None + """SQL configuration parameters""" def as_dict(self) -> dict: + """Serializes the SetWorkspaceWarehouseConfigRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.channel: body['channel'] = self.channel.as_dict() if self.config_param: body['config_param'] = self.config_param.as_dict() @@ -1932,7 +2948,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SetWorkspaceWarehouseConfigRequest': + def from_dict(cls, d: Dict[str, any]) -> SetWorkspaceWarehouseConfigRequest: + """Deserializes the SetWorkspaceWarehouseConfigRequest from a dictionary.""" return cls(channel=_from_dict(d, 'channel', Channel), config_param=_from_dict(d, 'config_param', RepeatedEndpointConfPairs), data_access_config=_repeated_dict(d, 'data_access_config', EndpointConfPair), @@ -1976,10 +2993,19 @@ class State(Enum): @dataclass class StatementParameterListItem: name: str + """The name of a parameter marker to be substituted in the statement.""" + type: Optional[str] = None + """The data type, given as a string. For example: `INT`, `STRING`, `DECIMAL(10,2)`. If no type is + given the type is assumed to be `STRING`. Complex types, such as `ARRAY`, `MAP`, and `STRUCT` + are not supported. For valid types, refer to the section [Data + types](/sql/language-manual/functions/cast.html) of the SQL language reference.""" + value: Optional[str] = None + """The value to substitute, represented as a string. If omitted, the value is interpreted as NULL.""" def as_dict(self) -> dict: + """Serializes the StatementParameterListItem into a dictionary suitable for use as a JSON request body.""" body = {} if self.name is not None: body['name'] = self.name if self.type is not None: body['type'] = self.type @@ -1987,7 +3013,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StatementParameterListItem': + def from_dict(cls, d: Dict[str, any]) -> StatementParameterListItem: + """Deserializes the StatementParameterListItem from a dictionary.""" return cls(name=d.get('name', None), type=d.get('type', None), value=d.get('value', None)) @@ -2010,17 +3037,25 @@ class StatementState(Enum): class StatementStatus: """The status response includes execution state and if relevant, error information.""" - error: Optional['ServiceError'] = None - state: Optional['StatementState'] = None + error: Optional[ServiceError] = None + + state: Optional[StatementState] = None + """Statement execution state: - `PENDING`: waiting for warehouse - `RUNNING`: running - + `SUCCEEDED`: execution was successful, result data available for fetch - `FAILED`: execution + failed; reason for failure described in accomanying error message - `CANCELED`: user canceled; + can come from explicit cancel call, or timeout with `on_wait_timeout=CANCEL` - `CLOSED`: + execution successful, and statement closed; result no longer available for fetch""" def as_dict(self) -> dict: + """Serializes the StatementStatus into a dictionary suitable for use as a JSON request body.""" body = {} if self.error: body['error'] = self.error.as_dict() if self.state is not None: body['state'] = self.state.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'StatementStatus': + def from_dict(cls, d: Dict[str, any]) -> StatementStatus: + """Deserializes the StatementStatus from a dictionary.""" return cls(error=_from_dict(d, 'error', ServiceError), state=_enum(d, 'state', StatementState)) @@ -2035,15 +3070,17 @@ class Status(Enum): @dataclass class Success: - message: Optional['SuccessMessage'] = None + message: Optional[SuccessMessage] = None def as_dict(self) -> dict: + """Serializes the Success into a dictionary suitable for use as a JSON request body.""" body = {} if self.message is not None: body['message'] = self.message.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Success': + def from_dict(cls, d: Dict[str, any]) -> Success: + """Deserializes the Success from a dictionary.""" return cls(message=_enum(d, 'message', SuccessMessage)) @@ -2054,11 +3091,17 @@ class SuccessMessage(Enum): @dataclass class TerminationReason: - code: Optional['TerminationReasonCode'] = None - parameters: Optional['Dict[str,str]'] = None - type: Optional['TerminationReasonType'] = None + code: Optional[TerminationReasonCode] = None + """status code indicating why the cluster was terminated""" + + parameters: Optional[Dict[str, str]] = None + """list of parameters that provide additional information about why the cluster was terminated""" + + type: Optional[TerminationReasonType] = None + """type of the termination""" def as_dict(self) -> dict: + """Serializes the TerminationReason into a dictionary suitable for use as a JSON request body.""" body = {} if self.code is not None: body['code'] = self.code.value if self.parameters: body['parameters'] = self.parameters @@ -2066,7 +3109,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TerminationReason': + def from_dict(cls, d: Dict[str, any]) -> TerminationReason: + """Deserializes the TerminationReason from a dictionary.""" return cls(code=_enum(d, 'code', TerminationReasonCode), parameters=d.get('parameters', None), type=_enum(d, 'type', TerminationReasonType)) @@ -2168,40 +3212,51 @@ class TerminationReasonType(Enum): @dataclass class TimeRange: end_time_ms: Optional[int] = None + """Limit results to queries that started before this time.""" + start_time_ms: Optional[int] = None + """Limit results to queries that started after this time.""" def as_dict(self) -> dict: + """Serializes the TimeRange into a dictionary suitable for use as a JSON request body.""" body = {} if self.end_time_ms is not None: body['end_time_ms'] = self.end_time_ms if self.start_time_ms is not None: body['start_time_ms'] = self.start_time_ms return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TimeRange': + def from_dict(cls, d: Dict[str, any]) -> TimeRange: + """Deserializes the TimeRange from a dictionary.""" return cls(end_time_ms=d.get('end_time_ms', None), start_time_ms=d.get('start_time_ms', None)) @dataclass class TransferOwnershipObjectId: new_owner: Optional[str] = None + """Email address for the new owner, who must exist in the workspace.""" def as_dict(self) -> dict: + """Serializes the TransferOwnershipObjectId into a dictionary suitable for use as a JSON request body.""" body = {} if self.new_owner is not None: body['new_owner'] = self.new_owner return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'TransferOwnershipObjectId': + def from_dict(cls, d: Dict[str, any]) -> TransferOwnershipObjectId: + """Deserializes the TransferOwnershipObjectId from a dictionary.""" return cls(new_owner=d.get('new_owner', None)) @dataclass class User: email: Optional[str] = None + id: Optional[int] = None + name: Optional[str] = None def as_dict(self) -> dict: + """Serializes the User into a dictionary suitable for use as a JSON request body.""" body = {} if self.email is not None: body['email'] = self.email if self.id is not None: body['id'] = self.id @@ -2209,7 +3264,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'User': + def from_dict(cls, d: Dict[str, any]) -> User: + """Deserializes the User from a dictionary.""" return cls(email=d.get('email', None), id=d.get('id', None), name=d.get('name', None)) @@ -2221,14 +3277,27 @@ class Visualization: constructing ad-hoc visualizations entirely in JSON.""" created_at: Optional[str] = None + description: Optional[str] = None + """A short description of this visualization. This is not displayed in the UI.""" + id: Optional[str] = None + """The UUID for this visualization.""" + name: Optional[str] = None + """The name of the visualization that appears on dashboards and the query screen.""" + options: Optional[Any] = None + """The options object varies widely from one visualization type to the next and is unsupported. + Databricks does not recommend modifying visualization settings in JSON.""" + type: Optional[str] = None + """The type of visualization: chart, table, pivot table, and so on.""" + updated_at: Optional[str] = None def as_dict(self) -> dict: + """Serializes the Visualization into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.description is not None: body['description'] = self.description @@ -2240,7 +3309,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Visualization': + def from_dict(cls, d: Dict[str, any]) -> Visualization: + """Deserializes the Visualization from a dictionary.""" return cls(created_at=d.get('created_at', None), description=d.get('description', None), id=d.get('id', None), @@ -2253,11 +3323,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'Visualization': @dataclass class WarehouseAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['WarehousePermissionLevel'] = None + """name of the group""" + + permission_level: Optional[WarehousePermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the WarehouseAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -2267,7 +3346,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehouseAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> WarehouseAccessControlRequest: + """Deserializes the WarehouseAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', WarehousePermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -2276,13 +3356,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'WarehouseAccessControlRequest': @dataclass class WarehouseAccessControlResponse: - all_permissions: Optional['List[WarehousePermission]'] = None + all_permissions: Optional[List[WarehousePermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the WarehouseAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -2293,7 +3383,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehouseAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> WarehouseAccessControlResponse: + """Deserializes the WarehouseAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', WarehousePermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -2304,10 +3395,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'WarehouseAccessControlResponse': @dataclass class WarehousePermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['WarehousePermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[WarehousePermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the WarehousePermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -2315,7 +3410,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehousePermission': + def from_dict(cls, d: Dict[str, any]) -> WarehousePermission: + """Deserializes the WarehousePermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', WarehousePermissionLevel)) @@ -2331,11 +3427,14 @@ class WarehousePermissionLevel(Enum): @dataclass class WarehousePermissions: - access_control_list: Optional['List[WarehouseAccessControlResponse]'] = None + access_control_list: Optional[List[WarehouseAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the WarehousePermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -2344,7 +3443,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehousePermissions': + def from_dict(cls, d: Dict[str, any]) -> WarehousePermissions: + """Deserializes the WarehousePermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', WarehouseAccessControlResponse), object_id=d.get('object_id', None), @@ -2354,26 +3454,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'WarehousePermissions': @dataclass class WarehousePermissionsDescription: description: Optional[str] = None - permission_level: Optional['WarehousePermissionLevel'] = None + + permission_level: Optional[WarehousePermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the WarehousePermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehousePermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> WarehousePermissionsDescription: + """Deserializes the WarehousePermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', WarehousePermissionLevel)) @dataclass class WarehousePermissionsRequest: - access_control_list: Optional['List[WarehouseAccessControlRequest]'] = None + access_control_list: Optional[List[WarehouseAccessControlRequest]] = None + warehouse_id: Optional[str] = None + """The SQL warehouse for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the WarehousePermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -2381,7 +3488,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehousePermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> WarehousePermissionsRequest: + """Deserializes the WarehousePermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', WarehouseAccessControlRequest), warehouse_id=d.get('warehouse_id', None)) @@ -2390,16 +3498,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'WarehousePermissionsRequest': @dataclass class WarehouseTypePair: enabled: Optional[bool] = None - warehouse_type: Optional['WarehouseTypePairWarehouseType'] = None + """If set to false the specific warehouse type will not be be allowed as a value for warehouse_type + in CreateWarehouse and EditWarehouse""" + + warehouse_type: Optional[WarehouseTypePairWarehouseType] = None + """Warehouse type: `PRO` or `CLASSIC`.""" def as_dict(self) -> dict: + """Serializes the WarehouseTypePair into a dictionary suitable for use as a JSON request body.""" body = {} if self.enabled is not None: body['enabled'] = self.enabled if self.warehouse_type is not None: body['warehouse_type'] = self.warehouse_type.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WarehouseTypePair': + def from_dict(cls, d: Dict[str, any]) -> WarehouseTypePair: + """Deserializes the WarehouseTypePair from a dictionary.""" return cls(enabled=d.get('enabled', None), warehouse_type=_enum(d, 'warehouse_type', WarehouseTypePairWarehouseType)) @@ -2415,11 +3529,21 @@ class WarehouseTypePairWarehouseType(Enum): @dataclass class Widget: id: Optional[str] = None - options: Optional['WidgetOptions'] = None - visualization: Optional['Visualization'] = None + """The unique ID for this widget.""" + + options: Optional[WidgetOptions] = None + + visualization: Optional[Visualization] = None + """The visualization description API changes frequently and is unsupported. You can duplicate a + visualization by copying description objects received _from the API_ and then using them to + create a new one with a POST request to the same endpoint. Databricks does not recommend + constructing ad-hoc visualizations entirely in JSON.""" + width: Optional[int] = None + """Unused field.""" def as_dict(self) -> dict: + """Serializes the Widget into a dictionary suitable for use as a JSON request body.""" body = {} if self.id is not None: body['id'] = self.id if self.options: body['options'] = self.options.as_dict() @@ -2428,7 +3552,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Widget': + def from_dict(cls, d: Dict[str, any]) -> Widget: + """Deserializes the Widget from a dictionary.""" return cls(id=d.get('id', None), options=_from_dict(d, 'options', WidgetOptions), visualization=_from_dict(d, 'visualization', Visualization), @@ -2438,14 +3563,30 @@ def from_dict(cls, d: Dict[str, any]) -> 'Widget': @dataclass class WidgetOptions: created_at: Optional[str] = None + """Timestamp when this object was created""" + description: Optional[str] = None + """Custom description of the widget""" + is_hidden: Optional[bool] = None + """Whether this widget is hidden on the dashboard.""" + parameter_mappings: Optional[Any] = None - position: Optional['WidgetPosition'] = None + """How parameters used by the visualization in this widget relate to other widgets on the + dashboard. Databricks does not recommend modifying this definition in JSON.""" + + position: Optional[WidgetPosition] = None + """Coordinates of this widget on a dashboard. This portion of the API changes frequently and is + unsupported.""" + title: Optional[str] = None + """Custom title of the widget""" + updated_at: Optional[str] = None + """Timestamp of the last time this object was updated.""" def as_dict(self) -> dict: + """Serializes the WidgetOptions into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.description is not None: body['description'] = self.description @@ -2457,7 +3598,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WidgetOptions': + def from_dict(cls, d: Dict[str, any]) -> WidgetOptions: + """Deserializes the WidgetOptions from a dictionary.""" return cls(created_at=d.get('created_at', None), description=d.get('description', None), is_hidden=d.get('isHidden', None), @@ -2473,12 +3615,22 @@ class WidgetPosition: unsupported.""" auto_height: Optional[bool] = None + """reserved for internal use""" + col: Optional[int] = None + """column in the dashboard grid. Values start with 0""" + row: Optional[int] = None + """row in the dashboard grid. Values start with 0""" + size_x: Optional[int] = None + """width of the widget measured in dashboard grid cells""" + size_y: Optional[int] = None + """height of the widget measured in dashboard grid cells""" def as_dict(self) -> dict: + """Serializes the WidgetPosition into a dictionary suitable for use as a JSON request body.""" body = {} if self.auto_height is not None: body['autoHeight'] = self.auto_height if self.col is not None: body['col'] = self.col @@ -2488,7 +3640,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WidgetPosition': + def from_dict(cls, d: Dict[str, any]) -> WidgetPosition: + """Deserializes the WidgetPosition from a dictionary.""" return cls(auto_height=d.get('autoHeight', None), col=d.get('col', None), row=d.get('row', None), @@ -2569,7 +3722,7 @@ def get(self, alert_id: str) -> Alert: res = self._api.do('GET', f'/api/2.0/preview/sql/alerts/{alert_id}', headers=headers) return Alert.from_dict(res) - def list(self) -> Iterator['Alert']: + def list(self) -> Iterator[Alert]: """Get alerts. Gets a list of alerts. @@ -2779,7 +3932,7 @@ def list(self, order: Optional[ListOrder] = None, page: Optional[int] = None, page_size: Optional[int] = None, - q: Optional[str] = None) -> Iterator['Dashboard']: + q: Optional[str] = None) -> Iterator[Dashboard]: """Get dashboard objects. Fetch a paginated list of dashboard objects. @@ -2844,7 +3997,7 @@ class DataSourcesAPI: def __init__(self, api_client): self._api = api_client - def list(self) -> Iterator['DataSource']: + def list(self) -> Iterator[DataSource]: """Get a list of SQL warehouses. Retrieves a full list of SQL warehouses available in this workspace. All fields that appear in this @@ -3043,7 +4196,7 @@ def list(self, order: Optional[str] = None, page: Optional[int] = None, page_size: Optional[int] = None, - q: Optional[str] = None) -> Iterator['Query']: + q: Optional[str] = None) -> Iterator[Query]: """Get a list of queries. Gets a list of queries. Optionally, this list can be filtered by a search term. @@ -3160,7 +4313,7 @@ def list(self, filter_by: Optional[QueryFilter] = None, include_metrics: Optional[bool] = None, max_results: Optional[int] = None, - page_token: Optional[str] = None) -> Iterator['QueryInfo']: + page_token: Optional[str] = None) -> Iterator[QueryInfo]: """List Queries. List the history of queries through SQL warehouses. @@ -3998,7 +5151,7 @@ def get_workspace_warehouse_config(self) -> GetWorkspaceWarehouseConfigResponse: res = self._api.do('GET', '/api/2.0/sql/config/warehouses', headers=headers) return GetWorkspaceWarehouseConfigResponse.from_dict(res) - def list(self, *, run_as_user_id: Optional[int] = None) -> Iterator['EndpointInfo']: + def list(self, *, run_as_user_id: Optional[int] = None) -> Iterator[EndpointInfo]: """List warehouses. Lists all SQL warehouses that a user has manager permissions on. diff --git a/databricks/sdk/service/workspace.py b/databricks/sdk/service/workspace.py index f0c18ac1c..a5277a7b2 100755 --- a/databricks/sdk/service/workspace.py +++ b/databricks/sdk/service/workspace.py @@ -1,5 +1,7 @@ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. +from __future__ import annotations + import logging from dataclasses import dataclass from enum import Enum @@ -15,16 +17,21 @@ @dataclass class AclItem: principal: str - permission: 'AclPermission' + """The principal in which the permission is applied.""" + + permission: AclPermission + """The permission level applied to the principal.""" def as_dict(self) -> dict: + """Serializes the AclItem into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission is not None: body['permission'] = self.permission.value if self.principal is not None: body['principal'] = self.principal return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AclItem': + def from_dict(cls, d: Dict[str, any]) -> AclItem: + """Deserializes the AclItem from a dictionary.""" return cls(permission=_enum(d, 'permission', AclPermission), principal=d.get('principal', None)) @@ -38,26 +45,39 @@ class AclPermission(Enum): @dataclass class AzureKeyVaultSecretScopeMetadata: resource_id: str + """The resource id of the azure KeyVault that user wants to associate the scope with.""" + dns_name: str + """The DNS of the KeyVault""" def as_dict(self) -> dict: + """Serializes the AzureKeyVaultSecretScopeMetadata into a dictionary suitable for use as a JSON request body.""" body = {} if self.dns_name is not None: body['dns_name'] = self.dns_name if self.resource_id is not None: body['resource_id'] = self.resource_id return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'AzureKeyVaultSecretScopeMetadata': + def from_dict(cls, d: Dict[str, any]) -> AzureKeyVaultSecretScopeMetadata: + """Deserializes the AzureKeyVaultSecretScopeMetadata from a dictionary.""" return cls(dns_name=d.get('dns_name', None), resource_id=d.get('resource_id', None)) @dataclass class CreateCredentials: git_provider: str + """Git provider. This field is case-insensitive. The available Git providers are gitHub, + bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, + gitLabEnterpriseEdition and awsCodeCommit.""" + git_username: Optional[str] = None + """Git username.""" + personal_access_token: Optional[str] = None + """The personal access token used to authenticate to the corresponding Git provider.""" def as_dict(self) -> dict: + """Serializes the CreateCredentials into a dictionary suitable for use as a JSON request body.""" body = {} if self.git_provider is not None: body['git_provider'] = self.git_provider if self.git_username is not None: body['git_username'] = self.git_username @@ -65,7 +85,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentials': + def from_dict(cls, d: Dict[str, any]) -> CreateCredentials: + """Deserializes the CreateCredentials from a dictionary.""" return cls(git_provider=d.get('git_provider', None), git_username=d.get('git_username', None), personal_access_token=d.get('personal_access_token', None)) @@ -74,10 +95,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentials': @dataclass class CreateCredentialsResponse: credential_id: Optional[int] = None + """ID of the credential object in the workspace.""" + git_provider: Optional[str] = None + """Git provider. This field is case-insensitive. The available Git providers are gitHub, + bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, + gitLabEnterpriseEdition and awsCodeCommit.""" + git_username: Optional[str] = None + """Git username.""" def as_dict(self) -> dict: + """Serializes the CreateCredentialsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_id is not None: body['credential_id'] = self.credential_id if self.git_provider is not None: body['git_provider'] = self.git_provider @@ -85,7 +114,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentialsResponse': + def from_dict(cls, d: Dict[str, any]) -> CreateCredentialsResponse: + """Deserializes the CreateCredentialsResponse from a dictionary.""" return cls(credential_id=d.get('credential_id', None), git_provider=d.get('git_provider', None), git_username=d.get('git_username', None)) @@ -94,11 +124,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateCredentialsResponse': @dataclass class CreateRepo: url: str + """URL of the Git repository to be linked.""" + provider: str + """Git provider. This field is case-insensitive. The available Git providers are gitHub, + bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, + gitLabEnterpriseEdition and awsCodeCommit.""" + path: Optional[str] = None - sparse_checkout: Optional['SparseCheckout'] = None + """Desired path for the repo in the workspace. Must be in the format /Repos/{folder}/{repo-name}.""" + + sparse_checkout: Optional[SparseCheckout] = None + """If specified, the repo will be created with sparse checkout enabled. You cannot enable/disable + sparse checkout after the repo is created.""" def as_dict(self) -> dict: + """Serializes the CreateRepo into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path if self.provider is not None: body['provider'] = self.provider @@ -107,7 +148,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateRepo': + def from_dict(cls, d: Dict[str, any]) -> CreateRepo: + """Deserializes the CreateRepo from a dictionary.""" return cls(path=d.get('path', None), provider=d.get('provider', None), sparse_checkout=_from_dict(d, 'sparse_checkout', SparseCheckout), @@ -117,11 +159,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateRepo': @dataclass class CreateScope: scope: str - backend_azure_keyvault: Optional['AzureKeyVaultSecretScopeMetadata'] = None + """Scope name requested by the user. Scope names are unique.""" + + backend_azure_keyvault: Optional[AzureKeyVaultSecretScopeMetadata] = None + """The metadata for the secret scope if the type is `AZURE_KEYVAULT`""" + initial_manage_principal: Optional[str] = None - scope_backend_type: Optional['ScopeBackendType'] = None + """The principal that is initially granted `MANAGE` permission to the created scope.""" + + scope_backend_type: Optional[ScopeBackendType] = None + """The backend type the scope will be created with. If not specified, will default to `DATABRICKS`""" def as_dict(self) -> dict: + """Serializes the CreateScope into a dictionary suitable for use as a JSON request body.""" body = {} if self.backend_azure_keyvault: body['backend_azure_keyvault'] = self.backend_azure_keyvault.as_dict() if self.initial_manage_principal is not None: @@ -131,7 +181,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CreateScope': + def from_dict(cls, d: Dict[str, any]) -> CreateScope: + """Deserializes the CreateScope from a dictionary.""" return cls(backend_azure_keyvault=_from_dict(d, 'backend_azure_keyvault', AzureKeyVaultSecretScopeMetadata), initial_manage_principal=d.get('initial_manage_principal', None), @@ -142,10 +193,18 @@ def from_dict(cls, d: Dict[str, any]) -> 'CreateScope': @dataclass class CredentialInfo: credential_id: Optional[int] = None + """ID of the credential object in the workspace.""" + git_provider: Optional[str] = None + """Git provider. This field is case-insensitive. The available Git providers are gitHub, + gitHubOAuth, bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, + gitLabEnterpriseEdition and awsCodeCommit.""" + git_username: Optional[str] = None + """Git username.""" def as_dict(self) -> dict: + """Serializes the CredentialInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_id is not None: body['credential_id'] = self.credential_id if self.git_provider is not None: body['git_provider'] = self.git_provider @@ -153,7 +212,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'CredentialInfo': + def from_dict(cls, d: Dict[str, any]) -> CredentialInfo: + """Deserializes the CredentialInfo from a dictionary.""" return cls(credential_id=d.get('credential_id', None), git_provider=d.get('git_provider', None), git_username=d.get('git_username', None)) @@ -162,62 +222,82 @@ def from_dict(cls, d: Dict[str, any]) -> 'CredentialInfo': @dataclass class Delete: path: str + """The absolute path of the notebook or directory.""" + recursive: Optional[bool] = None + """The flag that specifies whether to delete the object recursively. It is `false` by default. + Please note this deleting directory is not atomic. If it fails in the middle, some of objects + under this directory may be deleted and cannot be undone.""" def as_dict(self) -> dict: + """Serializes the Delete into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path if self.recursive is not None: body['recursive'] = self.recursive return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Delete': + def from_dict(cls, d: Dict[str, any]) -> Delete: + """Deserializes the Delete from a dictionary.""" return cls(path=d.get('path', None), recursive=d.get('recursive', None)) @dataclass class DeleteAcl: scope: str + """The name of the scope to remove permissions from.""" + principal: str + """The principal to remove an existing ACL from.""" def as_dict(self) -> dict: + """Serializes the DeleteAcl into a dictionary suitable for use as a JSON request body.""" body = {} if self.principal is not None: body['principal'] = self.principal if self.scope is not None: body['scope'] = self.scope return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteAcl': + def from_dict(cls, d: Dict[str, any]) -> DeleteAcl: + """Deserializes the DeleteAcl from a dictionary.""" return cls(principal=d.get('principal', None), scope=d.get('scope', None)) @dataclass class DeleteScope: scope: str + """Name of the scope to delete.""" def as_dict(self) -> dict: + """Serializes the DeleteScope into a dictionary suitable for use as a JSON request body.""" body = {} if self.scope is not None: body['scope'] = self.scope return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteScope': + def from_dict(cls, d: Dict[str, any]) -> DeleteScope: + """Deserializes the DeleteScope from a dictionary.""" return cls(scope=d.get('scope', None)) @dataclass class DeleteSecret: scope: str + """The name of the scope that contains the secret to delete.""" + key: str + """Name of the secret to delete.""" def as_dict(self) -> dict: + """Serializes the DeleteSecret into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.scope is not None: body['scope'] = self.scope return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'DeleteSecret': + def from_dict(cls, d: Dict[str, any]) -> DeleteSecret: + """Deserializes the DeleteSecret from a dictionary.""" return cls(key=d.get('key', None), scope=d.get('scope', None)) @@ -234,72 +314,89 @@ class ExportFormat(Enum): @dataclass class ExportResponse: content: Optional[str] = None + """The base64-encoded content. If the limit (10MB) is exceeded, exception with error code + **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown.""" def as_dict(self) -> dict: + """Serializes the ExportResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.content is not None: body['content'] = self.content return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ExportResponse': + def from_dict(cls, d: Dict[str, any]) -> ExportResponse: + """Deserializes the ExportResponse from a dictionary.""" return cls(content=d.get('content', None)) @dataclass class GetCredentialsResponse: - credentials: Optional['List[CredentialInfo]'] = None + credentials: Optional[List[CredentialInfo]] = None def as_dict(self) -> dict: + """Serializes the GetCredentialsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.credentials: body['credentials'] = [v.as_dict() for v in self.credentials] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetCredentialsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetCredentialsResponse: + """Deserializes the GetCredentialsResponse from a dictionary.""" return cls(credentials=_repeated_dict(d, 'credentials', CredentialInfo)) @dataclass class GetRepoPermissionLevelsResponse: - permission_levels: Optional['List[RepoPermissionsDescription]'] = None + permission_levels: Optional[List[RepoPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetRepoPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetRepoPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetRepoPermissionLevelsResponse: + """Deserializes the GetRepoPermissionLevelsResponse from a dictionary.""" return cls(permission_levels=_repeated_dict(d, 'permission_levels', RepoPermissionsDescription)) @dataclass class GetSecretResponse: key: Optional[str] = None + """A unique name to identify the secret.""" + value: Optional[str] = None + """The value of the secret in its byte representation.""" def as_dict(self) -> dict: + """Serializes the GetSecretResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.value is not None: body['value'] = self.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetSecretResponse': + def from_dict(cls, d: Dict[str, any]) -> GetSecretResponse: + """Deserializes the GetSecretResponse from a dictionary.""" return cls(key=d.get('key', None), value=d.get('value', None)) @dataclass class GetWorkspaceObjectPermissionLevelsResponse: - permission_levels: Optional['List[WorkspaceObjectPermissionsDescription]'] = None + permission_levels: Optional[List[WorkspaceObjectPermissionsDescription]] = None + """Specific permission levels""" def as_dict(self) -> dict: + """Serializes the GetWorkspaceObjectPermissionLevelsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'GetWorkspaceObjectPermissionLevelsResponse': + def from_dict(cls, d: Dict[str, any]) -> GetWorkspaceObjectPermissionLevelsResponse: + """Deserializes the GetWorkspaceObjectPermissionLevelsResponse from a dictionary.""" return cls( permission_levels=_repeated_dict(d, 'permission_levels', WorkspaceObjectPermissionsDescription)) @@ -307,12 +404,37 @@ def from_dict(cls, d: Dict[str, any]) -> 'GetWorkspaceObjectPermissionLevelsResp @dataclass class Import: path: str + """The absolute path of the object or directory. Importing a directory is only supported for the + `DBC` and `SOURCE` formats.""" + content: Optional[str] = None - format: Optional['ImportFormat'] = None - language: Optional['Language'] = None + """The base64-encoded content. This has a limit of 10 MB. + + If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is + thrown. This parameter might be absent, and instead a posted file is used.""" + + format: Optional[ImportFormat] = None + """This specifies the format of the file to be imported. + + The value is case sensitive. + + - `AUTO`: The item is imported depending on an analysis of the item's extension and the header + content provided in the request. If the item is imported as a notebook, then the item's + extension is automatically removed. - `SOURCE`: The notebook or directory is imported as source + code. - `HTML`: The notebook is imported as an HTML file. - `JUPYTER`: The notebook is imported + as a Jupyter/IPython Notebook file. - `DBC`: The notebook is imported in Databricks archive + format. Required for directories. - `R_MARKDOWN`: The notebook is imported from R Markdown + format.""" + + language: Optional[Language] = None + """The language of the object. This value is set only if the object type is `NOTEBOOK`.""" + overwrite: Optional[bool] = None + """The flag that specifies whether to overwrite existing object. It is `false` by default. For + `DBC` format, `overwrite` is not supported since it may contain a directory.""" def as_dict(self) -> dict: + """Serializes the Import into a dictionary suitable for use as a JSON request body.""" body = {} if self.content is not None: body['content'] = self.content if self.format is not None: body['format'] = self.format.value @@ -322,7 +444,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Import': + def from_dict(cls, d: Dict[str, any]) -> Import: + """Deserializes the Import from a dictionary.""" return cls(content=d.get('content', None), format=_enum(d, 'format', ImportFormat), language=_enum(d, 'language', Language), @@ -362,101 +485,139 @@ class Language(Enum): @dataclass class ListAclsResponse: - items: Optional['List[AclItem]'] = None + items: Optional[List[AclItem]] = None + """The associated ACLs rule applied to principals in the given scope.""" def as_dict(self) -> dict: + """Serializes the ListAclsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.items: body['items'] = [v.as_dict() for v in self.items] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListAclsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListAclsResponse: + """Deserializes the ListAclsResponse from a dictionary.""" return cls(items=_repeated_dict(d, 'items', AclItem)) @dataclass class ListReposResponse: next_page_token: Optional[str] = None - repos: Optional['List[RepoInfo]'] = None + """Token that can be specified as a query parameter to the GET /repos endpoint to retrieve the next + page of results.""" + + repos: Optional[List[RepoInfo]] = None def as_dict(self) -> dict: + """Serializes the ListReposResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.next_page_token is not None: body['next_page_token'] = self.next_page_token if self.repos: body['repos'] = [v.as_dict() for v in self.repos] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListReposResponse': + def from_dict(cls, d: Dict[str, any]) -> ListReposResponse: + """Deserializes the ListReposResponse from a dictionary.""" return cls(next_page_token=d.get('next_page_token', None), repos=_repeated_dict(d, 'repos', RepoInfo)) @dataclass class ListResponse: - objects: Optional['List[ObjectInfo]'] = None + objects: Optional[List[ObjectInfo]] = None + """List of objects.""" def as_dict(self) -> dict: + """Serializes the ListResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.objects: body['objects'] = [v.as_dict() for v in self.objects] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListResponse': + def from_dict(cls, d: Dict[str, any]) -> ListResponse: + """Deserializes the ListResponse from a dictionary.""" return cls(objects=_repeated_dict(d, 'objects', ObjectInfo)) @dataclass class ListScopesResponse: - scopes: Optional['List[SecretScope]'] = None + scopes: Optional[List[SecretScope]] = None + """The available secret scopes.""" def as_dict(self) -> dict: + """Serializes the ListScopesResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.scopes: body['scopes'] = [v.as_dict() for v in self.scopes] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListScopesResponse': + def from_dict(cls, d: Dict[str, any]) -> ListScopesResponse: + """Deserializes the ListScopesResponse from a dictionary.""" return cls(scopes=_repeated_dict(d, 'scopes', SecretScope)) @dataclass class ListSecretsResponse: - secrets: Optional['List[SecretMetadata]'] = None + secrets: Optional[List[SecretMetadata]] = None + """Metadata information of all secrets contained within the given scope.""" def as_dict(self) -> dict: + """Serializes the ListSecretsResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.secrets: body['secrets'] = [v.as_dict() for v in self.secrets] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ListSecretsResponse': + def from_dict(cls, d: Dict[str, any]) -> ListSecretsResponse: + """Deserializes the ListSecretsResponse from a dictionary.""" return cls(secrets=_repeated_dict(d, 'secrets', SecretMetadata)) @dataclass class Mkdirs: path: str + """The absolute path of the directory. If the parent directories do not exist, it will also create + them. If the directory already exists, this command will do nothing and succeed.""" def as_dict(self) -> dict: + """Serializes the Mkdirs into a dictionary suitable for use as a JSON request body.""" body = {} if self.path is not None: body['path'] = self.path return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'Mkdirs': + def from_dict(cls, d: Dict[str, any]) -> Mkdirs: + """Deserializes the Mkdirs from a dictionary.""" return cls(path=d.get('path', None)) @dataclass class ObjectInfo: created_at: Optional[int] = None - language: Optional['Language'] = None + """Only applicable to files. The creation UTC timestamp.""" + + language: Optional[Language] = None + """The language of the object. This value is set only if the object type is `NOTEBOOK`.""" + modified_at: Optional[int] = None + """Only applicable to files, the last modified UTC timestamp.""" + object_id: Optional[int] = None - object_type: Optional['ObjectType'] = None + """Unique identifier for the object.""" + + object_type: Optional[ObjectType] = None + """The type of the object in workspace. + + - `NOTEBOOK`: document that contains runnable code, visualizations, and explanatory text. - + `DIRECTORY`: directory - `LIBRARY`: library - `FILE`: file - `REPO`: repository""" + path: Optional[str] = None + """The absolute path of the object.""" + size: Optional[int] = None + """Only applicable to files. The file size in bytes can be returned.""" def as_dict(self) -> dict: + """Serializes the ObjectInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.created_at is not None: body['created_at'] = self.created_at if self.language is not None: body['language'] = self.language.value @@ -468,7 +629,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'ObjectInfo': + def from_dict(cls, d: Dict[str, any]) -> ObjectInfo: + """Deserializes the ObjectInfo from a dictionary.""" return cls(created_at=d.get('created_at', None), language=_enum(d, 'language', Language), modified_at=d.get('modified_at', None), @@ -494,10 +656,16 @@ class ObjectType(Enum): @dataclass class PutAcl: scope: str + """The name of the scope to apply permissions to.""" + principal: str - permission: 'AclPermission' + """The principal in which the permission is applied.""" + + permission: AclPermission + """The permission level applied to the principal.""" def as_dict(self) -> dict: + """Serializes the PutAcl into a dictionary suitable for use as a JSON request body.""" body = {} if self.permission is not None: body['permission'] = self.permission.value if self.principal is not None: body['principal'] = self.principal @@ -505,7 +673,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PutAcl': + def from_dict(cls, d: Dict[str, any]) -> PutAcl: + """Deserializes the PutAcl from a dictionary.""" return cls(permission=_enum(d, 'permission', AclPermission), principal=d.get('principal', None), scope=d.get('scope', None)) @@ -514,11 +683,19 @@ def from_dict(cls, d: Dict[str, any]) -> 'PutAcl': @dataclass class PutSecret: scope: str + """The name of the scope to which the secret will be associated with.""" + key: str + """A unique name to identify the secret.""" + bytes_value: Optional[str] = None + """If specified, value will be stored as bytes.""" + string_value: Optional[str] = None + """If specified, note that the value will be stored in UTF-8 (MB4) form.""" def as_dict(self) -> dict: + """Serializes the PutSecret into a dictionary suitable for use as a JSON request body.""" body = {} if self.bytes_value is not None: body['bytes_value'] = self.bytes_value if self.key is not None: body['key'] = self.key @@ -527,7 +704,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'PutSecret': + def from_dict(cls, d: Dict[str, any]) -> PutSecret: + """Deserializes the PutSecret from a dictionary.""" return cls(bytes_value=d.get('bytes_value', None), key=d.get('key', None), scope=d.get('scope', None), @@ -537,11 +715,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'PutSecret': @dataclass class RepoAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['RepoPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[RepoPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the RepoAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -551,7 +738,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> RepoAccessControlRequest: + """Deserializes the RepoAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', RepoPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -560,13 +748,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'RepoAccessControlRequest': @dataclass class RepoAccessControlResponse: - all_permissions: Optional['List[RepoPermission]'] = None + all_permissions: Optional[List[RepoPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the RepoAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -577,7 +775,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> RepoAccessControlResponse: + """Deserializes the RepoAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', RepoPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -588,14 +787,29 @@ def from_dict(cls, d: Dict[str, any]) -> 'RepoAccessControlResponse': @dataclass class RepoInfo: branch: Optional[str] = None + """Branch that the local version of the repo is checked out to.""" + head_commit_id: Optional[str] = None + """SHA-1 hash representing the commit ID of the current HEAD of the repo.""" + id: Optional[int] = None + """ID of the repo object in the workspace.""" + path: Optional[str] = None + """Desired path for the repo in the workspace. Must be in the format /Repos/{folder}/{repo-name}.""" + provider: Optional[str] = None - sparse_checkout: Optional['SparseCheckout'] = None + """Git provider. This field is case-insensitive. The available Git providers are gitHub, + bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, + gitLabEnterpriseEdition and awsCodeCommit.""" + + sparse_checkout: Optional[SparseCheckout] = None + url: Optional[str] = None + """URL of the Git repository to be linked.""" def as_dict(self) -> dict: + """Serializes the RepoInfo into a dictionary suitable for use as a JSON request body.""" body = {} if self.branch is not None: body['branch'] = self.branch if self.head_commit_id is not None: body['head_commit_id'] = self.head_commit_id @@ -607,7 +821,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoInfo': + def from_dict(cls, d: Dict[str, any]) -> RepoInfo: + """Deserializes the RepoInfo from a dictionary.""" return cls(branch=d.get('branch', None), head_commit_id=d.get('head_commit_id', None), id=d.get('id', None), @@ -620,10 +835,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'RepoInfo': @dataclass class RepoPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['RepoPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[RepoPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the RepoPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -631,7 +850,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoPermission': + def from_dict(cls, d: Dict[str, any]) -> RepoPermission: + """Deserializes the RepoPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', RepoPermissionLevel)) @@ -648,11 +868,14 @@ class RepoPermissionLevel(Enum): @dataclass class RepoPermissions: - access_control_list: Optional['List[RepoAccessControlResponse]'] = None + access_control_list: Optional[List[RepoAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the RepoPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -661,7 +884,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoPermissions': + def from_dict(cls, d: Dict[str, any]) -> RepoPermissions: + """Deserializes the RepoPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', RepoAccessControlResponse), object_id=d.get('object_id', None), object_type=d.get('object_type', None)) @@ -670,26 +894,33 @@ def from_dict(cls, d: Dict[str, any]) -> 'RepoPermissions': @dataclass class RepoPermissionsDescription: description: Optional[str] = None - permission_level: Optional['RepoPermissionLevel'] = None + + permission_level: Optional[RepoPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the RepoPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> RepoPermissionsDescription: + """Deserializes the RepoPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', RepoPermissionLevel)) @dataclass class RepoPermissionsRequest: - access_control_list: Optional['List[RepoAccessControlRequest]'] = None + access_control_list: Optional[List[RepoAccessControlRequest]] = None + repo_id: Optional[str] = None + """The repo for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the RepoPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -697,7 +928,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'RepoPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> RepoPermissionsRequest: + """Deserializes the RepoPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', RepoAccessControlRequest), repo_id=d.get('repo_id', None)) @@ -711,9 +943,13 @@ class ScopeBackendType(Enum): @dataclass class SecretMetadata: key: Optional[str] = None + """A unique name to identify the secret.""" + last_updated_timestamp: Optional[int] = None + """The last updated timestamp (in milliseconds) for the secret.""" def as_dict(self) -> dict: + """Serializes the SecretMetadata into a dictionary suitable for use as a JSON request body.""" body = {} if self.key is not None: body['key'] = self.key if self.last_updated_timestamp is not None: @@ -721,17 +957,24 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SecretMetadata': + def from_dict(cls, d: Dict[str, any]) -> SecretMetadata: + """Deserializes the SecretMetadata from a dictionary.""" return cls(key=d.get('key', None), last_updated_timestamp=d.get('last_updated_timestamp', None)) @dataclass class SecretScope: - backend_type: Optional['ScopeBackendType'] = None - keyvault_metadata: Optional['AzureKeyVaultSecretScopeMetadata'] = None + backend_type: Optional[ScopeBackendType] = None + """The type of secret scope backend.""" + + keyvault_metadata: Optional[AzureKeyVaultSecretScopeMetadata] = None + """The metadata for the secret scope if the type is `AZURE_KEYVAULT`""" + name: Optional[str] = None + """A unique name to identify the secret scope.""" def as_dict(self) -> dict: + """Serializes the SecretScope into a dictionary suitable for use as a JSON request body.""" body = {} if self.backend_type is not None: body['backend_type'] = self.backend_type.value if self.keyvault_metadata: body['keyvault_metadata'] = self.keyvault_metadata.as_dict() @@ -739,7 +982,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SecretScope': + def from_dict(cls, d: Dict[str, any]) -> SecretScope: + """Deserializes the SecretScope from a dictionary.""" return cls(backend_type=_enum(d, 'backend_type', ScopeBackendType), keyvault_metadata=_from_dict(d, 'keyvault_metadata', AzureKeyVaultSecretScopeMetadata), name=d.get('name', None)) @@ -747,40 +991,56 @@ def from_dict(cls, d: Dict[str, any]) -> 'SecretScope': @dataclass class SparseCheckout: - patterns: Optional['List[str]'] = None + patterns: Optional[List[str]] = None + """List of patterns to include for sparse checkout.""" def as_dict(self) -> dict: + """Serializes the SparseCheckout into a dictionary suitable for use as a JSON request body.""" body = {} if self.patterns: body['patterns'] = [v for v in self.patterns] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparseCheckout': + def from_dict(cls, d: Dict[str, any]) -> SparseCheckout: + """Deserializes the SparseCheckout from a dictionary.""" return cls(patterns=d.get('patterns', None)) @dataclass class SparseCheckoutUpdate: - patterns: Optional['List[str]'] = None + patterns: Optional[List[str]] = None + """List of patterns to include for sparse checkout.""" def as_dict(self) -> dict: + """Serializes the SparseCheckoutUpdate into a dictionary suitable for use as a JSON request body.""" body = {} if self.patterns: body['patterns'] = [v for v in self.patterns] return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'SparseCheckoutUpdate': + def from_dict(cls, d: Dict[str, any]) -> SparseCheckoutUpdate: + """Deserializes the SparseCheckoutUpdate from a dictionary.""" return cls(patterns=d.get('patterns', None)) @dataclass class UpdateCredentials: credential_id: Optional[int] = None + """The ID for the corresponding credential to access.""" + git_provider: Optional[str] = None + """Git provider. This field is case-insensitive. The available Git providers are gitHub, + bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, + gitLabEnterpriseEdition and awsCodeCommit.""" + git_username: Optional[str] = None + """Git username.""" + personal_access_token: Optional[str] = None + """The personal access token used to authenticate to the corresponding Git provider.""" def as_dict(self) -> dict: + """Serializes the UpdateCredentials into a dictionary suitable for use as a JSON request body.""" body = {} if self.credential_id is not None: body['credential_id'] = self.credential_id if self.git_provider is not None: body['git_provider'] = self.git_provider @@ -789,7 +1049,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateCredentials': + def from_dict(cls, d: Dict[str, any]) -> UpdateCredentials: + """Deserializes the UpdateCredentials from a dictionary.""" return cls(credential_id=d.get('credential_id', None), git_provider=d.get('git_provider', None), git_username=d.get('git_username', None), @@ -799,11 +1060,22 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateCredentials': @dataclass class UpdateRepo: branch: Optional[str] = None + """Branch that the local version of the repo is checked out to.""" + repo_id: Optional[int] = None - sparse_checkout: Optional['SparseCheckoutUpdate'] = None + """The ID for the corresponding repo to access.""" + + sparse_checkout: Optional[SparseCheckoutUpdate] = None + """If specified, update the sparse checkout settings. The update will fail if sparse checkout is + not enabled for the repo.""" + tag: Optional[str] = None + """Tag that the local version of the repo is checked out to. Updating the repo to a tag puts the + repo in a detached HEAD state. Before committing new changes, you must update the repo to a + branch instead of the detached HEAD.""" def as_dict(self) -> dict: + """Serializes the UpdateRepo into a dictionary suitable for use as a JSON request body.""" body = {} if self.branch is not None: body['branch'] = self.branch if self.repo_id is not None: body['repo_id'] = self.repo_id @@ -812,7 +1084,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'UpdateRepo': + def from_dict(cls, d: Dict[str, any]) -> UpdateRepo: + """Deserializes the UpdateRepo from a dictionary.""" return cls(branch=d.get('branch', None), repo_id=d.get('repo_id', None), sparse_checkout=_from_dict(d, 'sparse_checkout', SparseCheckoutUpdate), @@ -822,11 +1095,20 @@ def from_dict(cls, d: Dict[str, any]) -> 'UpdateRepo': @dataclass class WorkspaceObjectAccessControlRequest: group_name: Optional[str] = None - permission_level: Optional['WorkspaceObjectPermissionLevel'] = None + """name of the group""" + + permission_level: Optional[WorkspaceObjectPermissionLevel] = None + """Permission level""" + service_principal_name: Optional[str] = None + """Application ID of an active service principal. Setting this field requires the + `servicePrincipal/user` role.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the WorkspaceObjectAccessControlRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.group_name is not None: body['group_name'] = self.group_name if self.permission_level is not None: body['permission_level'] = self.permission_level.value @@ -836,7 +1118,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectAccessControlRequest': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceObjectAccessControlRequest: + """Deserializes the WorkspaceObjectAccessControlRequest from a dictionary.""" return cls(group_name=d.get('group_name', None), permission_level=_enum(d, 'permission_level', WorkspaceObjectPermissionLevel), service_principal_name=d.get('service_principal_name', None), @@ -845,13 +1128,23 @@ def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectAccessControlRequest': @dataclass class WorkspaceObjectAccessControlResponse: - all_permissions: Optional['List[WorkspaceObjectPermission]'] = None + all_permissions: Optional[List[WorkspaceObjectPermission]] = None + """All permissions.""" + display_name: Optional[str] = None + """Display name of the user or service principal.""" + group_name: Optional[str] = None + """name of the group""" + service_principal_name: Optional[str] = None + """Name of the service principal.""" + user_name: Optional[str] = None + """name of the user""" def as_dict(self) -> dict: + """Serializes the WorkspaceObjectAccessControlResponse into a dictionary suitable for use as a JSON request body.""" body = {} if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions] if self.display_name is not None: body['display_name'] = self.display_name @@ -862,7 +1155,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectAccessControlResponse': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceObjectAccessControlResponse: + """Deserializes the WorkspaceObjectAccessControlResponse from a dictionary.""" return cls(all_permissions=_repeated_dict(d, 'all_permissions', WorkspaceObjectPermission), display_name=d.get('display_name', None), group_name=d.get('group_name', None), @@ -873,10 +1167,14 @@ def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectAccessControlResponse': @dataclass class WorkspaceObjectPermission: inherited: Optional[bool] = None - inherited_from_object: Optional['List[str]'] = None - permission_level: Optional['WorkspaceObjectPermissionLevel'] = None + + inherited_from_object: Optional[List[str]] = None + + permission_level: Optional[WorkspaceObjectPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the WorkspaceObjectPermission into a dictionary suitable for use as a JSON request body.""" body = {} if self.inherited is not None: body['inherited'] = self.inherited if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object] @@ -884,7 +1182,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectPermission': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceObjectPermission: + """Deserializes the WorkspaceObjectPermission from a dictionary.""" return cls(inherited=d.get('inherited', None), inherited_from_object=d.get('inherited_from_object', None), permission_level=_enum(d, 'permission_level', WorkspaceObjectPermissionLevel)) @@ -901,11 +1200,14 @@ class WorkspaceObjectPermissionLevel(Enum): @dataclass class WorkspaceObjectPermissions: - access_control_list: Optional['List[WorkspaceObjectAccessControlResponse]'] = None + access_control_list: Optional[List[WorkspaceObjectAccessControlResponse]] = None + object_id: Optional[str] = None + object_type: Optional[str] = None def as_dict(self) -> dict: + """Serializes the WorkspaceObjectPermissions into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -914,7 +1216,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectPermissions': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceObjectPermissions: + """Deserializes the WorkspaceObjectPermissions from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', WorkspaceObjectAccessControlResponse), object_id=d.get('object_id', None), @@ -924,27 +1227,36 @@ def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectPermissions': @dataclass class WorkspaceObjectPermissionsDescription: description: Optional[str] = None - permission_level: Optional['WorkspaceObjectPermissionLevel'] = None + + permission_level: Optional[WorkspaceObjectPermissionLevel] = None + """Permission level""" def as_dict(self) -> dict: + """Serializes the WorkspaceObjectPermissionsDescription into a dictionary suitable for use as a JSON request body.""" body = {} if self.description is not None: body['description'] = self.description if self.permission_level is not None: body['permission_level'] = self.permission_level.value return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectPermissionsDescription': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceObjectPermissionsDescription: + """Deserializes the WorkspaceObjectPermissionsDescription from a dictionary.""" return cls(description=d.get('description', None), permission_level=_enum(d, 'permission_level', WorkspaceObjectPermissionLevel)) @dataclass class WorkspaceObjectPermissionsRequest: - access_control_list: Optional['List[WorkspaceObjectAccessControlRequest]'] = None + access_control_list: Optional[List[WorkspaceObjectAccessControlRequest]] = None + workspace_object_id: Optional[str] = None + """The workspace object for which to get or manage permissions.""" + workspace_object_type: Optional[str] = None + """The workspace object type for which to get or manage permissions.""" def as_dict(self) -> dict: + """Serializes the WorkspaceObjectPermissionsRequest into a dictionary suitable for use as a JSON request body.""" body = {} if self.access_control_list: body['access_control_list'] = [v.as_dict() for v in self.access_control_list] @@ -953,7 +1265,8 @@ def as_dict(self) -> dict: return body @classmethod - def from_dict(cls, d: Dict[str, any]) -> 'WorkspaceObjectPermissionsRequest': + def from_dict(cls, d: Dict[str, any]) -> WorkspaceObjectPermissionsRequest: + """Deserializes the WorkspaceObjectPermissionsRequest from a dictionary.""" return cls(access_control_list=_repeated_dict(d, 'access_control_list', WorkspaceObjectAccessControlRequest), workspace_object_id=d.get('workspace_object_id', None), @@ -1029,7 +1342,7 @@ def get(self, credential_id: int) -> CredentialInfo: res = self._api.do('GET', f'/api/2.0/git-credentials/{credential_id}', headers=headers) return CredentialInfo.from_dict(res) - def list(self) -> Iterator['CredentialInfo']: + def list(self) -> Iterator[CredentialInfo]: """Get Git credentials. Lists the calling user's Git credentials. One credential per user is supported. @@ -1183,7 +1496,7 @@ def get_permissions(self, repo_id: str) -> RepoPermissions: def list(self, *, next_page_token: Optional[str] = None, - path_prefix: Optional[str] = None) -> Iterator['RepoInfo']: + path_prefix: Optional[str] = None) -> Iterator[RepoInfo]: """Get repos. Returns repos that the calling user has Manage permissions on. Results are paginated with each page @@ -1449,7 +1762,7 @@ def get_secret(self, scope: str, key: str) -> GetSecretResponse: res = self._api.do('GET', '/api/2.0/secrets/get', query=query, headers=headers) return GetSecretResponse.from_dict(res) - def list_acls(self, scope: str) -> Iterator['AclItem']: + def list_acls(self, scope: str) -> Iterator[AclItem]: """Lists ACLs. List the ACLs for a given secret scope. Users must have the `MANAGE` permission to invoke this API. @@ -1470,7 +1783,7 @@ def list_acls(self, scope: str) -> Iterator['AclItem']: parsed = ListAclsResponse.from_dict(json).items return parsed if parsed is not None else [] - def list_scopes(self) -> Iterator['SecretScope']: + def list_scopes(self) -> Iterator[SecretScope]: """List all scopes. Lists all secret scopes available in the workspace. @@ -1485,7 +1798,7 @@ def list_scopes(self) -> Iterator['SecretScope']: parsed = ListScopesResponse.from_dict(json).scopes return parsed if parsed is not None else [] - def list_secrets(self, scope: str) -> Iterator['SecretMetadata']: + def list_secrets(self, scope: str) -> Iterator[SecretMetadata]: """List secret keys. Lists the secret keys that are stored at this scope. This is a metadata-only operation; secret data @@ -1776,7 +2089,7 @@ def import_(self, headers = {'Accept': 'application/json', 'Content-Type': 'application/json', } self._api.do('POST', '/api/2.0/workspace/import', body=body, headers=headers) - def list(self, path: str, *, notebooks_modified_after: Optional[int] = None) -> Iterator['ObjectInfo']: + def list(self, path: str, *, notebooks_modified_after: Optional[int] = None) -> Iterator[ObjectInfo]: """List contents. Lists the contents of a directory, or the object if it is not a directory. If the input path does not diff --git a/docs/account/access_control.rst b/docs/account/access_control.rst deleted file mode 100644 index 61537b822..000000000 --- a/docs/account/access_control.rst +++ /dev/null @@ -1,54 +0,0 @@ -Account Access Control -====================== -.. py:class:: AccountAccessControlAPI - - These APIs manage access rules on resources in an account. Currently, only grant rules are supported. A - grant rule specifies a role assigned to a set of principals. A list of rules attached to a resource is - called a rule set. - - .. py:method:: get_assignable_roles_for_resource(resource) - - Get assignable roles for a resource. - - Gets all the roles that can be granted on an account level resource. A role is grantable if the rule - set on the resource can contain an access rule of the role. - - :param resource: str - The resource name for which assignable roles will be listed. - - :returns: :class:`GetAssignableRolesForResourceResponse` - - - .. py:method:: get_rule_set(name, etag) - - Get a rule set. - - Get a rule set by its name. A rule set is always attached to a resource and contains a list of access - rules on the said resource. Currently only a default rule set for each resource is supported. - - :param name: str - The ruleset name associated with the request. - :param etag: str - Etag used for versioning. The response is at least as fresh as the eTag provided. Etag is used for - optimistic concurrency control as a way to help prevent simultaneous updates of a rule set from - overwriting each other. It is strongly suggested that systems make use of the etag in the read -> - modify -> write pattern to perform rule set updates in order to avoid race conditions that is get an - etag from a GET rule set request, and pass it with the PUT update request to identify the rule set - version you are updating. - - :returns: :class:`RuleSetResponse` - - - .. py:method:: update_rule_set(name, rule_set) - - Update a rule set. - - Replace the rules of a rule set. First, use get to read the current version of the rule set before - modifying it. This pattern helps prevent conflicts between concurrent updates. - - :param name: str - Name of the rule set. - :param rule_set: :class:`RuleSetUpdateRequest` - - :returns: :class:`RuleSetResponse` - \ No newline at end of file diff --git a/docs/account/account-billing.rst b/docs/account/account-billing.rst deleted file mode 100644 index ea434aa29..000000000 --- a/docs/account/account-billing.rst +++ /dev/null @@ -1,12 +0,0 @@ - -Billing -======= - -Configure different aspects of Databricks billing and usage. - -.. toctree:: - :maxdepth: 1 - - billable_usage - budgets - log_delivery \ No newline at end of file diff --git a/docs/account/account-catalog.rst b/docs/account/account-catalog.rst deleted file mode 100644 index d235579af..000000000 --- a/docs/account/account-catalog.rst +++ /dev/null @@ -1,12 +0,0 @@ - -Unity Catalog -============= - -Configure data governance with Unity Catalog for metastores, catalogs, schemas, tables, external locations, and storage credentials - -.. toctree:: - :maxdepth: 1 - - metastore_assignments - metastores - storage_credentials \ No newline at end of file diff --git a/docs/account/account-iam.rst b/docs/account/account-iam.rst deleted file mode 100644 index 1c74cd15a..000000000 --- a/docs/account/account-iam.rst +++ /dev/null @@ -1,14 +0,0 @@ - -Identity and Access Management -============================== - -Manage users, service principals, groups and their permissions in Accounts and Workspaces - -.. toctree:: - :maxdepth: 1 - - access_control - groups - service_principals - users - workspace_assignment \ No newline at end of file diff --git a/docs/account/account-oauth2.rst b/docs/account/account-oauth2.rst deleted file mode 100644 index 0a48f1979..000000000 --- a/docs/account/account-oauth2.rst +++ /dev/null @@ -1,13 +0,0 @@ - -OAuth -===== - -Configure OAuth 2.0 application registrations for Databricks - -.. toctree:: - :maxdepth: 1 - - custom_app_integration - o_auth_published_apps - published_app_integration - service_principal_secrets \ No newline at end of file diff --git a/docs/account/account-provisioning.rst b/docs/account/account-provisioning.rst deleted file mode 100644 index 5107ab3ad..000000000 --- a/docs/account/account-provisioning.rst +++ /dev/null @@ -1,16 +0,0 @@ - -Provisioning -============ - -Resource management for secure Databricks Workspace deployment, cross-account IAM roles, storage, encryption, networking and private access. - -.. toctree:: - :maxdepth: 1 - - credentials - encryption_keys - networks - private_access - storage - vpc_endpoints - workspaces \ No newline at end of file diff --git a/docs/account/account-settings.rst b/docs/account/account-settings.rst deleted file mode 100644 index 62b801b3d..000000000 --- a/docs/account/account-settings.rst +++ /dev/null @@ -1,13 +0,0 @@ - -Settings -======== - -Manage security settings for Accounts and Workspaces - -.. toctree:: - :maxdepth: 1 - - ip_access_lists - network_connectivity - network_policy - settings \ No newline at end of file diff --git a/docs/account/billable_usage.rst b/docs/account/billable_usage.rst deleted file mode 100644 index 919f8c82e..000000000 --- a/docs/account/billable_usage.rst +++ /dev/null @@ -1,41 +0,0 @@ -Billable usage download -======================= -.. py:class:: BillableUsageAPI - - This API allows you to download billable usage logs for the specified account and date range. This feature - works with all account types. - - .. py:method:: download(start_month, end_month [, personal_data]) - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - resp = a.billable_usage.download(start_month="2023-01", end_month="2023-02") - - Return billable usage logs. - - Returns billable usage logs in CSV format for the specified account and date range. For the data - schema, see [CSV file schema]. Note that this method might take multiple minutes to complete. - - **Warning**: Depending on the queried date range, the number of workspaces in the account, the size of - the response and the internet speed of the caller, this API may hit a timeout after a few minutes. If - you experience this, try to mitigate by calling the API with narrower date ranges. - - [CSV file schema]: https://docs.databricks.com/administration-guide/account-settings/usage-analysis.html#schema - - :param start_month: str - Format: `YYYY-MM`. First month to return billable usage logs for. This field is required. - :param end_month: str - Format: `YYYY-MM`. Last month to return billable usage logs for. This field is required. - :param personal_data: bool (optional) - Specify whether to include personally identifiable information in the billable usage logs, for - example the email addresses of cluster creators. Handle this information with care. Defaults to - false. - - :returns: :class:`DownloadResponse` - \ No newline at end of file diff --git a/docs/account/budgets.rst b/docs/account/budgets.rst deleted file mode 100644 index b5de0d15d..000000000 --- a/docs/account/budgets.rst +++ /dev/null @@ -1,156 +0,0 @@ -Budgets -======= -.. py:class:: BudgetsAPI - - These APIs manage budget configuration including notifications for exceeding a budget for a period. They - can also retrieve the status of each budget. - - .. py:method:: create(budget) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import billing - - a = AccountClient() - - created = a.budgets.create(budget=billing.Budget( - name=f'sdk-{time.time_ns()}', - filter="tag.tagName = 'all'", - period="1 month", - start_date="2022-01-01", - target_amount="100", - alerts=[billing.BudgetAlert(email_notifications=["admin@example.com"], min_percentage=50)])) - - # cleanup - a.budgets.delete(budget_id=created.budget.budget_id) - - Create a new budget. - - Creates a new budget in the specified account. - - :param budget: :class:`Budget` - Budget configuration to be created. - - :returns: :class:`WrappedBudgetWithStatus` - - - .. py:method:: delete(budget_id) - - Delete budget. - - Deletes the budget specified by its UUID. - - :param budget_id: str - Budget ID - - - - - .. py:method:: get(budget_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import billing - - a = AccountClient() - - created = a.budgets.create(budget=billing.Budget( - name=f'sdk-{time.time_ns()}', - filter="tag.tagName = 'all'", - period="1 month", - start_date="2022-01-01", - target_amount="100", - alerts=[billing.BudgetAlert(email_notifications=["admin@example.com"], min_percentage=50)])) - - by_id = a.budgets.get(budget_id=created.budget.budget_id) - - # cleanup - a.budgets.delete(budget_id=created.budget.budget_id) - - Get budget and its status. - - Gets the budget specified by its UUID, including noncumulative status for each day that the budget is - configured to include. - - :param budget_id: str - Budget ID - - :returns: :class:`WrappedBudgetWithStatus` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - all = a.budgets.list() - - Get all budgets. - - Gets all budgets associated with this account, including noncumulative status for each day that the - budget is configured to include. - - :returns: Iterator over :class:`BudgetWithStatus` - - - .. py:method:: update(budget_id, budget) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import billing - - a = AccountClient() - - created = a.budgets.create(budget=billing.Budget( - name=f'sdk-{time.time_ns()}', - filter="tag.tagName = 'all'", - period="1 month", - start_date="2022-01-01", - target_amount="100", - alerts=[billing.BudgetAlert(email_notifications=["admin@example.com"], min_percentage=50)])) - - a.budgets.update(budget_id=created.budget.budget_id, - budget=billing.Budget(name=f'sdk-{time.time_ns()}', - filter="tag.tagName = 'all'", - period="1 month", - start_date="2022-01-01", - target_amount="100", - alerts=[ - billing.BudgetAlert(email_notifications=["admin@example.com"], - min_percentage=70) - ])) - - # cleanup - a.budgets.delete(budget_id=created.budget.budget_id) - - Modify budget. - - Modifies a budget in this account. Budget properties are completely overwritten. - - :param budget_id: str - Budget ID - :param budget: :class:`Budget` - Budget configuration to be created. - - - \ No newline at end of file diff --git a/docs/account/credentials.rst b/docs/account/credentials.rst deleted file mode 100644 index 8dd5a13f0..000000000 --- a/docs/account/credentials.rst +++ /dev/null @@ -1,118 +0,0 @@ -Credential configurations -========================= -.. py:class:: CredentialsAPI - - These APIs manage credential configurations for this workspace. Databricks needs access to a cross-account - service IAM role in your AWS account so that Databricks can deploy clusters in the appropriate VPC for the - new workspace. A credential configuration encapsulates this role information, and its ID is used when - creating a new workspace. - - .. py:method:: create(credentials_name, aws_credentials) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - role = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_CROSSACCOUNT_ARN"]))) - - # cleanup - a.credentials.delete(credentials_id=role.credentials_id) - - Create credential configuration. - - Creates a Databricks credential configuration that represents cloud cross-account credentials for a - specified account. Databricks uses this to set up network infrastructure properly to host Databricks - clusters. For your AWS IAM role, you need to trust the External ID (the Databricks Account API account - ID) in the returned credential object, and configure the required access policy. - - Save the response's `credentials_id` field, which is the ID for your new credential configuration - object. - - For information about how to create a new workspace with this API, see [Create a new workspace using - the Account API] - - [Create a new workspace using the Account API]: http://docs.databricks.com/administration-guide/account-api/new-workspace.html - - :param credentials_name: str - The human-readable name of the credential configuration object. - :param aws_credentials: :class:`CreateCredentialAwsCredentials` - - :returns: :class:`Credential` - - - .. py:method:: delete(credentials_id) - - Delete credential configuration. - - Deletes a Databricks credential configuration object for an account, both specified by ID. You cannot - delete a credential that is associated with any workspace. - - :param credentials_id: str - Databricks Account API credential configuration ID - - - - - .. py:method:: get(credentials_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - role = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_CROSSACCOUNT_ARN"]))) - - by_id = a.credentials.get(credentials_id=role.credentials_id) - - # cleanup - a.credentials.delete(credentials_id=role.credentials_id) - - Get credential configuration. - - Gets a Databricks credential configuration object for an account, both specified by ID. - - :param credentials_id: str - Databricks Account API credential configuration ID - - :returns: :class:`Credential` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - configs = a.credentials.list() - - Get all credential configurations. - - Gets all Databricks credential configurations associated with an account specified by ID. - - :returns: Iterator over :class:`Credential` - \ No newline at end of file diff --git a/docs/account/custom_app_integration.rst b/docs/account/custom_app_integration.rst deleted file mode 100644 index 19e2c39ca..000000000 --- a/docs/account/custom_app_integration.rst +++ /dev/null @@ -1,80 +0,0 @@ -OAuth Custom App Integration -============================ -.. py:class:: CustomAppIntegrationAPI - - These APIs enable administrators to manage custom oauth app integrations, which is required for - adding/using Custom OAuth App Integration like Tableau Cloud for Databricks in AWS cloud. - - .. py:method:: create(name, redirect_urls [, confidential, scopes, token_access_policy]) - - Create Custom OAuth App Integration. - - Create Custom OAuth App Integration. - - You can retrieve the custom oauth app integration via :method:CustomAppIntegration/get. - - :param name: str - name of the custom oauth app - :param redirect_urls: List[str] - List of oauth redirect urls - :param confidential: bool (optional) - indicates if an oauth client-secret should be generated - :param scopes: List[str] (optional) - OAuth scopes granted to the application. Supported scopes: all-apis, sql, offline_access, openid, - profile, email. - :param token_access_policy: :class:`TokenAccessPolicy` (optional) - Token access policy - - :returns: :class:`CreateCustomAppIntegrationOutput` - - - .. py:method:: delete(integration_id) - - Delete Custom OAuth App Integration. - - Delete an existing Custom OAuth App Integration. You can retrieve the custom oauth app integration via - :method:CustomAppIntegration/get. - - :param integration_id: str - The oauth app integration ID. - - - - - .. py:method:: get(integration_id) - - Get OAuth Custom App Integration. - - Gets the Custom OAuth App Integration for the given integration id. - - :param integration_id: str - The oauth app integration ID. - - :returns: :class:`GetCustomAppIntegrationOutput` - - - .. py:method:: list() - - Get custom oauth app integrations. - - Get the list of custom oauth app integrations for the specified Databricks account - - :returns: Iterator over :class:`GetCustomAppIntegrationOutput` - - - .. py:method:: update(integration_id [, redirect_urls, token_access_policy]) - - Updates Custom OAuth App Integration. - - Updates an existing custom OAuth App Integration. You can retrieve the custom oauth app integration - via :method:CustomAppIntegration/get. - - :param integration_id: str - The oauth app integration ID. - :param redirect_urls: List[str] (optional) - List of oauth redirect urls to be updated in the custom oauth app integration - :param token_access_policy: :class:`TokenAccessPolicy` (optional) - Token access policy to be updated in the custom oauth app integration - - - \ No newline at end of file diff --git a/docs/account/encryption_keys.rst b/docs/account/encryption_keys.rst deleted file mode 100644 index 7b0b5aab0..000000000 --- a/docs/account/encryption_keys.rst +++ /dev/null @@ -1,145 +0,0 @@ -Key configurations -================== -.. py:class:: EncryptionKeysAPI - - These APIs manage encryption key configurations for this workspace (optional). A key configuration - encapsulates the AWS KMS key information and some information about how the key configuration can be used. - There are two possible uses for key configurations: - - * Managed services: A key configuration can be used to encrypt a workspace's notebook and secret data in - the control plane, as well as Databricks SQL queries and query history. * Storage: A key configuration can - be used to encrypt a workspace's DBFS and EBS data in the data plane. - - In both of these cases, the key configuration's ID is used when creating a new workspace. This Preview - feature is available if your account is on the E2 version of the platform. Updating a running workspace - with workspace storage encryption requires that the workspace is on the E2 version of the platform. If you - have an older workspace, it might not be on the E2 version of the platform. If you are not sure, contact - your Databricks representative. - - .. py:method:: create(use_cases [, aws_key_info, gcp_key_info]) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - created = a.encryption_keys.create(aws_key_info=provisioning.CreateAwsKeyInfo( - key_arn=os.environ["TEST_MANAGED_KMS_KEY_ARN"], key_alias=os.environ["TEST_STORAGE_KMS_KEY_ALIAS"]), - use_cases=[provisioning.KeyUseCase.MANAGED_SERVICES]) - - # cleanup - a.encryption_keys.delete(customer_managed_key_id=created.customer_managed_key_id) - - Create encryption key configuration. - - Creates a customer-managed key configuration object for an account, specified by ID. This operation - uploads a reference to a customer-managed key to Databricks. If the key is assigned as a workspace's - customer-managed key for managed services, Databricks uses the key to encrypt the workspaces notebooks - and secrets in the control plane, in addition to Databricks SQL queries and query history. If it is - specified as a workspace's customer-managed key for workspace storage, the key encrypts the - workspace's root S3 bucket (which contains the workspace's root DBFS and system data) and, optionally, - cluster EBS volume data. - - **Important**: Customer-managed keys are supported only for some deployment types, subscription types, - and AWS regions that currently support creation of Databricks workspaces. - - This operation is available only if your account is on the E2 version of the platform or on a select - custom plan that allows multiple workspaces per account. - - :param use_cases: List[:class:`KeyUseCase`] - The cases that the key can be used for. - :param aws_key_info: :class:`CreateAwsKeyInfo` (optional) - :param gcp_key_info: :class:`CreateGcpKeyInfo` (optional) - - :returns: :class:`CustomerManagedKey` - - - .. py:method:: delete(customer_managed_key_id) - - Delete encryption key configuration. - - Deletes a customer-managed key configuration object for an account. You cannot delete a configuration - that is associated with a running workspace. - - :param customer_managed_key_id: str - Databricks encryption key configuration ID. - - - - - .. py:method:: get(customer_managed_key_id) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - created = a.encryption_keys.create(aws_key_info=provisioning.CreateAwsKeyInfo( - key_arn=os.environ["TEST_MANAGED_KMS_KEY_ARN"], key_alias=os.environ["TEST_STORAGE_KMS_KEY_ALIAS"]), - use_cases=[provisioning.KeyUseCase.MANAGED_SERVICES]) - - by_id = a.encryption_keys.get(customer_managed_key_id=created.customer_managed_key_id) - - # cleanup - a.encryption_keys.delete(customer_managed_key_id=created.customer_managed_key_id) - - Get encryption key configuration. - - Gets a customer-managed key configuration object for an account, specified by ID. This operation - uploads a reference to a customer-managed key to Databricks. If assigned as a workspace's - customer-managed key for managed services, Databricks uses the key to encrypt the workspaces notebooks - and secrets in the control plane, in addition to Databricks SQL queries and query history. If it is - specified as a workspace's customer-managed key for storage, the key encrypts the workspace's root S3 - bucket (which contains the workspace's root DBFS and system data) and, optionally, cluster EBS volume - data. - - **Important**: Customer-managed keys are supported only for some deployment types, subscription types, - and AWS regions. - - This operation is available only if your account is on the E2 version of the platform.", - - :param customer_managed_key_id: str - Databricks encryption key configuration ID. - - :returns: :class:`CustomerManagedKey` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - all = a.encryption_keys.list() - - Get all encryption key configurations. - - Gets all customer-managed key configuration objects for an account. If the key is specified as a - workspace's managed services customer-managed key, Databricks uses the key to encrypt the workspace's - notebooks and secrets in the control plane, in addition to Databricks SQL queries and query history. - If the key is specified as a workspace's storage customer-managed key, the key is used to encrypt the - workspace's root S3 bucket and optionally can encrypt cluster EBS volumes data in the data plane. - - **Important**: Customer-managed keys are supported only for some deployment types, subscription types, - and AWS regions. - - This operation is available only if your account is on the E2 version of the platform. - - :returns: Iterator over :class:`CustomerManagedKey` - \ No newline at end of file diff --git a/docs/account/groups.rst b/docs/account/groups.rst deleted file mode 100644 index c5dbda4ef..000000000 --- a/docs/account/groups.rst +++ /dev/null @@ -1,180 +0,0 @@ -Account Groups -============== -.. py:class:: AccountGroupsAPI - - Groups simplify identity management, making it easier to assign access to Databricks account, data, and - other securable objects. - - It is best practice to assign access to workspaces and access-control policies in Unity Catalog to groups, - instead of to users individually. All Databricks account identities can be assigned as members of groups, - and members inherit permissions that are assigned to their group. - - .. py:method:: create( [, display_name, entitlements, external_id, groups, id, members, meta, roles, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - # cleanup - w.groups.delete(id=group.id) - - Create a new group. - - Creates a group in the Databricks account with a unique name, using the supplied group details. - - :param display_name: str (optional) - String that represents a human-readable group name - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the group. See [assigning entitlements] for a full list of supported - values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param id: str (optional) - Databricks group ID - :param members: List[:class:`ComplexValue`] (optional) - :param meta: :class:`ResourceMeta` (optional) - Container for the group identifier. Workspace local versus account. - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`GroupSchema`] (optional) - The schema of the group. - - :returns: :class:`Group` - - - .. py:method:: delete(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - w.groups.delete(id=group.id) - - Delete a group. - - Deletes a group from the Databricks account. - - :param id: str - Unique ID for a group in the Databricks account. - - - - - .. py:method:: get(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - fetch = w.groups.get(id=group.id) - - # cleanup - w.groups.delete(id=group.id) - - Get group details. - - Gets the information for a specific group in the Databricks account. - - :param id: str - Unique ID for a group in the Databricks account. - - :returns: :class:`Group` - - - .. py:method:: list( [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - List group details. - - Gets all details of the groups associated with the Databricks account. - - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. Default is 10000. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. - :param sort_order: :class:`ListSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: Iterator over :class:`Group` - - - .. py:method:: patch(id [, operations, schemas]) - - Update group details. - - Partially updates the details of a group. - - :param id: str - Unique ID for a group in the Databricks account. - :param operations: List[:class:`Patch`] (optional) - :param schemas: List[:class:`PatchSchema`] (optional) - The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - - - - - .. py:method:: update(id [, display_name, entitlements, external_id, groups, members, meta, roles, schemas]) - - Replace a group. - - Updates the details of a group by replacing the entire group entity. - - :param id: str - Databricks group ID - :param display_name: str (optional) - String that represents a human-readable group name - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the group. See [assigning entitlements] for a full list of supported - values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param members: List[:class:`ComplexValue`] (optional) - :param meta: :class:`ResourceMeta` (optional) - Container for the group identifier. Workspace local versus account. - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`GroupSchema`] (optional) - The schema of the group. - - - \ No newline at end of file diff --git a/docs/account/index.rst b/docs/account/index.rst deleted file mode 100644 index 8993d2120..000000000 --- a/docs/account/index.rst +++ /dev/null @@ -1,15 +0,0 @@ - -Account APIs -============ - -These APIs are available from AccountClient - -.. toctree:: - :maxdepth: 1 - - account-iam - account-catalog - account-settings - account-provisioning - account-billing - account-oauth2 \ No newline at end of file diff --git a/docs/account/ip_access_lists.rst b/docs/account/ip_access_lists.rst deleted file mode 100644 index 2a2005682..000000000 --- a/docs/account/ip_access_lists.rst +++ /dev/null @@ -1,228 +0,0 @@ -Account IP Access Lists -======================= -.. py:class:: AccountIpAccessListsAPI - - The Accounts IP Access List API enables account admins to configure IP access lists for access to the - account console. - - Account IP Access Lists affect web application access and REST API access to the account console and - account APIs. If the feature is disabled for the account, all access is allowed for this account. There is - support for allow lists (inclusion) and block lists (exclusion). - - When a connection is attempted: 1. **First, all block lists are checked.** If the connection IP address - matches any block list, the connection is rejected. 2. **If the connection was not rejected by block - lists**, the IP address is compared with the allow lists. - - If there is at least one allow list for the account, the connection is allowed only if the IP address - matches an allow list. If there are no allow lists for the account, all IP addresses are allowed. - - For all allow lists and block lists combined, the account supports a maximum of 1000 IP/CIDR values, where - one CIDR counts as a single value. - - After changes to the account-level IP access lists, it can take a few minutes for changes to take effect. - - .. py:method:: create(label, list_type, ip_addresses) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - created = w.ip_access_lists.create(label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/16"], - list_type=settings.ListType.BLOCK) - - # cleanup - w.ip_access_lists.delete(ip_access_list_id=created.ip_access_list.list_id) - - Create access list. - - Creates an IP access list for the account. - - A list can be an allow list or a block list. See the top of this file for a description of how the - server treats allow lists and block lists at runtime. - - When creating or updating an IP access list: - - * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, - where one CIDR counts as a single value. Attempts to exceed that number return error 400 with - `error_code` value `QUOTA_EXCEEDED`. * If the new list would block the calling user's current IP, - error 400 is returned with `error_code` value `INVALID_STATE`. - - It can take a few minutes for the changes to take effect. - - :param label: str - Label for the IP access list. This **cannot** be empty. - :param list_type: :class:`ListType` - Type of IP access list. Valid values are as follows and are case-sensitive: - - * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - :param ip_addresses: List[str] - Array of IP addresses or CIDR values to be added to the IP access list. - - :returns: :class:`CreateIpAccessListResponse` - - - .. py:method:: delete(ip_access_list_id) - - Delete access list. - - Deletes an IP access list, specified by its list ID. - - :param ip_access_list_id: str - The ID for the corresponding IP access list. - - - - - .. py:method:: get(ip_access_list_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - created = w.ip_access_lists.create(label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/16"], - list_type=settings.ListType.BLOCK) - - by_id = w.ip_access_lists.get(ip_access_list_id=created.ip_access_list.list_id) - - # cleanup - w.ip_access_lists.delete(ip_access_list_id=created.ip_access_list.list_id) - - Get IP access list. - - Gets an IP access list, specified by its list ID. - - :param ip_access_list_id: str - The ID for the corresponding IP access list. - - :returns: :class:`GetIpAccessListResponse` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.ip_access_lists.list() - - Get access lists. - - Gets all IP access lists for the specified account. - - :returns: Iterator over :class:`IpAccessListInfo` - - - .. py:method:: replace(ip_access_list_id, label, list_type, ip_addresses, enabled [, list_id]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - created = w.ip_access_lists.create(label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/16"], - list_type=settings.ListType.BLOCK) - - w.ip_access_lists.replace(ip_access_list_id=created.ip_access_list.list_id, - label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/24"], - list_type=settings.ListType.BLOCK, - enabled=False) - - # cleanup - w.ip_access_lists.delete(ip_access_list_id=created.ip_access_list.list_id) - - Replace access list. - - Replaces an IP access list, specified by its ID. - - A list can include allow lists and block lists. See the top of this file for a description of how the - server treats allow lists and block lists at run time. When replacing an IP access list: * For all - allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, where one - CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code` value - `QUOTA_EXCEEDED`. * If the resulting list would block the calling user's current IP, error 400 is - returned with `error_code` value `INVALID_STATE`. It can take a few minutes for the changes to take - effect. - - :param ip_access_list_id: str - The ID for the corresponding IP access list. - :param label: str - Label for the IP access list. This **cannot** be empty. - :param list_type: :class:`ListType` - Type of IP access list. Valid values are as follows and are case-sensitive: - - * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - :param ip_addresses: List[str] - Array of IP addresses or CIDR values to be added to the IP access list. - :param enabled: bool - Specifies whether this IP access list is enabled. - :param list_id: str (optional) - Universally unique identifier (UUID) of the IP access list. - - - - - .. py:method:: update(ip_access_list_id, label, list_type, ip_addresses, enabled [, list_id]) - - Update access list. - - Updates an existing IP access list, specified by its ID. - - A list can include allow lists and block lists. See the top of this file for a description of how the - server treats allow lists and block lists at run time. - - When updating an IP access list: - - * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, - where one CIDR counts as a single value. Attempts to exceed that number return error 400 with - `error_code` value `QUOTA_EXCEEDED`. * If the updated list would block the calling user's current IP, - error 400 is returned with `error_code` value `INVALID_STATE`. - - It can take a few minutes for the changes to take effect. - - :param ip_access_list_id: str - The ID for the corresponding IP access list. - :param label: str - Label for the IP access list. This **cannot** be empty. - :param list_type: :class:`ListType` - Type of IP access list. Valid values are as follows and are case-sensitive: - - * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - :param ip_addresses: List[str] - Array of IP addresses or CIDR values to be added to the IP access list. - :param enabled: bool - Specifies whether this IP access list is enabled. - :param list_id: str (optional) - Universally unique identifier (UUID) of the IP access list. - - - \ No newline at end of file diff --git a/docs/account/log_delivery.rst b/docs/account/log_delivery.rst deleted file mode 100644 index f405177b6..000000000 --- a/docs/account/log_delivery.rst +++ /dev/null @@ -1,207 +0,0 @@ -Log delivery configurations -=========================== -.. py:class:: LogDeliveryAPI - - These APIs manage log delivery configurations for this account. The two supported log types for this API - are _billable usage logs_ and _audit logs_. This feature is in Public Preview. This feature works with all - account ID types. - - Log delivery works with all account types. However, if your account is on the E2 version of the platform - or on a select custom plan that allows multiple workspaces per account, you can optionally configure - different storage destinations for each workspace. Log delivery status is also provided to know the latest - status of log delivery attempts. The high-level flow of billable usage delivery: - - 1. **Create storage**: In AWS, [create a new AWS S3 bucket] with a specific bucket policy. Using - Databricks APIs, call the Account API to create a [storage configuration object](:method:Storage/Create) - that uses the bucket name. 2. **Create credentials**: In AWS, create the appropriate AWS IAM role. For - full details, including the required IAM role policies and trust relationship, see [Billable usage log - delivery]. Using Databricks APIs, call the Account API to create a [credential configuration - object](:method:Credentials/Create) that uses the IAM role"s ARN. 3. **Create log delivery - configuration**: Using Databricks APIs, call the Account API to [create a log delivery - configuration](:method:LogDelivery/Create) that uses the credential and storage configuration objects from - previous steps. You can specify if the logs should include all events of that log type in your account - (_Account level_ delivery) or only events for a specific set of workspaces (_workspace level_ delivery). - Account level log delivery applies to all current and future workspaces plus account level logs, while - workspace level log delivery solely delivers logs related to the specified workspaces. You can create - multiple types of delivery configurations per account. - - For billable usage delivery: * For more information about billable usage logs, see [Billable usage log - delivery]. For the CSV schema, see the [Usage page]. * The delivery location is - `//billable-usage/csv/`, where `` is the name of the optional delivery path - prefix you set up during log delivery configuration. Files are named - `workspaceId=-usageMonth=.csv`. * All billable usage logs apply to specific - workspaces (_workspace level_ logs). You can aggregate usage for your entire account by creating an - _account level_ delivery configuration that delivers logs for all current and future workspaces in your - account. * The files are delivered daily by overwriting the month's CSV file for each workspace. - - For audit log delivery: * For more information about about audit log delivery, see [Audit log delivery], - which includes information about the used JSON schema. * The delivery location is - `//workspaceId=/date=/auditlogs_.json`. - Files may get overwritten with the same content multiple times to achieve exactly-once delivery. * If the - audit log delivery configuration included specific workspace IDs, only _workspace-level_ audit logs for - those workspaces are delivered. If the log delivery configuration applies to the entire account (_account - level_ delivery configuration), the audit log delivery includes workspace-level audit logs for all - workspaces in the account as well as account-level audit logs. See [Audit log delivery] for details. * - Auditable events are typically available in logs within 15 minutes. - - [Audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html - [Billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - [Usage page]: https://docs.databricks.com/administration-guide/account-settings/usage.html - [create a new AWS S3 bucket]: https://docs.databricks.com/administration-guide/account-api/aws-storage.html - - .. py:method:: create( [, log_delivery_configuration]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import billing, provisioning - - a = AccountClient() - - bucket = a.storage.create(storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=f'sdk-{time.time_ns()}')) - - creds = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_LOGDELIVERY_ARN"]))) - - created = a.log_delivery.create(log_delivery_configuration=billing.CreateLogDeliveryConfigurationParams( - config_name=f'sdk-{time.time_ns()}', - credentials_id=creds.credentials_id, - storage_configuration_id=bucket.storage_configuration_id, - log_type=billing.LogType.AUDIT_LOGS, - output_format=billing.OutputFormat.JSON)) - - # cleanup - a.storage.delete(storage_configuration_id=bucket.storage_configuration_id) - a.credentials.delete(credentials_id=creds.credentials_id) - a.log_delivery.patch_status(log_delivery_configuration_id=created.log_delivery_configuration.config_id, - status=billing.LogDeliveryConfigStatus.DISABLED) - - Create a new log delivery configuration. - - Creates a new Databricks log delivery configuration to enable delivery of the specified type of logs - to your storage location. This requires that you already created a [credential - object](:method:Credentials/Create) (which encapsulates a cross-account service IAM role) and a - [storage configuration object](:method:Storage/Create) (which encapsulates an S3 bucket). - - For full details, including the required IAM role policies and bucket policies, see [Deliver and - access billable usage logs] or [Configure audit logging]. - - **Note**: There is a limit on the number of log delivery configurations available per account (each - limit applies separately to each log type including billable usage and audit logs). You can create a - maximum of two enabled account-level delivery configurations (configurations without a workspace - filter) per type. Additionally, you can create two enabled workspace-level delivery configurations per - workspace for each log type, which means that the same workspace ID can occur in the workspace filter - for no more than two delivery configurations per log type. - - You cannot delete a log delivery configuration, but you can disable it (see [Enable or disable log - delivery configuration](:method:LogDelivery/PatchStatus)). - - [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html - [Deliver and access billable usage logs]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - - :param log_delivery_configuration: :class:`CreateLogDeliveryConfigurationParams` (optional) - - :returns: :class:`WrappedLogDeliveryConfiguration` - - - .. py:method:: get(log_delivery_configuration_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import billing, provisioning - - a = AccountClient() - - bucket = a.storage.create(storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=f'sdk-{time.time_ns()}')) - - creds = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_LOGDELIVERY_ARN"]))) - - created = a.log_delivery.create(log_delivery_configuration=billing.CreateLogDeliveryConfigurationParams( - config_name=f'sdk-{time.time_ns()}', - credentials_id=creds.credentials_id, - storage_configuration_id=bucket.storage_configuration_id, - log_type=billing.LogType.AUDIT_LOGS, - output_format=billing.OutputFormat.JSON)) - - by_id = a.log_delivery.get(log_delivery_configuration_id=created.log_delivery_configuration.config_id) - - # cleanup - a.storage.delete(storage_configuration_id=bucket.storage_configuration_id) - a.credentials.delete(credentials_id=creds.credentials_id) - a.log_delivery.patch_status(log_delivery_configuration_id=created.log_delivery_configuration.config_id, - status=billing.LogDeliveryConfigStatus.DISABLED) - - Get log delivery configuration. - - Gets a Databricks log delivery configuration object for an account, both specified by ID. - - :param log_delivery_configuration_id: str - Databricks log delivery configuration ID - - :returns: :class:`WrappedLogDeliveryConfiguration` - - - .. py:method:: list( [, credentials_id, status, storage_configuration_id]) - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - from databricks.sdk.service import billing - - a = AccountClient() - - all = a.log_delivery.list(billing.ListLogDeliveryRequest()) - - Get all log delivery configurations. - - Gets all Databricks log delivery configurations associated with an account specified by ID. - - :param credentials_id: str (optional) - Filter by credential configuration ID. - :param status: :class:`LogDeliveryConfigStatus` (optional) - Filter by status `ENABLED` or `DISABLED`. - :param storage_configuration_id: str (optional) - Filter by storage configuration ID. - - :returns: Iterator over :class:`LogDeliveryConfiguration` - - - .. py:method:: patch_status(log_delivery_configuration_id, status) - - Enable or disable log delivery configuration. - - Enables or disables a log delivery configuration. Deletion of delivery configurations is not - supported, so disable log delivery configurations that are no longer needed. Note that you can't - re-enable a delivery configuration if this would violate the delivery configuration limits described - under [Create log delivery](:method:LogDelivery/Create). - - :param log_delivery_configuration_id: str - Databricks log delivery configuration ID - :param status: :class:`LogDeliveryConfigStatus` - Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults - to `ENABLED`. You can [enable or disable the - configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is - not supported, so disable a log delivery configuration that is no longer needed. - - - \ No newline at end of file diff --git a/docs/account/metastore_assignments.rst b/docs/account/metastore_assignments.rst deleted file mode 100644 index a919b6490..000000000 --- a/docs/account/metastore_assignments.rst +++ /dev/null @@ -1,88 +0,0 @@ -Account Metastore Assignments -============================= -.. py:class:: AccountMetastoreAssignmentsAPI - - These APIs manage metastore assignments to a workspace. - - .. py:method:: create(workspace_id, metastore_id [, metastore_assignment]) - - Assigns a workspace to a metastore. - - Creates an assignment to a metastore for a workspace - - :param workspace_id: int - Workspace ID. - :param metastore_id: str - Unity Catalog metastore ID - :param metastore_assignment: :class:`CreateMetastoreAssignment` (optional) - - - - - .. py:method:: delete(workspace_id, metastore_id) - - Delete a metastore assignment. - - Deletes a metastore assignment to a workspace, leaving the workspace with no metastore. - - :param workspace_id: int - Workspace ID. - :param metastore_id: str - Unity Catalog metastore ID - - - - - .. py:method:: get(workspace_id) - - Gets the metastore assignment for a workspace. - - Gets the metastore assignment, if any, for the workspace specified by ID. If the workspace is assigned - a metastore, the mappig will be returned. If no metastore is assigned to the workspace, the assignment - will not be found and a 404 returned. - - :param workspace_id: int - Workspace ID. - - :returns: :class:`AccountsMetastoreAssignment` - - - .. py:method:: list(metastore_id) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import AccountClient - - a = AccountClient() - - ws = a.metastore_assignments.list(metastore_id=os.environ["TEST_METASTORE_ID"]) - - Get all workspaces assigned to a metastore. - - Gets a list of all Databricks workspace IDs that have been assigned to given metastore. - - :param metastore_id: str - Unity Catalog metastore ID - - :returns: Iterator over int - - - .. py:method:: update(workspace_id, metastore_id [, metastore_assignment]) - - Updates a metastore assignment to a workspaces. - - Updates an assignment to a metastore for a workspace. Currently, only the default catalog may be - updated. - - :param workspace_id: int - Workspace ID. - :param metastore_id: str - Unity Catalog metastore ID - :param metastore_assignment: :class:`UpdateMetastoreAssignment` (optional) - - - \ No newline at end of file diff --git a/docs/account/metastores.rst b/docs/account/metastores.rst deleted file mode 100644 index f2ba17011..000000000 --- a/docs/account/metastores.rst +++ /dev/null @@ -1,133 +0,0 @@ -Account Metastores -================== -.. py:class:: AccountMetastoresAPI - - These APIs manage Unity Catalog metastores for an account. A metastore contains catalogs that can be - associated with workspaces - - .. py:method:: create( [, metastore_info]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Create metastore. - - Creates a Unity Catalog metastore. - - :param metastore_info: :class:`CreateMetastore` (optional) - - :returns: :class:`AccountsMetastoreInfo` - - - .. py:method:: delete(metastore_id [, force]) - - Delete a metastore. - - Deletes a Unity Catalog metastore for an account, both specified by ID. - - :param metastore_id: str - Unity Catalog metastore ID - :param force: bool (optional) - Force deletion even if the metastore is not empty. Default is false. - - - - - .. py:method:: get(metastore_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - _ = w.metastores.get(id=created.metastore_id) - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Get a metastore. - - Gets a Unity Catalog metastore from an account, both specified by ID. - - :param metastore_id: str - Unity Catalog metastore ID - - :returns: :class:`AccountsMetastoreInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.metastores.list() - - Get all metastores associated with an account. - - Gets all Unity Catalog metastores associated with an account specified by ID. - - :returns: Iterator over :class:`MetastoreInfo` - - - .. py:method:: update(metastore_id [, metastore_info]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - _ = w.metastores.update(id=created.metastore_id, name=f'sdk-{time.time_ns()}') - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Update a metastore. - - Updates an existing Unity Catalog metastore. - - :param metastore_id: str - Unity Catalog metastore ID - :param metastore_info: :class:`UpdateMetastore` (optional) - - :returns: :class:`AccountsMetastoreInfo` - \ No newline at end of file diff --git a/docs/account/network_connectivity.rst b/docs/account/network_connectivity.rst deleted file mode 100644 index 51fad08dd..000000000 --- a/docs/account/network_connectivity.rst +++ /dev/null @@ -1,144 +0,0 @@ -Network Connectivity -==================== -.. py:class:: NetworkConnectivityAPI - - These APIs provide configurations for the network connectivity of your workspaces for serverless compute - resources. This API provides stable subnets for your workspace so that you can configure your firewalls on - your Azure Storage accounts to allow access from Databricks. You can also use the API to provision private - endpoints for Databricks to privately connect serverless compute resources to your Azure resources using - Azure Private Link. See [configure serverless secure connectivity]. - - [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security - - .. py:method:: create_network_connectivity_configuration(name, region) - - Create a network connectivity configuration. - - Creates a network connectivity configuration (NCC), which provides stable Azure service subnets when - accessing your Azure Storage accounts. You can also use a network connectivity configuration to create - Databricks-managed private endpoints so that Databricks serverless compute resources privately access - your resources. - - **IMPORTANT**: After you create the network connectivity configuration, you must assign one or more - workspaces to the new network connectivity configuration. You can share one network connectivity - configuration with multiple workspaces from the same Azure region within the same Databricks account. - See [configure serverless secure connectivity]. - - [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security - - :param name: str - The name of the network connectivity configuration. The name can contain alphanumeric characters, - hyphens, and underscores. The length must be between 3 and 30 characters. The name must match the - regular expression `^[0-9a-zA-Z-_]{3,30}$`. - :param region: str - The Azure region for this network connectivity configuration. Only workspaces in the same Azure - region can be attached to this network connectivity configuration. - - :returns: :class:`NetworkConnectivityConfiguration` - - - .. py:method:: create_private_endpoint_rule(network_connectivity_config_id, resource_id, group_id) - - Create a private endpoint rule. - - Create a private endpoint rule for the specified network connectivity config object. Once the object - is created, Databricks asynchronously provisions a new Azure private endpoint to your specified Azure - resource. - - **IMPORTANT**: You must use Azure portal or other Azure tools to approve the private endpoint to - complete the connection. To get the information of the private endpoint created, make a `GET` request - on the new private endpoint rule. See [serverless private link]. - - [serverless private link]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security/serverless-private-link - - :param network_connectivity_config_id: str - Your Network Connectvity Configuration ID. - :param resource_id: str - The Azure resource ID of the target resource. - :param group_id: :class:`CreatePrivateEndpointRuleRequestGroupId` - The sub-resource type (group ID) of the target resource. Note that to connect to workspace root - storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`. - - :returns: :class:`NccAzurePrivateEndpointRule` - - - .. py:method:: delete_network_connectivity_configuration(network_connectivity_config_id) - - Delete a network connectivity configuration. - - Deletes a network connectivity configuration. - - :param network_connectivity_config_id: str - Your Network Connectvity Configuration ID. - - - - - .. py:method:: delete_private_endpoint_rule(network_connectivity_config_id, private_endpoint_rule_id) - - Delete a private endpoint rule. - - Initiates deleting a private endpoint rule. The private endpoint will be deactivated and will be - purged after seven days of deactivation. When a private endpoint is in deactivated state, - `deactivated` field is set to `true` and the private endpoint is not available to your serverless - compute resources. - - :param network_connectivity_config_id: str - Your Network Connectvity Configuration ID. - :param private_endpoint_rule_id: str - Your private endpoint rule ID. - - :returns: :class:`NccAzurePrivateEndpointRule` - - - .. py:method:: get_network_connectivity_configuration(network_connectivity_config_id) - - Get a network connectivity configuration. - - Gets a network connectivity configuration. - - :param network_connectivity_config_id: str - Your Network Connectvity Configuration ID. - - :returns: :class:`NetworkConnectivityConfiguration` - - - .. py:method:: get_private_endpoint_rule(network_connectivity_config_id, private_endpoint_rule_id) - - Get a private endpoint rule. - - Gets the private endpoint rule. - - :param network_connectivity_config_id: str - Your Network Connectvity Configuration ID. - :param private_endpoint_rule_id: str - Your private endpoint rule ID. - - :returns: :class:`NccAzurePrivateEndpointRule` - - - .. py:method:: list_network_connectivity_configurations( [, page_token]) - - List network connectivity configurations. - - Gets an array of network connectivity configurations. - - :param page_token: str (optional) - Pagination token to go to next page based on previous query. - - :returns: Iterator over :class:`NetworkConnectivityConfiguration` - - - .. py:method:: list_private_endpoint_rules(network_connectivity_config_id [, page_token]) - - List private endpoint rules. - - Gets an array of private endpoint rules. - - :param network_connectivity_config_id: str - Your Network Connectvity Configuration ID. - :param page_token: str (optional) - Pagination token to go to next page based on previous query. - - :returns: Iterator over :class:`NccAzurePrivateEndpointRule` - \ No newline at end of file diff --git a/docs/account/network_policy.rst b/docs/account/network_policy.rst deleted file mode 100644 index 17b60ac40..000000000 --- a/docs/account/network_policy.rst +++ /dev/null @@ -1,55 +0,0 @@ -Network Policy -============== -.. py:class:: AccountNetworkPolicyAPI - - Network policy is a set of rules that defines what can be accessed from your Databricks network. E.g.: You - can choose to block your SQL UDF to access internet from your Databricks serverless clusters. - - There is only one instance of this setting per account. Since this setting has a default value, this - setting is present on all accounts even though it's never set on a given account. Deletion reverts the - value of the setting back to the default value. - - .. py:method:: delete_account_network_policy(etag) - - Delete Account Network Policy. - - Reverts back all the account network policies back to default. - - :param etag: str - etag used for versioning. The response is at least as fresh as the eTag provided. This is used for - optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting - each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern - to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET - request, and pass it with the DELETE request to identify the rule set version you are deleting. - - :returns: :class:`DeleteAccountNetworkPolicyResponse` - - - .. py:method:: read_account_network_policy(etag) - - Get Account Network Policy. - - Gets the value of Account level Network Policy. - - :param etag: str - etag used for versioning. The response is at least as fresh as the eTag provided. This is used for - optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting - each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern - to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET - request, and pass it with the DELETE request to identify the rule set version you are deleting. - - :returns: :class:`AccountNetworkPolicyMessage` - - - .. py:method:: update_account_network_policy( [, allow_missing, setting]) - - Update Account Network Policy. - - Updates the policy content of Account level Network Policy. - - :param allow_missing: bool (optional) - This should always be set to true for Settings RPCs. Added for AIP compliance. - :param setting: :class:`AccountNetworkPolicyMessage` (optional) - - :returns: :class:`AccountNetworkPolicyMessage` - \ No newline at end of file diff --git a/docs/account/networks.rst b/docs/account/networks.rst deleted file mode 100644 index a498c7af4..000000000 --- a/docs/account/networks.rst +++ /dev/null @@ -1,118 +0,0 @@ -Network configurations -====================== -.. py:class:: NetworksAPI - - These APIs manage network configurations for customer-managed VPCs (optional). Its ID is used when - creating a new workspace if you use customer-managed VPCs. - - .. py:method:: create(network_name [, gcp_network_info, security_group_ids, subnet_ids, vpc_endpoints, vpc_id]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - netw = a.networks.create(network_name=f'sdk-{time.time_ns()}', - vpc_id=hex(time.time_ns())[2:], - subnet_ids=[hex(time.time_ns())[2:], - hex(time.time_ns())[2:]], - security_group_ids=[hex(time.time_ns())[2:]]) - - Create network configuration. - - Creates a Databricks network configuration that represents an VPC and its resources. The VPC will be - used for new Databricks clusters. This requires a pre-existing VPC and subnets. - - :param network_name: str - The human-readable name of the network configuration. - :param gcp_network_info: :class:`GcpNetworkInfo` (optional) - The Google Cloud specific information for this network (for example, the VPC ID, subnet ID, and - secondary IP ranges). - :param security_group_ids: List[str] (optional) - IDs of one to five security groups associated with this network. Security group IDs **cannot** be - used in multiple network configurations. - :param subnet_ids: List[str] (optional) - IDs of at least two subnets associated with this network. Subnet IDs **cannot** be used in multiple - network configurations. - :param vpc_endpoints: :class:`NetworkVpcEndpoints` (optional) - If specified, contains the VPC endpoints used to allow cluster communication from this VPC over [AWS - PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink/ - :param vpc_id: str (optional) - The ID of the VPC associated with this network. VPC IDs can be used in multiple network - configurations. - - :returns: :class:`Network` - - - .. py:method:: delete(network_id) - - Delete a network configuration. - - Deletes a Databricks network configuration, which represents a cloud VPC and its resources. You cannot - delete a network that is associated with a workspace. - - This operation is available only if your account is on the E2 version of the platform. - - :param network_id: str - Databricks Account API network configuration ID. - - - - - .. py:method:: get(network_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - netw = a.networks.create(network_name=f'sdk-{time.time_ns()}', - vpc_id=hex(time.time_ns())[2:], - subnet_ids=[hex(time.time_ns())[2:], - hex(time.time_ns())[2:]], - security_group_ids=[hex(time.time_ns())[2:]]) - - by_id = a.networks.get(network_id=netw.network_id) - - Get a network configuration. - - Gets a Databricks network configuration, which represents a cloud VPC and its resources. - - :param network_id: str - Databricks Account API network configuration ID. - - :returns: :class:`Network` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - configs = a.networks.list() - - Get all network configurations. - - Gets a list of all Databricks network configurations for an account, specified by ID. - - This operation is available only if your account is on the E2 version of the platform. - - :returns: Iterator over :class:`Network` - \ No newline at end of file diff --git a/docs/account/o_auth_enrollment.rst b/docs/account/o_auth_enrollment.rst deleted file mode 100644 index fc7572f58..000000000 --- a/docs/account/o_auth_enrollment.rst +++ /dev/null @@ -1,39 +0,0 @@ -OAuth Enrollment -================ -.. py:class:: OAuthEnrollmentAPI - - These APIs enable administrators to enroll OAuth for their accounts, which is required for adding/using - any OAuth published/custom application integration. - - **Note:** Your account must be on the E2 version to use these APIs, this is because OAuth is only - supported on the E2 version. - - .. py:method:: create( [, enable_all_published_apps]) - - Create OAuth Enrollment request. - - Create an OAuth Enrollment request to enroll OAuth for this account and optionally enable the OAuth - integration for all the partner applications in the account. - - The parter applications are: - Power BI - Tableau Desktop - Databricks CLI - - The enrollment is executed asynchronously, so the API will return 204 immediately. The actual - enrollment take a few minutes, you can check the status via API :method:OAuthEnrollment/get. - - :param enable_all_published_apps: bool (optional) - If true, enable OAuth for all the published applications in the account. - - - - - .. py:method:: get() - - Get OAuth enrollment status. - - Gets the OAuth enrollment status for this Account. - - You can only add/use the OAuth published/custom application integrations when OAuth enrollment status - is enabled. - - :returns: :class:`OAuthEnrollmentStatus` - \ No newline at end of file diff --git a/docs/account/o_auth_published_apps.rst b/docs/account/o_auth_published_apps.rst deleted file mode 100644 index 61458e899..000000000 --- a/docs/account/o_auth_published_apps.rst +++ /dev/null @@ -1,21 +0,0 @@ -OAuth Published App -=================== -.. py:class:: OAuthPublishedAppsAPI - - These APIs enable administrators to view all the available published OAuth applications in Databricks. - Administrators can add the published OAuth applications to their account through the OAuth Published App - Integration APIs. - - .. py:method:: list( [, page_size, page_token]) - - Get all the published OAuth apps. - - Get all the available published OAuth apps in Databricks. - - :param page_size: int (optional) - The max number of OAuth published apps to return. - :param page_token: str (optional) - A token that can be used to get the next page of results. - - :returns: Iterator over :class:`PublishedAppOutput` - \ No newline at end of file diff --git a/docs/account/private_access.rst b/docs/account/private_access.rst deleted file mode 100644 index 5bb8514f7..000000000 --- a/docs/account/private_access.rst +++ /dev/null @@ -1,220 +0,0 @@ -Private Access Settings -======================= -.. py:class:: PrivateAccessAPI - - These APIs manage private access settings for this account. - - .. py:method:: create(private_access_settings_name, region [, allowed_vpc_endpoint_ids, private_access_level, public_access_enabled]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - created = a.private_access.create(private_access_settings_name=f'sdk-{time.time_ns()}', - region=os.environ["AWS_REGION"]) - - # cleanup - a.private_access.delete(private_access_settings_id=created.private_access_settings_id) - - Create private access settings. - - Creates a private access settings object, which specifies how your workspace is accessed over [AWS - PrivateLink]. To use AWS PrivateLink, a workspace must have a private access settings object - referenced by ID in the workspace's `private_access_settings_id` property. - - You can share one private access settings with multiple workspaces in a single account. However, - private access settings are specific to AWS regions, so only workspaces in the same AWS region can use - a given private access settings object. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - - :param private_access_settings_name: str - The human-readable name of the private access settings object. - :param region: str - The cloud region for workspaces associated with this private access settings object. - :param allowed_vpc_endpoint_ids: List[str] (optional) - An array of Databricks VPC endpoint IDs. This is the Databricks ID that is returned when registering - the VPC endpoint configuration in your Databricks account. This is not the ID of the VPC endpoint in - AWS. - - Only used when `private_access_level` is set to `ENDPOINT`. This is an allow list of VPC endpoints - that in your account that can connect to your workspace over AWS PrivateLink. - - If hybrid access to your workspace is enabled by setting `public_access_enabled` to `true`, this - control only works for PrivateLink connections. To control how your workspace is accessed via public - internet, see [IP access lists]. - - [IP access lists]: https://docs.databricks.com/security/network/ip-access-list.html - :param private_access_level: :class:`PrivateAccessLevel` (optional) - The private access level controls which VPC endpoints can connect to the UI or API of any workspace - that attaches this private access settings object. * `ACCOUNT` level access (the default) allows - only VPC endpoints that are registered in your Databricks account connect to your workspace. * - `ENDPOINT` level access allows only specified VPC endpoints connect to your workspace. For details, - see `allowed_vpc_endpoint_ids`. - :param public_access_enabled: bool (optional) - Determines if the workspace can be accessed over public internet. For fully private workspaces, you - can optionally specify `false`, but only if you implement both the front-end and the back-end - PrivateLink connections. Otherwise, specify `true`, which means that public access is enabled. - - :returns: :class:`PrivateAccessSettings` - - - .. py:method:: delete(private_access_settings_id) - - Delete a private access settings object. - - Deletes a private access settings object, which determines how your workspace is accessed over [AWS - PrivateLink]. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - - :param private_access_settings_id: str - Databricks Account API private access settings ID. - - - - - .. py:method:: get(private_access_settings_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - created = a.private_access.create(private_access_settings_name=f'sdk-{time.time_ns()}', - region=os.environ["AWS_REGION"]) - - by_id = a.private_access.get(private_access_settings_id=created.private_access_settings_id) - - # cleanup - a.private_access.delete(private_access_settings_id=created.private_access_settings_id) - - Get a private access settings object. - - Gets a private access settings object, which specifies how your workspace is accessed over [AWS - PrivateLink]. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - - :param private_access_settings_id: str - Databricks Account API private access settings ID. - - :returns: :class:`PrivateAccessSettings` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - all = a.private_access.list() - - Get all private access settings objects. - - Gets a list of all private access settings objects for an account, specified by ID. - - :returns: Iterator over :class:`PrivateAccessSettings` - - - .. py:method:: replace(private_access_settings_id, private_access_settings_name, region [, allowed_vpc_endpoint_ids, private_access_level, public_access_enabled]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - created = a.private_access.create(private_access_settings_name=f'sdk-{time.time_ns()}', - region=os.environ["AWS_REGION"]) - - a.private_access.replace(private_access_settings_id=created.private_access_settings_id, - private_access_settings_name=f'sdk-{time.time_ns()}', - region=os.environ["AWS_REGION"]) - - # cleanup - a.private_access.delete(private_access_settings_id=created.private_access_settings_id) - - Replace private access settings. - - Updates an existing private access settings object, which specifies how your workspace is accessed - over [AWS PrivateLink]. To use AWS PrivateLink, a workspace must have a private access settings object - referenced by ID in the workspace's `private_access_settings_id` property. - - This operation completely overwrites your existing private access settings object attached to your - workspaces. All workspaces attached to the private access settings are affected by any change. If - `public_access_enabled`, `private_access_level`, or `allowed_vpc_endpoint_ids` are updated, effects of - these changes might take several minutes to propagate to the workspace API. - - You can share one private access settings object with multiple workspaces in a single account. - However, private access settings are specific to AWS regions, so only workspaces in the same AWS - region can use a given private access settings object. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - - :param private_access_settings_id: str - Databricks Account API private access settings ID. - :param private_access_settings_name: str - The human-readable name of the private access settings object. - :param region: str - The cloud region for workspaces associated with this private access settings object. - :param allowed_vpc_endpoint_ids: List[str] (optional) - An array of Databricks VPC endpoint IDs. This is the Databricks ID that is returned when registering - the VPC endpoint configuration in your Databricks account. This is not the ID of the VPC endpoint in - AWS. - - Only used when `private_access_level` is set to `ENDPOINT`. This is an allow list of VPC endpoints - that in your account that can connect to your workspace over AWS PrivateLink. - - If hybrid access to your workspace is enabled by setting `public_access_enabled` to `true`, this - control only works for PrivateLink connections. To control how your workspace is accessed via public - internet, see [IP access lists]. - - [IP access lists]: https://docs.databricks.com/security/network/ip-access-list.html - :param private_access_level: :class:`PrivateAccessLevel` (optional) - The private access level controls which VPC endpoints can connect to the UI or API of any workspace - that attaches this private access settings object. * `ACCOUNT` level access (the default) allows - only VPC endpoints that are registered in your Databricks account connect to your workspace. * - `ENDPOINT` level access allows only specified VPC endpoints connect to your workspace. For details, - see `allowed_vpc_endpoint_ids`. - :param public_access_enabled: bool (optional) - Determines if the workspace can be accessed over public internet. For fully private workspaces, you - can optionally specify `false`, but only if you implement both the front-end and the back-end - PrivateLink connections. Otherwise, specify `true`, which means that public access is enabled. - - - \ No newline at end of file diff --git a/docs/account/published_app_integration.rst b/docs/account/published_app_integration.rst deleted file mode 100644 index 689597da7..000000000 --- a/docs/account/published_app_integration.rst +++ /dev/null @@ -1,71 +0,0 @@ -OAuth Published App Integration -=============================== -.. py:class:: PublishedAppIntegrationAPI - - These APIs enable administrators to manage published oauth app integrations, which is required for - adding/using Published OAuth App Integration like Tableau Desktop for Databricks in AWS cloud. - - .. py:method:: create( [, app_id, token_access_policy]) - - Create Published OAuth App Integration. - - Create Published OAuth App Integration. - - You can retrieve the published oauth app integration via :method:PublishedAppIntegration/get. - - :param app_id: str (optional) - app_id of the oauth published app integration. For example power-bi, tableau-deskop - :param token_access_policy: :class:`TokenAccessPolicy` (optional) - Token access policy - - :returns: :class:`CreatePublishedAppIntegrationOutput` - - - .. py:method:: delete(integration_id) - - Delete Published OAuth App Integration. - - Delete an existing Published OAuth App Integration. You can retrieve the published oauth app - integration via :method:PublishedAppIntegration/get. - - :param integration_id: str - The oauth app integration ID. - - - - - .. py:method:: get(integration_id) - - Get OAuth Published App Integration. - - Gets the Published OAuth App Integration for the given integration id. - - :param integration_id: str - The oauth app integration ID. - - :returns: :class:`GetPublishedAppIntegrationOutput` - - - .. py:method:: list() - - Get published oauth app integrations. - - Get the list of published oauth app integrations for the specified Databricks account - - :returns: Iterator over :class:`GetPublishedAppIntegrationOutput` - - - .. py:method:: update(integration_id [, token_access_policy]) - - Updates Published OAuth App Integration. - - Updates an existing published OAuth App Integration. You can retrieve the published oauth app - integration via :method:PublishedAppIntegration/get. - - :param integration_id: str - The oauth app integration ID. - :param token_access_policy: :class:`TokenAccessPolicy` (optional) - Token access policy to be updated in the published oauth app integration - - - \ No newline at end of file diff --git a/docs/account/service_principal_secrets.rst b/docs/account/service_principal_secrets.rst deleted file mode 100644 index b8720c747..000000000 --- a/docs/account/service_principal_secrets.rst +++ /dev/null @@ -1,54 +0,0 @@ -Service Principal Secrets -========================= -.. py:class:: ServicePrincipalSecretsAPI - - These APIs enable administrators to manage service principal secrets. - - You can use the generated secrets to obtain OAuth access tokens for a service principal, which can then be - used to access Databricks Accounts and Workspace APIs. For more information, see [Authentication using - OAuth tokens for service principals], - - In addition, the generated secrets can be used to configure the Databricks Terraform Provider to - authenticate with the service principal. For more information, see [Databricks Terraform Provider]. - - [Authentication using OAuth tokens for service principals]: https://docs.databricks.com/dev-tools/authentication-oauth.html - [Databricks Terraform Provider]: https://github.com/databricks/terraform-provider-databricks/blob/master/docs/index.md#authenticating-with-service-principal - - .. py:method:: create(service_principal_id) - - Create service principal secret. - - Create a secret for the given service principal. - - :param service_principal_id: int - The service principal ID. - - :returns: :class:`CreateServicePrincipalSecretResponse` - - - .. py:method:: delete(service_principal_id, secret_id) - - Delete service principal secret. - - Delete a secret from the given service principal. - - :param service_principal_id: int - The service principal ID. - :param secret_id: str - The secret ID. - - - - - .. py:method:: list(service_principal_id) - - List service principal secrets. - - List all secrets associated with the given service principal. This operation only returns information - about the secrets themselves and does not include the secret values. - - :param service_principal_id: int - The service principal ID. - - :returns: Iterator over :class:`SecretInfo` - \ No newline at end of file diff --git a/docs/account/service_principals.rst b/docs/account/service_principals.rst deleted file mode 100644 index 5076c723f..000000000 --- a/docs/account/service_principals.rst +++ /dev/null @@ -1,234 +0,0 @@ -Account Service Principals -========================== -.. py:class:: AccountServicePrincipalsAPI - - Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. - Databricks recommends creating service principals to run production jobs or modify production data. If all - processes that act on production data run with service principals, interactive users do not need any - write, delete, or modify privileges in production. This eliminates the risk of a user overwriting - production data by accident. - - .. py:method:: create( [, active, application_id, display_name, entitlements, external_id, groups, id, roles, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - groups = w.groups.group_display_name_to_id_map(iam.ListGroupsRequest()) - - spn = w.service_principals.create(display_name=f'sdk-{time.time_ns()}', - groups=[iam.ComplexValue(value=groups["admins"])]) - - # cleanup - w.service_principals.delete(id=spn.id) - - Create a service principal. - - Creates a new service principal in the Databricks account. - - :param active: bool (optional) - If this user is active - :param application_id: str (optional) - UUID relating to the service principal - :param display_name: str (optional) - String that represents a concatenation of given and family names. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the service principal. See [assigning entitlements] for a full list of - supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param id: str (optional) - Databricks service principal ID. - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`ServicePrincipalSchema`] (optional) - The schema of the List response. - - :returns: :class:`ServicePrincipal` - - - .. py:method:: delete(id) - - Delete a service principal. - - Delete a single service principal in the Databricks account. - - :param id: str - Unique ID for a service principal in the Databricks account. - - - - - .. py:method:: get(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.service_principals.create(display_name=f'sdk-{time.time_ns()}') - - by_id = w.service_principals.get(id=created.id) - - # cleanup - w.service_principals.delete(id=created.id) - - Get service principal details. - - Gets the details for a single service principal define in the Databricks account. - - :param id: str - Unique ID for a service principal in the Databricks account. - - :returns: :class:`ServicePrincipal` - - - .. py:method:: list( [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - sp_create = a.service_principals.create(active=True, display_name=f'sdk-{time.time_ns()}') - - sp = a.service_principals.get(id=sp_create.id) - - sp_list = a.service_principals.list(filter="displayName eq %v" % (sp.display_name)) - - # cleanup - a.service_principals.delete(id=sp_create.id) - - List service principals. - - Gets the set of service principals associated with a Databricks account. - - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. Default is 10000. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. - :param sort_order: :class:`ListSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: Iterator over :class:`ServicePrincipal` - - - .. py:method:: patch(id [, operations, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import iam - - a = AccountClient() - - sp_create = a.service_principals.create(active=True, display_name=f'sdk-{time.time_ns()}') - - sp = a.service_principals.get(id=sp_create.id) - - a.service_principals.patch(id=sp.id, - operations=[iam.Patch(op=iam.PatchOp.REPLACE, path="active", value="false")], - schemas=[iam.PatchSchema.URN_IETF_PARAMS_SCIM_API_MESSAGES_2_0_PATCH_OP]) - - # cleanup - a.service_principals.delete(id=sp_create.id) - - Update service principal details. - - Partially updates the details of a single service principal in the Databricks account. - - :param id: str - Unique ID for a service principal in the Databricks account. - :param operations: List[:class:`Patch`] (optional) - :param schemas: List[:class:`PatchSchema`] (optional) - The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - - - - - .. py:method:: update(id [, active, application_id, display_name, entitlements, external_id, groups, roles, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - created = w.service_principals.create(display_name=f'sdk-{time.time_ns()}') - - w.service_principals.update(id=created.id, - display_name=f'sdk-{time.time_ns()}', - roles=[iam.ComplexValue(value="xyz")]) - - # cleanup - w.service_principals.delete(id=created.id) - - Replace service principal. - - Updates the details of a single service principal. - - This action replaces the existing service principal with the same name. - - :param id: str - Databricks service principal ID. - :param active: bool (optional) - If this user is active - :param application_id: str (optional) - UUID relating to the service principal - :param display_name: str (optional) - String that represents a concatenation of given and family names. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the service principal. See [assigning entitlements] for a full list of - supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`ServicePrincipalSchema`] (optional) - The schema of the List response. - - - \ No newline at end of file diff --git a/docs/account/settings.rst b/docs/account/settings.rst deleted file mode 100644 index 08ec2dae9..000000000 --- a/docs/account/settings.rst +++ /dev/null @@ -1,56 +0,0 @@ -Personal Compute Enablement -=========================== -.. py:class:: AccountSettingsAPI - - The Personal Compute enablement setting lets you control which users can use the Personal Compute default - policy to create compute resources. By default all users in all workspaces have access (ON), but you can - change the setting to instead let individual workspaces configure access control (DELEGATE). - - There is only one instance of this setting per account. Since this setting has a default value, this - setting is present on all accounts even though it's never set on a given account. Deletion reverts the - value of the setting back to the default value. - - .. py:method:: delete_personal_compute_setting(etag) - - Delete Personal Compute setting. - - Reverts back the Personal Compute setting value to default (ON) - - :param etag: str - etag used for versioning. The response is at least as fresh as the eTag provided. This is used for - optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting - each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern - to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET - request, and pass it with the DELETE request to identify the rule set version you are deleting. - - :returns: :class:`DeletePersonalComputeSettingResponse` - - - .. py:method:: read_personal_compute_setting(etag) - - Get Personal Compute setting. - - Gets the value of the Personal Compute setting. - - :param etag: str - etag used for versioning. The response is at least as fresh as the eTag provided. This is used for - optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting - each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern - to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET - request, and pass it with the DELETE request to identify the rule set version you are deleting. - - :returns: :class:`PersonalComputeSetting` - - - .. py:method:: update_personal_compute_setting( [, allow_missing, setting]) - - Update Personal Compute setting. - - Updates the value of the Personal Compute setting. - - :param allow_missing: bool (optional) - This should always be set to true for Settings RPCs. Added for AIP compliance. - :param setting: :class:`PersonalComputeSetting` (optional) - - :returns: :class:`PersonalComputeSetting` - \ No newline at end of file diff --git a/docs/account/storage.rst b/docs/account/storage.rst deleted file mode 100644 index 71351f9d1..000000000 --- a/docs/account/storage.rst +++ /dev/null @@ -1,109 +0,0 @@ -Storage configurations -====================== -.. py:class:: StorageAPI - - These APIs manage storage configurations for this workspace. A root storage S3 bucket in your account is - required to store objects like cluster logs, notebook revisions, and job results. You can also use the - root storage S3 bucket for storage of non-production DBFS data. A storage configuration encapsulates this - bucket information, and its ID is used when creating a new workspace. - - .. py:method:: create(storage_configuration_name, root_bucket_info) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - storage = a.storage.create( - storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=os.environ["TEST_ROOT_BUCKET"])) - - # cleanup - a.storage.delete(storage_configuration_id=storage.storage_configuration_id) - - Create new storage configuration. - - Creates new storage configuration for an account, specified by ID. Uploads a storage configuration - object that represents the root AWS S3 bucket in your account. Databricks stores related workspace - assets including DBFS, cluster logs, and job results. For the AWS S3 bucket, you need to configure the - required bucket policy. - - For information about how to create a new workspace with this API, see [Create a new workspace using - the Account API] - - [Create a new workspace using the Account API]: http://docs.databricks.com/administration-guide/account-api/new-workspace.html - - :param storage_configuration_name: str - The human-readable name of the storage configuration. - :param root_bucket_info: :class:`RootBucketInfo` - Root S3 bucket information. - - :returns: :class:`StorageConfiguration` - - - .. py:method:: delete(storage_configuration_id) - - Delete storage configuration. - - Deletes a Databricks storage configuration. You cannot delete a storage configuration that is - associated with any workspace. - - :param storage_configuration_id: str - Databricks Account API storage configuration ID. - - - - - .. py:method:: get(storage_configuration_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - storage = a.storage.create(storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=f'sdk-{time.time_ns()}')) - - by_id = a.storage.get(storage_configuration_id=storage.storage_configuration_id) - - Get storage configuration. - - Gets a Databricks storage configuration for an account, both specified by ID. - - :param storage_configuration_id: str - Databricks Account API storage configuration ID. - - :returns: :class:`StorageConfiguration` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - configs = a.storage.list() - - Get all storage configurations. - - Gets a list of all Databricks storage configurations for your account, specified by ID. - - :returns: Iterator over :class:`StorageConfiguration` - \ No newline at end of file diff --git a/docs/account/storage_credentials.rst b/docs/account/storage_credentials.rst deleted file mode 100644 index e0a5ea5f2..000000000 --- a/docs/account/storage_credentials.rst +++ /dev/null @@ -1,158 +0,0 @@ -Account Storage Credentials -=========================== -.. py:class:: AccountStorageCredentialsAPI - - These APIs manage storage credentials for a particular metastore. - - .. py:method:: create(metastore_id [, credential_info]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - # cleanup - w.storage_credentials.delete(delete=created.name) - - Create a storage credential. - - Creates a new storage credential. The request object is specific to the cloud: - - * **AwsIamRole** for AWS credentials * **AzureServicePrincipal** for Azure credentials * - **GcpServiceAcountKey** for GCP credentials. - - The caller must be a metastore admin and have the **CREATE_STORAGE_CREDENTIAL** privilege on the - metastore. - - :param metastore_id: str - Unity Catalog metastore ID - :param credential_info: :class:`CreateStorageCredential` (optional) - - :returns: :class:`AccountsStorageCredentialInfo` - - - .. py:method:: delete(metastore_id, storage_credential_name [, force]) - - Delete a storage credential. - - Deletes a storage credential from the metastore. The caller must be an owner of the storage - credential. - - :param metastore_id: str - Unity Catalog metastore ID - :param storage_credential_name: str - Name of the storage credential. - :param force: bool (optional) - Force deletion even if the Storage Credential is not empty. Default is false. - - - - - .. py:method:: get(metastore_id, storage_credential_name) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - by_name = w.storage_credentials.get(name=created.name) - - # cleanup - w.storage_credentials.delete(name=created.name) - - Gets the named storage credential. - - Gets a storage credential from the metastore. The caller must be a metastore admin, the owner of the - storage credential, or have a level of privilege on the storage credential. - - :param metastore_id: str - Unity Catalog metastore ID - :param storage_credential_name: str - Name of the storage credential. - - :returns: :class:`AccountsStorageCredentialInfo` - - - .. py:method:: list(metastore_id) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.storage_credentials.list() - - Get all storage credentials assigned to a metastore. - - Gets a list of all storage credentials that have been assigned to given metastore. - - :param metastore_id: str - Unity Catalog metastore ID - - :returns: Iterator over :class:`StorageCredentialInfo` - - - .. py:method:: update(metastore_id, storage_credential_name [, credential_info]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - _ = w.storage_credentials.update( - name=created.name, - comment=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - # cleanup - w.storage_credentials.delete(delete=created.name) - - Updates a storage credential. - - Updates a storage credential on the metastore. The caller must be the owner of the storage credential. - If the caller is a metastore admin, only the __owner__ credential can be changed. - - :param metastore_id: str - Unity Catalog metastore ID - :param storage_credential_name: str - Name of the storage credential. - :param credential_info: :class:`UpdateStorageCredential` (optional) - - :returns: :class:`AccountsStorageCredentialInfo` - \ No newline at end of file diff --git a/docs/account/users.rst b/docs/account/users.rst deleted file mode 100644 index b9c6e74fb..000000000 --- a/docs/account/users.rst +++ /dev/null @@ -1,268 +0,0 @@ -Account Users -============= -.. py:class:: AccountUsersAPI - - User identities recognized by Databricks and represented by email addresses. - - Databricks recommends using SCIM provisioning to sync users and groups automatically from your identity - provider to your Databricks account. SCIM streamlines onboarding a new employee or team by using your - identity provider to create users and groups in Databricks account and give them the proper level of - access. When a user leaves your organization or no longer needs access to Databricks account, admins can - terminate the user in your identity provider and that user’s account will also be removed from - Databricks account. This ensures a consistent offboarding process and prevents unauthorized users from - accessing sensitive data. - - .. py:method:: create( [, active, display_name, emails, entitlements, external_id, groups, id, name, roles, schemas, user_name]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - user = a.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - # cleanup - a.users.delete(id=user.id) - - Create a new user. - - Creates a new user in the Databricks account. This new user will also be added to the Databricks - account. - - :param active: bool (optional) - If this user is active - :param display_name: str (optional) - String that represents a concatenation of given and family names. For example `John Smith`. This - field cannot be updated through the Workspace SCIM APIs when [identity federation is enabled]. Use - Account SCIM APIs to update `displayName`. - - [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation - :param emails: List[:class:`ComplexValue`] (optional) - All the emails associated with the Databricks user. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the user. See [assigning entitlements] for a full list of supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - External ID is not currently supported. It is reserved for future use. - :param groups: List[:class:`ComplexValue`] (optional) - :param id: str (optional) - Databricks user ID. This is automatically set by Databricks. Any value provided by the client will - be ignored. - :param name: :class:`Name` (optional) - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`UserSchema`] (optional) - The schema of the user. - :param user_name: str (optional) - Email address of the Databricks user. - - :returns: :class:`User` - - - .. py:method:: delete(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - other_owner = w.users.create(user_name=f'sdk-{time.time_ns()}@example.com') - - w.users.delete(id=other_owner.id) - - Delete a user. - - Deletes a user. Deleting a user from a Databricks account also removes objects associated with the - user. - - :param id: str - Unique ID for a user in the Databricks account. - - - - - .. py:method:: get(id [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - user = a.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - by_id = a.users.get(id=user.id) - - # cleanup - a.users.delete(id=user.id) - - Get user details. - - Gets information for a specific user in Databricks account. - - :param id: str - Unique ID for a user in the Databricks account. - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. Default is 10000. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. Multi-part paths are supported. For example, `userName`, - `name.givenName`, and `emails`. - :param sort_order: :class:`GetSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: :class:`User` - - - .. py:method:: list( [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - all_users = w.users.list(attributes="id,userName", - sort_by="userName", - sort_order=iam.ListSortOrder.DESCENDING) - - List users. - - Gets details for all the users associated with a Databricks account. - - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. Default is 10000. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. Multi-part paths are supported. For example, `userName`, - `name.givenName`, and `emails`. - :param sort_order: :class:`ListSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: Iterator over :class:`User` - - - .. py:method:: patch(id [, operations, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - user = w.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - w.users.patch(id=user.id, - operations=[iam.Patch(op=iam.PatchOp.REPLACE, path="active", value="false")], - schemas=[iam.PatchSchema.URN_IETF_PARAMS_SCIM_API_MESSAGES_2_0_PATCH_OP]) - - Update user details. - - Partially updates a user resource by applying the supplied operations on specific user attributes. - - :param id: str - Unique ID for a user in the Databricks account. - :param operations: List[:class:`Patch`] (optional) - :param schemas: List[:class:`PatchSchema`] (optional) - The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - - - - - .. py:method:: update(id [, active, display_name, emails, entitlements, external_id, groups, name, roles, schemas, user_name]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - user = w.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - w.users.update(id=user.id, user_name=user.user_name, active=True) - - Replace a user. - - Replaces a user's information with the data supplied in request. - - :param id: str - Databricks user ID. This is automatically set by Databricks. Any value provided by the client will - be ignored. - :param active: bool (optional) - If this user is active - :param display_name: str (optional) - String that represents a concatenation of given and family names. For example `John Smith`. This - field cannot be updated through the Workspace SCIM APIs when [identity federation is enabled]. Use - Account SCIM APIs to update `displayName`. - - [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation - :param emails: List[:class:`ComplexValue`] (optional) - All the emails associated with the Databricks user. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the user. See [assigning entitlements] for a full list of supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - External ID is not currently supported. It is reserved for future use. - :param groups: List[:class:`ComplexValue`] (optional) - :param name: :class:`Name` (optional) - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`UserSchema`] (optional) - The schema of the user. - :param user_name: str (optional) - Email address of the Databricks user. - - - \ No newline at end of file diff --git a/docs/account/vpc_endpoints.rst b/docs/account/vpc_endpoints.rst deleted file mode 100644 index 495fbce2e..000000000 --- a/docs/account/vpc_endpoints.rst +++ /dev/null @@ -1,130 +0,0 @@ -VPC Endpoint Configurations -=========================== -.. py:class:: VpcEndpointsAPI - - These APIs manage VPC endpoint configurations for this account. - - .. py:method:: create(vpc_endpoint_name [, aws_vpc_endpoint_id, gcp_vpc_endpoint_info, region]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - created = a.vpc_endpoints.create(aws_vpc_endpoint_id=os.environ["TEST_RELAY_VPC_ENDPOINT"], - region=os.environ["AWS_REGION"], - vpc_endpoint_name=f'sdk-{time.time_ns()}') - - # cleanup - a.vpc_endpoints.delete(vpc_endpoint_id=created.vpc_endpoint_id) - - Create VPC endpoint configuration. - - Creates a VPC endpoint configuration, which represents a [VPC endpoint] object in AWS used to - communicate privately with Databricks over [AWS PrivateLink]. - - After you create the VPC endpoint configuration, the Databricks [endpoint service] automatically - accepts the VPC endpoint. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - [VPC endpoint]: https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints.html - [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/privatelink-share-your-services.html - - :param vpc_endpoint_name: str - The human-readable name of the storage configuration. - :param aws_vpc_endpoint_id: str (optional) - The ID of the VPC endpoint object in AWS. - :param gcp_vpc_endpoint_info: :class:`GcpVpcEndpointInfo` (optional) - The Google Cloud specific information for this Private Service Connect endpoint. - :param region: str (optional) - The AWS region in which this VPC endpoint object exists. - - :returns: :class:`VpcEndpoint` - - - .. py:method:: delete(vpc_endpoint_id) - - Delete VPC endpoint configuration. - - Deletes a VPC endpoint configuration, which represents an [AWS VPC endpoint] that can communicate - privately with Databricks over [AWS PrivateLink]. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [AWS VPC endpoint]: https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - - :param vpc_endpoint_id: str - Databricks VPC endpoint ID. - - - - - .. py:method:: get(vpc_endpoint_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - created = a.vpc_endpoints.create(aws_vpc_endpoint_id=os.environ["TEST_RELAY_VPC_ENDPOINT"], - region=os.environ["AWS_REGION"], - vpc_endpoint_name=f'sdk-{time.time_ns()}') - - by_id = a.vpc_endpoints.get(vpc_endpoint_id=created.vpc_endpoint_id) - - # cleanup - a.vpc_endpoints.delete(vpc_endpoint_id=created.vpc_endpoint_id) - - Get a VPC endpoint configuration. - - Gets a VPC endpoint configuration, which represents a [VPC endpoint] object in AWS used to communicate - privately with Databricks over [AWS PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink - [VPC endpoint]: https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html - - :param vpc_endpoint_id: str - Databricks VPC endpoint ID. - - :returns: :class:`VpcEndpoint` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - all = a.vpc_endpoints.list() - - Get all VPC endpoint configurations. - - Gets a list of all VPC endpoints for an account, specified by ID. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - - :returns: Iterator over :class:`VpcEndpoint` - \ No newline at end of file diff --git a/docs/account/workspace_assignment.rst b/docs/account/workspace_assignment.rst deleted file mode 100644 index 0489170af..000000000 --- a/docs/account/workspace_assignment.rst +++ /dev/null @@ -1,98 +0,0 @@ -Workspace Assignment -==================== -.. py:class:: WorkspaceAssignmentAPI - - The Workspace Permission Assignment API allows you to manage workspace permissions for principals in your - account. - - .. py:method:: delete(workspace_id, principal_id) - - Delete permissions assignment. - - Deletes the workspace permissions assignment in a given account and workspace for the specified - principal. - - :param workspace_id: int - The workspace ID. - :param principal_id: int - The ID of the user, service principal, or group. - - - - - .. py:method:: get(workspace_id) - - List workspace permissions. - - Get an array of workspace permissions for the specified account and workspace. - - :param workspace_id: int - The workspace ID. - - :returns: :class:`WorkspacePermissions` - - - .. py:method:: list(workspace_id) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import AccountClient - - a = AccountClient() - - workspace_id = os.environ["TEST_WORKSPACE_ID"] - - all = a.workspace_assignment.list(list=workspace_id) - - Get permission assignments. - - Get the permission assignments for the specified Databricks account and Databricks workspace. - - :param workspace_id: int - The workspace ID for the account. - - :returns: Iterator over :class:`PermissionAssignment` - - - .. py:method:: update(workspace_id, principal_id, permissions) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import iam - - a = AccountClient() - - spn = a.service_principals.create(display_name=f'sdk-{time.time_ns()}') - - spn_id = spn.id - - workspace_id = os.environ["DUMMY_WORKSPACE_ID"] - - a.workspace_assignment.update(workspace_id=workspace_id, - principal_id=spn_id, - permissions=[iam.WorkspacePermission.USER]) - - Create or update permissions assignment. - - Creates or updates the workspace permissions assignment in a given account and workspace for the - specified principal. - - :param workspace_id: int - The workspace ID. - :param principal_id: int - The ID of the user, service principal, or group. - :param permissions: List[:class:`WorkspacePermission`] - Array of permissions assignments to update on the workspace. - - - \ No newline at end of file diff --git a/docs/account/workspaces.rst b/docs/account/workspaces.rst deleted file mode 100644 index e2077aacd..000000000 --- a/docs/account/workspaces.rst +++ /dev/null @@ -1,412 +0,0 @@ -Workspaces -========== -.. py:class:: WorkspacesAPI - - These APIs manage workspaces for this account. A Databricks workspace is an environment for accessing all - of your Databricks assets. The workspace organizes objects (notebooks, libraries, and experiments) into - folders, and provides access to data and computational resources such as clusters and jobs. - - These endpoints are available if your account is on the E2 version of the platform or on a select custom - plan that allows multiple workspaces per account. - - .. py:method:: create(workspace_name [, aws_region, cloud, cloud_resource_container, credentials_id, custom_tags, deployment_name, gcp_managed_network_config, gke_config, location, managed_services_customer_managed_key_id, network_id, pricing_tier, private_access_settings_id, storage_configuration_id, storage_customer_managed_key_id]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - storage = a.storage.create( - storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=os.environ["TEST_ROOT_BUCKET"])) - - role = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_CROSSACCOUNT_ARN"]))) - - created = a.workspaces.create(workspace_name=f'sdk-{time.time_ns()}', - aws_region=os.environ["AWS_REGION"], - credentials_id=role.credentials_id, - storage_configuration_id=storage.storage_configuration_id).result() - - # cleanup - a.storage.delete(storage_configuration_id=storage.storage_configuration_id) - a.credentials.delete(credentials_id=role.credentials_id) - a.workspaces.delete(workspace_id=created.workspace_id) - - Create a new workspace. - - Creates a new workspace. - - **Important**: This operation is asynchronous. A response with HTTP status code 200 means the request - has been accepted and is in progress, but does not mean that the workspace deployed successfully and - is running. The initial workspace status is typically `PROVISIONING`. Use the workspace ID - (`workspace_id`) field in the response to identify the new workspace and make repeated `GET` requests - with the workspace ID and check its status. The workspace becomes available when the status changes to - `RUNNING`. - - :param workspace_name: str - The workspace's human-readable name. - :param aws_region: str (optional) - The AWS region of the workspace's data plane. - :param cloud: str (optional) - The cloud provider which the workspace uses. For Google Cloud workspaces, always set this field to - `gcp`. - :param cloud_resource_container: :class:`CloudResourceContainer` (optional) - The general workspace configurations that are specific to cloud providers. - :param credentials_id: str (optional) - ID of the workspace's credential configuration object. - :param custom_tags: Dict[str,str] (optional) - The custom tags key-value pairing that is attached to this workspace. The key-value pair is a string - of utf-8 characters. The value can be an empty string, with maximum length of 255 characters. The - key can be of maximum length of 127 characters, and cannot be empty. - :param deployment_name: str (optional) - The deployment name defines part of the subdomain for the workspace. The workspace URL for web - application and REST APIs is `.cloud.databricks.com`. For example, if the - deployment name is `abcsales`, your workspace URL will be `https://abcsales.cloud.databricks.com`. - Hyphens are allowed. This property supports only the set of characters that are allowed in a - subdomain. - - If your account has a non-empty deployment name prefix at workspace creation time, the workspace - deployment name changes so that the beginning has the account prefix and a hyphen. For example, if - your account's deployment prefix is `acme` and the workspace deployment name is `workspace-1`, the - `deployment_name` field becomes `acme-workspace-1` and that is the value that is returned in JSON - responses for the `deployment_name` field. The workspace URL is - `acme-workspace-1.cloud.databricks.com`. - - If your account has a non-empty deployment name prefix and you set `deployment_name` to the reserved - keyword `EMPTY`, `deployment_name` is just the account prefix only. For example, if your account's - deployment prefix is `acme` and the workspace deployment name is `EMPTY`, `deployment_name` becomes - `acme` only and the workspace URL is `acme.cloud.databricks.com`. - - Contact your Databricks representatives to add an account deployment name prefix to your account. If - you do not have a deployment name prefix, the special deployment name value `EMPTY` is invalid. - - This value must be unique across all non-deleted deployments across all AWS regions. - - If a new workspace omits this property, the server generates a unique deployment name for you with - the pattern `dbc-xxxxxxxx-xxxx`. - :param gcp_managed_network_config: :class:`GcpManagedNetworkConfig` (optional) - The network settings for the workspace. The configurations are only for Databricks-managed VPCs. It - is ignored if you specify a customer-managed VPC in the `network_id` field.", All the IP range - configurations must be mutually exclusive. An attempt to create a workspace fails if Databricks - detects an IP range overlap. - - Specify custom IP ranges in CIDR format. The IP ranges for these fields must not overlap, and all IP - addresses must be entirely within the following ranges: `10.0.0.0/8`, `100.64.0.0/10`, - `172.16.0.0/12`, `192.168.0.0/16`, and `240.0.0.0/4`. - - The sizes of these IP ranges affect the maximum number of nodes for the workspace. - - **Important**: Confirm the IP ranges used by your Databricks workspace before creating the - workspace. You cannot change them after your workspace is deployed. If the IP address ranges for - your Databricks are too small, IP exhaustion can occur, causing your Databricks jobs to fail. To - determine the address range sizes that you need, Databricks provides a calculator as a Microsoft - Excel spreadsheet. See [calculate subnet sizes for a new workspace]. - - [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html - :param gke_config: :class:`GkeConfig` (optional) - The configurations for the GKE cluster of a Databricks workspace. - :param location: str (optional) - The Google Cloud region of the workspace data plane in your Google account. For example, `us-east4`. - :param managed_services_customer_managed_key_id: str (optional) - The ID of the workspace's managed services encryption key configuration object. This is used to help - protect and control access to the workspace's notebooks, secrets, Databricks SQL queries, and query - history. The provided key configuration object property `use_cases` must contain `MANAGED_SERVICES`. - :param network_id: str (optional) - :param pricing_tier: :class:`PricingTier` (optional) - The pricing tier of the workspace. For pricing tier information, see [AWS Pricing]. - - [AWS Pricing]: https://databricks.com/product/aws-pricing - :param private_access_settings_id: str (optional) - ID of the workspace's private access settings object. Only used for PrivateLink. This ID must be - specified for customers using [AWS PrivateLink] for either front-end (user-to-workspace connection), - back-end (data plane to control plane connection), or both connection types. - - Before configuring PrivateLink, read the [Databricks article about PrivateLink]. - - [AWS PrivateLink]: https://aws.amazon.com/privatelink/ - [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - :param storage_configuration_id: str (optional) - The ID of the workspace's storage configuration object. - :param storage_customer_managed_key_id: str (optional) - The ID of the workspace's storage encryption key configuration object. This is used to encrypt the - workspace's root S3 bucket (root DBFS and system data) and, optionally, cluster EBS volumes. The - provided key configuration object property `use_cases` must contain `STORAGE`. - - :returns: - Long-running operation waiter for :class:`Workspace`. - See :method:wait_get_workspace_running for more details. - - - .. py:method:: delete(workspace_id) - - Delete a workspace. - - Terminates and deletes a Databricks workspace. From an API perspective, deletion is immediate. - However, it might take a few minutes for all workspaces resources to be deleted, depending on the size - and number of workspace resources. - - This operation is available only if your account is on the E2 version of the platform or on a select - custom plan that allows multiple workspaces per account. - - :param workspace_id: int - Workspace ID. - - - - - .. py:method:: get(workspace_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - storage = a.storage.create( - storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=os.environ["TEST_ROOT_BUCKET"])) - - role = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_CROSSACCOUNT_ARN"]))) - - created = a.workspaces.create(workspace_name=f'sdk-{time.time_ns()}', - aws_region=os.environ["AWS_REGION"], - credentials_id=role.credentials_id, - storage_configuration_id=storage.storage_configuration_id).result() - - by_id = a.workspaces.get(workspace_id=created.workspace_id) - - # cleanup - a.storage.delete(storage_configuration_id=storage.storage_configuration_id) - a.credentials.delete(credentials_id=role.credentials_id) - a.workspaces.delete(workspace_id=created.workspace_id) - - Get a workspace. - - Gets information including status for a Databricks workspace, specified by ID. In the response, the - `workspace_status` field indicates the current status. After initial workspace creation (which is - asynchronous), make repeated `GET` requests with the workspace ID and check its status. The workspace - becomes available when the status changes to `RUNNING`. - - For information about how to create a new workspace with this API **including error handling**, see - [Create a new workspace using the Account API]. - - This operation is available only if your account is on the E2 version of the platform or on a select - custom plan that allows multiple workspaces per account. - - [Create a new workspace using the Account API]: http://docs.databricks.com/administration-guide/account-api/new-workspace.html - - :param workspace_id: int - Workspace ID. - - :returns: :class:`Workspace` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import AccountClient - - a = AccountClient() - - all = a.workspaces.list() - - Get all workspaces. - - Gets a list of all workspaces associated with an account, specified by ID. - - This operation is available only if your account is on the E2 version of the platform or on a select - custom plan that allows multiple workspaces per account. - - :returns: Iterator over :class:`Workspace` - - - .. py:method:: update(workspace_id [, aws_region, credentials_id, custom_tags, managed_services_customer_managed_key_id, network_connectivity_config_id, network_id, storage_configuration_id, storage_customer_managed_key_id]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import provisioning - - a = AccountClient() - - storage = a.storage.create( - storage_configuration_name=f'sdk-{time.time_ns()}', - root_bucket_info=provisioning.RootBucketInfo(bucket_name=os.environ["TEST_ROOT_BUCKET"])) - - role = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_CROSSACCOUNT_ARN"]))) - - update_role = a.credentials.create( - credentials_name=f'sdk-{time.time_ns()}', - aws_credentials=provisioning.CreateCredentialAwsCredentials(sts_role=provisioning.CreateCredentialStsRole( - role_arn=os.environ["TEST_CROSSACCOUNT_ARN"]))) - - created = a.workspaces.create(workspace_name=f'sdk-{time.time_ns()}', - aws_region=os.environ["AWS_REGION"], - credentials_id=role.credentials_id, - storage_configuration_id=storage.storage_configuration_id).result() - - _ = a.workspaces.update(workspace_id=created.workspace_id, credentials_id=update_role.credentials_id).result() - - # cleanup - a.storage.delete(storage_configuration_id=storage.storage_configuration_id) - a.credentials.delete(credentials_id=role.credentials_id) - a.credentials.delete(credentials_id=update_role.credentials_id) - a.workspaces.delete(workspace_id=created.workspace_id) - - Update workspace configuration. - - Updates a workspace configuration for either a running workspace or a failed workspace. The elements - that can be updated varies between these two use cases. - - ### Update a failed workspace You can update a Databricks workspace configuration for failed workspace - deployment for some fields, but not all fields. For a failed workspace, this request supports updates - to the following fields only: - Credential configuration ID - Storage configuration ID - Network - configuration ID. Used only to add or change a network configuration for a customer-managed VPC. For a - failed workspace only, you can convert a workspace with Databricks-managed VPC to use a - customer-managed VPC by adding this ID. You cannot downgrade a workspace with a customer-managed VPC - to be a Databricks-managed VPC. You can update the network configuration for a failed or running - workspace to add PrivateLink support, though you must also add a private access settings object. - Key - configuration ID for managed services (control plane storage, such as notebook source and Databricks - SQL queries). Used only if you use customer-managed keys for managed services. - Key configuration ID - for workspace storage (root S3 bucket and, optionally, EBS volumes). Used only if you use - customer-managed keys for workspace storage. **Important**: If the workspace was ever in the running - state, even if briefly before becoming a failed workspace, you cannot add a new key configuration ID - for workspace storage. - Private access settings ID to add PrivateLink support. You can add or update - the private access settings ID to upgrade a workspace to add support for front-end, back-end, or both - types of connectivity. You cannot remove (downgrade) any existing front-end or back-end PrivateLink - support on a workspace. - Custom tags. Given you provide an empty custom tags, the update would not be - applied. - - After calling the `PATCH` operation to update the workspace configuration, make repeated `GET` - requests with the workspace ID and check the workspace status. The workspace is successful if the - status changes to `RUNNING`. - - For information about how to create a new workspace with this API **including error handling**, see - [Create a new workspace using the Account API]. - - ### Update a running workspace You can update a Databricks workspace configuration for running - workspaces for some fields, but not all fields. For a running workspace, this request supports - updating the following fields only: - Credential configuration ID - - - Network configuration ID. Used only if you already use a customer-managed VPC. You cannot convert a - running workspace from a Databricks-managed VPC to a customer-managed VPC. You can use a network - configuration update in this API for a failed or running workspace to add support for PrivateLink, - although you also need to add a private access settings object. - - - Key configuration ID for managed services (control plane storage, such as notebook source and - Databricks SQL queries). Databricks does not directly encrypt the data with the customer-managed key - (CMK). Databricks uses both the CMK and the Databricks managed key (DMK) that is unique to your - workspace to encrypt the Data Encryption Key (DEK). Databricks uses the DEK to encrypt your - workspace's managed services persisted data. If the workspace does not already have a CMK for managed - services, adding this ID enables managed services encryption for new or updated data. Existing managed - services data that existed before adding the key remains not encrypted with the DEK until it is - modified. If the workspace already has customer-managed keys for managed services, this request - rotates (changes) the CMK keys and the DEK is re-encrypted with the DMK and the new CMK. - Key - configuration ID for workspace storage (root S3 bucket and, optionally, EBS volumes). You can set this - only if the workspace does not already have a customer-managed key configuration for workspace - storage. - Private access settings ID to add PrivateLink support. You can add or update the private - access settings ID to upgrade a workspace to add support for front-end, back-end, or both types of - connectivity. You cannot remove (downgrade) any existing front-end or back-end PrivateLink support on - a workspace. - Custom tags. Given you provide an empty custom tags, the update would not be applied. - - **Important**: To update a running workspace, your workspace must have no running compute resources - that run in your workspace's VPC in the Classic data plane. For example, stop all all-purpose - clusters, job clusters, pools with running clusters, and Classic SQL warehouses. If you do not - terminate all cluster instances in the workspace before calling this API, the request will fail. - - ### Wait until changes take effect. After calling the `PATCH` operation to update the workspace - configuration, make repeated `GET` requests with the workspace ID and check the workspace status and - the status of the fields. * For workspaces with a Databricks-managed VPC, the workspace status becomes - `PROVISIONING` temporarily (typically under 20 minutes). If the workspace update is successful, the - workspace status changes to `RUNNING`. Note that you can also check the workspace status in the - [Account Console]. However, you cannot use or create clusters for another 20 minutes after that status - change. This results in a total of up to 40 minutes in which you cannot create clusters. If you create - or use clusters before this time interval elapses, clusters do not launch successfully, fail, or could - cause other unexpected behavior. - - * For workspaces with a customer-managed VPC, the workspace status stays at status `RUNNING` and the - VPC change happens immediately. A change to the storage customer-managed key configuration ID might - take a few minutes to update, so continue to check the workspace until you observe that it has been - updated. If the update fails, the workspace might revert silently to its original configuration. After - the workspace has been updated, you cannot use or create clusters for another 20 minutes. If you - create or use clusters before this time interval elapses, clusters do not launch successfully, fail, - or could cause other unexpected behavior. - - If you update the _storage_ customer-managed key configurations, it takes 20 minutes for the changes - to fully take effect. During the 20 minute wait, it is important that you stop all REST API calls to - the DBFS API. If you are modifying _only the managed services key configuration_, you can omit the 20 - minute wait. - - **Important**: Customer-managed keys and customer-managed VPCs are supported by only some deployment - types and subscription types. If you have questions about availability, contact your Databricks - representative. - - This operation is available only if your account is on the E2 version of the platform or on a select - custom plan that allows multiple workspaces per account. - - [Account Console]: https://docs.databricks.com/administration-guide/account-settings-e2/account-console-e2.html - [Create a new workspace using the Account API]: http://docs.databricks.com/administration-guide/account-api/new-workspace.html - - :param workspace_id: int - Workspace ID. - :param aws_region: str (optional) - The AWS region of the workspace's data plane (for example, `us-west-2`). This parameter is available - only for updating failed workspaces. - :param credentials_id: str (optional) - ID of the workspace's credential configuration object. This parameter is available for updating both - failed and running workspaces. - :param custom_tags: Dict[str,str] (optional) - The custom tags key-value pairing that is attached to this workspace. The key-value pair is a string - of utf-8 characters. The value can be an empty string, with maximum length of 255 characters. The - key can be of maximum length of 127 characters, and cannot be empty. - :param managed_services_customer_managed_key_id: str (optional) - The ID of the workspace's managed services encryption key configuration object. This parameter is - available only for updating failed workspaces. - :param network_connectivity_config_id: str (optional) - The ID of the network connectivity configuration object, which is the parent resource of this - private endpoint rule object. - :param network_id: str (optional) - The ID of the workspace's network configuration object. Used only if you already use a - customer-managed VPC. For failed workspaces only, you can switch from a Databricks-managed VPC to a - customer-managed VPC by updating the workspace to add a network configuration ID. - :param storage_configuration_id: str (optional) - The ID of the workspace's storage configuration object. This parameter is available only for - updating failed workspaces. - :param storage_customer_managed_key_id: str (optional) - The ID of the key configuration object for workspace storage. This parameter is available for - updating both failed and running workspaces. - - :returns: - Long-running operation waiter for :class:`Workspace`. - See :method:wait_get_workspace_running for more details. - \ No newline at end of file diff --git a/docs/authentication.md b/docs/authentication.md index a4b213164..d5d0ef84f 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -14,6 +14,7 @@ w. # press for autocompletion The conventional name for the variable that holds the workspace-level client of the Databricks SDK for Python is `w`, which is shorthand for `workspace`. +(notebook-native-authentication)= ## Notebook-native authentication If you initialise `WorkspaceClient` without any arguments, credentials will be picked up automatically from the notebook context. @@ -23,6 +24,7 @@ If the same code is run outside the notebook environment, like CI/CD, you have t `databricks.sdk.AccountClient` does not support notebook-native authentication. +(default-authentication-flow)= ## Default authentication flow If you run the [Databricks Terraform Provider](https://registry.terraform.io/providers/databrickslabs/databricks/latest), @@ -31,7 +33,7 @@ or applications that target the Databricks SDKs for other languages, most likely By default, the Databricks SDK for Python tries the following [authentication](https://docs.databricks.com/dev-tools/auth.html) methods, in the following order, until it succeeds: -1. [Databricks native authentication](#databricks-native-authentication) +1. [Databricks native authentication](#notebook-native-authentication) 2. [Azure native authentication](#azure-native-authentication) 4. If the SDK is unsuccessful at this point, it returns an authentication error and stops running. @@ -73,6 +75,7 @@ from databricks.sdk import WorkspaceClient w = WorkspaceClient(host=input('Databricks Workspace URL: '), token=input('Token: ')) ``` +(azure-native-authentication)= ## Azure native authentication By default, the Databricks SDK for Python first tries Azure client secret authentication (`auth_type='azure-client-secret'` argument). If the SDK is unsuccessful, it then tries Azure CLI authentication (`auth_type='azure-cli'` argument). See [Manage service principals](https://learn.microsoft.com/azure/databricks/administration-guide/users-groups/service-principals). @@ -106,7 +109,7 @@ w = WorkspaceClient(host=input('Databricks Workspace URL: '), ## Overriding `.databrickscfg` -For [Databricks native authentication](#databricks-native-authentication), you can override the default behavior for using `.databrickscfg` as follows: +For [Databricks native authentication](#notebook-native-authentication), you can override the default behavior for using `.databrickscfg` as follows: | Argument | Description | Environment variable | |---------------|-------------|----------------------| @@ -140,4 +143,4 @@ For example, to turn on debug HTTP headers: from databricks.sdk import WorkspaceClient w = WorkspaceClient(debug_headers=True) # Now call the Databricks workspace APIs as desired... -``` \ No newline at end of file +``` diff --git a/docs/autogen/billing.rst b/docs/autogen/billing.rst new file mode 100644 index 000000000..dbc17aa98 --- /dev/null +++ b/docs/autogen/billing.rst @@ -0,0 +1,9 @@ + +``billing``: Billing +==================== + +Configure different aspects of Databricks billing and usage. + +.. automodule:: databricks.sdk.service.billing + :members: + :undoc-members: diff --git a/docs/autogen/catalog.rst b/docs/autogen/catalog.rst new file mode 100644 index 000000000..f61dc413f --- /dev/null +++ b/docs/autogen/catalog.rst @@ -0,0 +1,9 @@ + +``catalog``: Unity Catalog +========================== + +Configure data governance with Unity Catalog for metastores, catalogs, schemas, tables, external locations, and storage credentials + +.. automodule:: databricks.sdk.service.catalog + :members: + :undoc-members: diff --git a/docs/autogen/compute.rst b/docs/autogen/compute.rst new file mode 100644 index 000000000..26ff959a5 --- /dev/null +++ b/docs/autogen/compute.rst @@ -0,0 +1,14 @@ + +``compute``: Compute +==================== + +Use and configure compute for Databricks + +.. automodule:: databricks.sdk.service.compute + :members: + :undoc-members: + +.. automodule:: databricks.sdk.mixins.compute + :members: + :inherited-members: + :undoc-members: diff --git a/docs/autogen/files.rst b/docs/autogen/files.rst new file mode 100644 index 000000000..e0aa0dbb6 --- /dev/null +++ b/docs/autogen/files.rst @@ -0,0 +1,14 @@ + +``files``: File Management +========================== + +Manage files on Databricks in a filesystem-like interface + +.. automodule:: databricks.sdk.service.files + :members: + :undoc-members: + +.. automodule:: databricks.sdk.mixins.files + :members: + :inherited-members: + :undoc-members: diff --git a/docs/autogen/iam.rst b/docs/autogen/iam.rst new file mode 100644 index 000000000..da047eccf --- /dev/null +++ b/docs/autogen/iam.rst @@ -0,0 +1,9 @@ + +``iam``: Identity and Access Management +======================================= + +Manage users, service principals, groups and their permissions in Accounts and Workspaces + +.. automodule:: databricks.sdk.service.iam + :members: + :undoc-members: diff --git a/docs/autogen/jobs.rst b/docs/autogen/jobs.rst new file mode 100644 index 000000000..cb406749c --- /dev/null +++ b/docs/autogen/jobs.rst @@ -0,0 +1,9 @@ + +``jobs``: Jobs +============== + +Schedule automated jobs on Databricks Workspaces + +.. automodule:: databricks.sdk.service.jobs + :members: + :undoc-members: diff --git a/docs/autogen/ml.rst b/docs/autogen/ml.rst new file mode 100644 index 000000000..6e51ec501 --- /dev/null +++ b/docs/autogen/ml.rst @@ -0,0 +1,9 @@ + +``ml``: Machine Learning +======================== + +Create and manage experiments, features, and other machine learning artifacts + +.. automodule:: databricks.sdk.service.ml + :members: + :undoc-members: diff --git a/docs/autogen/oauth2.rst b/docs/autogen/oauth2.rst new file mode 100644 index 000000000..d210688ec --- /dev/null +++ b/docs/autogen/oauth2.rst @@ -0,0 +1,9 @@ + +``oauth2``: OAuth +================= + +Configure OAuth 2.0 application registrations for Databricks + +.. automodule:: databricks.sdk.service.oauth2 + :members: + :undoc-members: diff --git a/docs/autogen/pipelines.rst b/docs/autogen/pipelines.rst new file mode 100644 index 000000000..091042bd5 --- /dev/null +++ b/docs/autogen/pipelines.rst @@ -0,0 +1,9 @@ + +``pipelines``: Delta Live Tables +================================ + +Manage pipelines, runs, and other Delta Live Table resources + +.. automodule:: databricks.sdk.service.pipelines + :members: + :undoc-members: diff --git a/docs/autogen/provisioning.rst b/docs/autogen/provisioning.rst new file mode 100644 index 000000000..c17a200fa --- /dev/null +++ b/docs/autogen/provisioning.rst @@ -0,0 +1,9 @@ + +``provisioning``: Provisioning +============================== + +Resource management for secure Databricks Workspace deployment, cross-account IAM roles, storage, encryption, networking and private access. + +.. automodule:: databricks.sdk.service.provisioning + :members: + :undoc-members: diff --git a/docs/autogen/reference.rst b/docs/autogen/reference.rst new file mode 100644 index 000000000..5d5b020f1 --- /dev/null +++ b/docs/autogen/reference.rst @@ -0,0 +1,22 @@ + +Reference +========= + +.. toctree:: + :maxdepth: 1 + + billing + catalog + compute + files + iam + jobs + ml + oauth2 + pipelines + provisioning + serving + settings + sharing + sql + workspace diff --git a/docs/autogen/serving.rst b/docs/autogen/serving.rst new file mode 100644 index 000000000..73f3e5aef --- /dev/null +++ b/docs/autogen/serving.rst @@ -0,0 +1,9 @@ + +``serving``: Real-time Serving +============================== + +Use real-time inference for machine learning + +.. automodule:: databricks.sdk.service.serving + :members: + :undoc-members: diff --git a/docs/autogen/settings.rst b/docs/autogen/settings.rst new file mode 100644 index 000000000..f0d41a1e6 --- /dev/null +++ b/docs/autogen/settings.rst @@ -0,0 +1,9 @@ + +``settings``: Settings +====================== + +Manage security settings for Accounts and Workspaces + +.. automodule:: databricks.sdk.service.settings + :members: + :undoc-members: diff --git a/docs/autogen/sharing.rst b/docs/autogen/sharing.rst new file mode 100644 index 000000000..cef34fcd8 --- /dev/null +++ b/docs/autogen/sharing.rst @@ -0,0 +1,9 @@ + +``sharing``: Delta Sharing +========================== + +Configure data sharing with Unity Catalog for providers, recipients, and shares + +.. automodule:: databricks.sdk.service.sharing + :members: + :undoc-members: diff --git a/docs/autogen/sql.rst b/docs/autogen/sql.rst new file mode 100644 index 000000000..1f816cb6f --- /dev/null +++ b/docs/autogen/sql.rst @@ -0,0 +1,9 @@ + +``sql``: Databricks SQL +======================= + +Manage Databricks SQL assets, including warehouses, dashboards, queries and query history, and alerts + +.. automodule:: databricks.sdk.service.sql + :members: + :undoc-members: diff --git a/docs/autogen/workspace.rst b/docs/autogen/workspace.rst new file mode 100644 index 000000000..36fcad4b4 --- /dev/null +++ b/docs/autogen/workspace.rst @@ -0,0 +1,14 @@ + +``workspace``: Databricks Workspace +=================================== + +Manage workspace-level entities that include notebooks, Git checkouts, and secrets + +.. automodule:: databricks.sdk.service.workspace + :members: + :undoc-members: + +.. automodule:: databricks.sdk.mixins.workspace + :members: + :inherited-members: + :undoc-members: diff --git a/docs/clients.rst b/docs/clients.rst new file mode 100644 index 000000000..359c3ee3b --- /dev/null +++ b/docs/clients.rst @@ -0,0 +1,11 @@ + +SDK Clients +=========== + +.. autoclass:: databricks.sdk.WorkspaceClient + :members: + :undoc-members: + +.. autoclass:: databricks.sdk.AccountClient + :members: + :undoc-members: diff --git a/docs/conf.py b/docs/conf.py index 65adc1dd3..5bab1f4ba 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,7 +9,7 @@ project = 'Databricks SDK for Python' copyright = '2023, Databricks' author = 'Serge Smertin' -release = 'alpha' +release = 'beta' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -18,7 +18,7 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'myst_parser', # pip install myst-parser + 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'myst_parser', 'enum_tools.autoenum' ] templates_path = ['_templates'] @@ -40,3 +40,7 @@ 'show_related': 'true', 'sidebar_collapse': 'true', } + +autodoc_default_options = { + 'member-order': 'bysource', +} diff --git a/docs/dbutils.md b/docs/dbutils.md index 31c8c66c4..99685c23e 100644 --- a/docs/dbutils.md +++ b/docs/dbutils.md @@ -13,11 +13,11 @@ files_in_root = dbutils.fs.ls('/') print(f'number of files in root: {len(files_in_root)}') ``` -Alternatively, you can import `dbutils` from `databricks.sdk.runtime` module, but you have to make sure that all configuration is already [present in the environment variables](#default-authentication-flow): +Alternatively, you can import `dbutils` from `databricks.sdk.runtime` module, but you have to make sure that all configuration is already [present in the environment variables](authentication.md#default-authentication-flow): ```python from databricks.sdk.runtime import dbutils for secret_scope in dbutils.secrets.listScopes(): for secret_metadata in dbutils.secrets.list(secret_scope.name): print(f'found {secret_metadata.key} secret in {secret_scope.name} scope') -``` \ No newline at end of file +``` diff --git a/docs/gen-client-docs.py b/docs/gen-client-docs.py index 96dd1017e..948da61b7 100644 --- a/docs/gen-client-docs.py +++ b/docs/gen-client-docs.py @@ -1,16 +1,8 @@ #!env python3 -import collections -import inspect -import json import os.path from dataclasses import dataclass -from pathlib import Path - -from databricks.sdk import AccountClient, WorkspaceClient -from databricks.sdk.core import credentials_provider __dir__ = os.path.dirname(__file__) -__examples__ = Path(f'{__dir__}/../examples').absolute() @dataclass @@ -20,84 +12,6 @@ class Package: description: str -@dataclass -class Tag: - name: str - service: str - is_account: bool - package: Package - - -@dataclass -class MethodDoc: - method_name: str - doc: str - required_args: list[str] - kwonly_args: list[str] - - def argspec(self): - args = ', '.join(self.required_args) - if len(self.kwonly_args) > 0: - other = ', '.join(self.kwonly_args) - args = f'{args} [, {other}]' - return args - - def as_rst(self, usage) -> str: - if self.doc is None: return '' - out = ['', f' .. py:method:: {self.method_name}({self.argspec()})', usage, f' {self.doc}'] - return "\n".join(out) - - -@dataclass -class ServiceDoc: - service_name: str - class_name: str - methods: list[MethodDoc] - doc: str - tag: Tag - - def as_rst(self) -> str: - if not self.doc: - self.doc = '' - out = [ - self.tag.name, '=' * len(self.tag.name), f'.. py:class:: {self.class_name}', '', f' {self.doc}' - ] - for m in self.methods: - usage = self.usage_example(m) - rst = m.as_rst(usage) - if not rst: - continue - out.append(rst) - - return "\n".join(out) - - def usage_example(self, m): - out = [] - example_root, example_files = self.examples() - for potential_example in example_files: - if not potential_example.startswith(m.method_name): - continue - out.append("") - out.append(" Usage:") - out.append("") - out.append(" .. code-block::") - out.append("") - with (example_root / potential_example).open('r') as f: - for line in f.readlines(): - line = line.rstrip("\n") - out.append(f' {line}') - out.append("") - return "\n".join(out) - return "" - - def examples(self): - try: - root = __examples__ / self.service_name - return root, os.listdir(root) - except: - return None, [] - - class Generator: packages = [ Package("workspace", "Databricks Workspace", @@ -131,129 +45,47 @@ class Generator: Package("oauth2", "OAuth", "Configure OAuth 2.0 application registrations for Databricks") ] - def __init__(self): - self.mapping = self._load_mapping() - - def _spec_file(self) -> str: - if 'DATABRICKS_OPENAPI_SPEC' in os.environ: - return os.environ['DATABRICKS_OPENAPI_SPEC'] - with open(os.path.expanduser('~/.openapi-codegen.json'), 'r') as f: - config = json.load(f) - if 'spec' not in config: - raise ValueError('Cannot find OpenAPI spec') - return config['spec'] - - def _load_mapping(self) -> dict[str, Tag]: - mapping = {} - pkgs = {p.name: p for p in self.packages} - with open(self._spec_file(), 'r') as fspec: - spec = json.load(fspec) - for tag in spec['tags']: - t = Tag(name=tag['name'], - service=tag['x-databricks-service'], - is_account=tag.get('x-databricks-is-accounts', False), - package=pkgs[tag['x-databricks-package']]) - mapping[tag['name']] = t - return mapping - - def class_methods(self, inst) -> list[MethodDoc]: - method_docs = [] - for name in dir(inst): - if name[0] == '_': - # private members - continue - instance_attr = getattr(inst, name) - if not callable(instance_attr): - continue - args = inspect.getfullargspec(instance_attr) - method_docs.append( - MethodDoc(method_name=name, - required_args=args.args[1:], - kwonly_args=args.kwonlyargs, - doc=instance_attr.__doc__)) - return method_docs - - def service_docs(self, client_inst) -> list[ServiceDoc]: - ignore_client_fields = ('config', 'dbutils', 'api_client', 'files') - all = [] - for service_name, service_inst in client_inst.__dict__.items(): - if service_name in ignore_client_fields: - continue - class_doc = service_inst.__doc__ - class_name = service_inst.__class__.__name__ - all.append( - ServiceDoc(service_name=service_name, - class_name=class_name, - doc=class_doc, - tag=self._get_tag_name(service_inst.__class__.__name__, service_name), - methods=self.class_methods(service_inst))) - return all - - def _get_tag_name(self, class_name, service_name) -> Tag: - if class_name[-3:] == 'Ext': - # ClustersExt, DbfsExt, WorkspaceExt, but not ExternalLocations - class_name = class_name.replace('Ext', 'API') - class_name = class_name[:-3] - for tag_name, t in self.mapping.items(): - if t.service == class_name: - return t - raise KeyError(f'Cannot find {class_name} / {service_name} tag') - - def load_client(self, client, folder, label, description): - client_services = [] - package_to_services = collections.defaultdict(list) - for svc in self.service_docs(client): - client_services.append(svc.service_name) - package_to_services[svc.tag.package.name].append(svc.service_name) - with open(f'{__dir__}/{folder}/{svc.service_name}.rst', 'w') as f: - f.write(svc.as_rst()) - ordered_packages = [] + def write_reference(self): for pkg in self.packages: - if pkg.name not in package_to_services: - continue - ordered_packages.append(pkg.name) - self._write_client_package_doc(folder, pkg, package_to_services[pkg.name]) - self._write_client_packages(folder, label, description, ordered_packages) + self._write_client_package_doc(pkg) + self._write_reference_toc() - def _write_client_packages(self, folder: str, label: str, description: str, packages: list[str]): - with open(f'{__dir__}/{folder}/index.rst', 'w') as f: - all = "\n ".join([f'{folder}-{name}' for name in packages]) + def _write_client_package_doc(self, pkg: Package): + title = f'``{pkg.name}``: {pkg.label}' + has_mixin = os.path.exists(f'{__dir__}/../databricks/sdk/mixins/{pkg.name}.py') + with open(f'{__dir__}/autogen/{pkg.name}.rst', 'w') as f: f.write(f''' -{label} -{'=' * len(label)} - -{description} - -.. toctree:: - :maxdepth: 1 - - {all}''') - - def _write_client_package_doc(self, folder: str, pkg: Package, services: list[str]): - with open(f'{__dir__}/{folder}/{folder}-{pkg.name}.rst', 'w') as f: - all = "\n ".join(services) - f.write(f''' -{pkg.label} -{'=' * len(pkg.label)} +{title} +{'=' * len(title)} {pkg.description} + +.. automodule:: databricks.sdk.service.{pkg.name} + :members: + :undoc-members: +''') + if has_mixin: + f.write(f''' +.. automodule:: databricks.sdk.mixins.{pkg.name} + :members: + :inherited-members: + :undoc-members: +''') + + def _write_reference_toc(self): + all = '\n'.join([f' {p.name}' for p in sorted(self.packages, key=lambda p: p.name)]) + with open(f'{__dir__}/autogen/reference.rst', 'w') as f: + f.write(f''' +Reference +========= .. toctree:: - :maxdepth: 1 - - {all}''') + :maxdepth: 1 + +{all} +''') if __name__ == '__main__': - - @credentials_provider('noop', []) - def noop_credentials(_: any): - return lambda: {} - gen = Generator() - - w = WorkspaceClient(credentials_provider=noop_credentials) - gen.load_client(w, 'workspace', 'Workspace APIs', 'These APIs are available from WorkspaceClient') - - a = AccountClient(credentials_provider=noop_credentials) - gen.load_client(a, 'account', 'Account APIs', 'These APIs are available from AccountClient') + gen.write_reference() diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 000000000..f0b0c6439 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,78 @@ +# Getting Started + +## Installation + +To install the Databricks SDK for Python, simply run: + +```bash +pip install databricks-sdk +``` + +Databricks Runtime starting from version 13.1 includes a bundled version of the Python SDK. It is highly recommended to upgrade to the latest version which you can do by running the following in a notebook cell: + +``` +%pip install --upgrade databricks-sdk +``` + +followed by + +```python +dbutils.library.restartPython() +``` + +## Authentication + +There are two primary entry points to the Databricks SDK: +* `databricks.sdk.WorkspaceClient` for working with workspace-level APIs, and +* `databricks.sdk.AccountClient` for working with account-level APIs. + +To work with APIs, client instances need to authenticate that could be done different ways (according to the [Unified Authentication](https://docs.databricks.com/en/dev-tools/auth/index.html#unified-auth) approach that is used by all Databricks SDKs and related tools): +* When `WorkspaceClient` is created in the notebook, and no authentication parameters provided, then it will automatically pull authentication information from the execution context. This implicit authentication doesn't work for AccountClient. Simply use the following code fragment: +```python +from databricks.sdk import WorkspaceClient +w = WorkspaceClient() +``` +* When `WorkspaceClient` or `AccountClient` are created outside of the notebook, then they will read authentication information from environment variables and your `.databrickscfg` file. This method is recommended when writing command-line tools as it allows more flexible configuration of authentication. +* Authentication parameters may also be explicitly passed when creating `WorkspaceClient` or `AccountClient`. For example: +```python +from databricks.sdk import WorkspaceClient +w = WorkspaceClient( + host='http://my-databricks-instance.com', + username='my-user', + password='my-password') +``` + +It's also possible to provide a custom authentication implementation if necessary. For more details, see [Authentication](authentication.md). + +## Listing resources + +One of the key advantages of the Databricks SDK is that it provides a consistent interface for working with APIs returning paginated responses. The pagination details are hidden from the caller. Instead, the SDK returns a generator that yields each item in the list. For example, to list all clusters in the workspace, you can use the following code: + +```python +for cluster in w.clusters.list(): + print(f'cluster {cluster.cluster_name} has {cluster.num_workers} workers') +``` + +See [Pagination](pagination.md) for more details. + +## Using Data Classes & Enums + +The Databricks SDK for Python makes use of Python's data classes and enums to represent data for APIs - this makes code more readable and type-safe, and it allows easier work with code compared with untyped dicts. + +Specific data classes are organized into separate packages under `databricks.sdk.service`. For example, `databricks.sdk.service.jobs` has defintions for data classes & enums related to the Jobs API. + +For more information, consult the [API Reference](autogen/reference.rst). + +## Examples + +The Databricks SDK for Python comes with a number of examples demonstrating how to use the library for various common use-cases, including + +* [Using the SDK with OAuth from a webserver](https://github.com/databricks/databricks-sdk-py/blob/main/examples/flask_app_with_oauth.py) +* [Using long-running operations](https://github.com/databricks/databricks-sdk-py/blob/main/examples/starting_job_and_waiting.py) +* [Authenticating a client app using OAuth](https://github.com/databricks/databricks-sdk-py/blob/main/examples/local_browser_oauth.py) + +These examples and more are located in the [`examples/` directory of the Github repository](https://github.com/databricks/databricks-sdk-py/tree/main/examples). + +Some other examples of using the SDK include: +* [Unity Catalog Automated Migration](https://github.com/databricks/ucx) heavily relies on Python SDK for working with Databricks APIs. +* [ip-access-list-analyzer](https://github.com/alexott/databricks-playground/tree/main/ip-access-list-analyzer) checks & prunes invalid entries from IP Access Lists. diff --git a/docs/index.rst b/docs/index.rst index 0c641f97c..581077432 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,19 +3,6 @@ Databricks SDK for Python (Beta) The Databricks SDK for Python includes functionality to accelerate development with Python for the Databricks Lakehouse. It covers all public `Databricks REST API `_ operations. -The SDK's internal HTTP client is robust and handles failures on different levels by -performing intelligent retries. Install it via - -.. code-block:: - - $ pip install databricks-sdk - -To install the Databricks SDK for Python from a Databricks Notebook as a `notebook-scoped library `_, please run: - -.. code-block:: - - %pip install databricks-sdk - dbutils.library.restartPython() This SDK is supported for production use cases, but we do expect future releases to have `some interface changes `_. We are keen to hear feedback from you on these SDKs. Please `file GitHub issues `_, and we will address them. @@ -23,13 +10,14 @@ We are keen to hear feedback from you on these SDKs. Please `file GitHub issues .. toctree:: :maxdepth: 2 + getting-started authentication oauth wait pagination logging dbutils - workspace/index - account/index + clients + autogen/reference diff --git a/docs/requirements.txt b/docs/requirements.txt index 9e4694f90..c822583e4 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,4 @@ myst_parser +sphinx-autobuild +enum_tools +sphinx-toolbox diff --git a/docs/workspace/account_access_control_proxy.rst b/docs/workspace/account_access_control_proxy.rst deleted file mode 100644 index 2e4dad02a..000000000 --- a/docs/workspace/account_access_control_proxy.rst +++ /dev/null @@ -1,54 +0,0 @@ -Account Access Control Proxy -============================ -.. py:class:: AccountAccessControlProxyAPI - - These APIs manage access rules on resources in an account. Currently, only grant rules are supported. A - grant rule specifies a role assigned to a set of principals. A list of rules attached to a resource is - called a rule set. A workspace must belong to an account for these APIs to work. - - .. py:method:: get_assignable_roles_for_resource(resource) - - Get assignable roles for a resource. - - Gets all the roles that can be granted on an account-level resource. A role is grantable if the rule - set on the resource can contain an access rule of the role. - - :param resource: str - The resource name for which assignable roles will be listed. - - :returns: :class:`GetAssignableRolesForResourceResponse` - - - .. py:method:: get_rule_set(name, etag) - - Get a rule set. - - Get a rule set by its name. A rule set is always attached to a resource and contains a list of access - rules on the said resource. Currently only a default rule set for each resource is supported. - - :param name: str - The ruleset name associated with the request. - :param etag: str - Etag used for versioning. The response is at least as fresh as the eTag provided. Etag is used for - optimistic concurrency control as a way to help prevent simultaneous updates of a rule set from - overwriting each other. It is strongly suggested that systems make use of the etag in the read -> - modify -> write pattern to perform rule set updates in order to avoid race conditions that is get an - etag from a GET rule set request, and pass it with the PUT update request to identify the rule set - version you are updating. - - :returns: :class:`RuleSetResponse` - - - .. py:method:: update_rule_set(name, rule_set) - - Update a rule set. - - Replace the rules of a rule set. First, use a GET rule set request to read the current version of the - rule set before modifying it. This pattern helps prevent conflicts between concurrent updates. - - :param name: str - Name of the rule set. - :param rule_set: :class:`RuleSetUpdateRequest` - - :returns: :class:`RuleSetResponse` - \ No newline at end of file diff --git a/docs/workspace/alerts.rst b/docs/workspace/alerts.rst deleted file mode 100644 index 703d8581c..000000000 --- a/docs/workspace/alerts.rst +++ /dev/null @@ -1,177 +0,0 @@ -Alerts -====== -.. py:class:: AlertsAPI - - The alerts API can be used to perform CRUD operations on alerts. An alert is a Databricks SQL object that - periodically runs a query, evaluates a condition of its result, and notifies one or more users and/or - notification destinations if the condition was met. Alerts can be scheduled using the `sql_task` type of - the Jobs API, e.g. :method:jobs/create. - - .. py:method:: create(name, options, query_id [, parent, rearm]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sql - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - query = w.queries.create(name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="test query from Go SDK", - query="SELECT 1") - - alert = w.alerts.create(options=sql.AlertOptions(column="1", op="==", value="1"), - name=f'sdk-{time.time_ns()}', - query_id=query.id) - - # cleanup - w.queries.delete(query_id=query.id) - w.alerts.delete(alert_id=alert.id) - - Create an alert. - - Creates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a - condition of its result, and notifies users or notification destinations if the condition was met. - - :param name: str - Name of the alert. - :param options: :class:`AlertOptions` - Alert configuration options. - :param query_id: str - Query ID. - :param parent: str (optional) - The identifier of the workspace folder containing the object. - :param rearm: int (optional) - Number of seconds after being triggered before the alert rearms itself and can be triggered again. - If `null`, alert will never be triggered again. - - :returns: :class:`Alert` - - - .. py:method:: delete(alert_id) - - Delete an alert. - - Deletes an alert. Deleted alerts are no longer accessible and cannot be restored. **Note:** Unlike - queries and dashboards, alerts cannot be moved to the trash. - - :param alert_id: str - - - - - .. py:method:: get(alert_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sql - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - query = w.queries.create(name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="test query from Go SDK", - query="SELECT 1") - - alert = w.alerts.create(options=sql.AlertOptions(column="1", op="==", value="1"), - name=f'sdk-{time.time_ns()}', - query_id=query.id) - - by_id = w.alerts.get(alert_id=alert.id) - - # cleanup - w.queries.delete(query_id=query.id) - w.alerts.delete(alert_id=alert.id) - - Get an alert. - - Gets an alert. - - :param alert_id: str - - :returns: :class:`Alert` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.alerts.list() - - Get alerts. - - Gets a list of alerts. - - :returns: Iterator over :class:`Alert` - - - .. py:method:: update(alert_id, name, options, query_id [, rearm]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sql - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - query = w.queries.create(name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="test query from Go SDK", - query="SELECT 1") - - alert = w.alerts.create(options=sql.AlertOptions(column="1", op="==", value="1"), - name=f'sdk-{time.time_ns()}', - query_id=query.id) - - w.alerts.update(options=sql.AlertOptions(column="1", op="==", value="1"), - alert_id=alert.id, - name=f'sdk-{time.time_ns()}', - query_id=query.id) - - # cleanup - w.queries.delete(query_id=query.id) - w.alerts.delete(alert_id=alert.id) - - Update an alert. - - Updates an alert. - - :param alert_id: str - :param name: str - Name of the alert. - :param options: :class:`AlertOptions` - Alert configuration options. - :param query_id: str - Query ID. - :param rearm: int (optional) - Number of seconds after being triggered before the alert rearms itself and can be triggered again. - If `null`, alert will never be triggered again. - - - \ No newline at end of file diff --git a/docs/workspace/apps.rst b/docs/workspace/apps.rst deleted file mode 100644 index 73b9a4279..000000000 --- a/docs/workspace/apps.rst +++ /dev/null @@ -1,79 +0,0 @@ -Databricks Apps -=============== -.. py:class:: AppsAPI - - Lakehouse Apps run directly on a customer’s Databricks instance, integrate with their data, use and - extend Databricks services, and enable users to interact through single sign-on. - - .. py:method:: create(manifest [, resources]) - - Create and deploy an application. - - Creates and deploys an application. - - :param manifest: :class:`AppManifest` - Manifest that specifies the application requirements - :param resources: Any (optional) - Information passed at app deployment time to fulfill app dependencies - - :returns: :class:`DeploymentStatus` - - - .. py:method:: delete_app(name) - - Delete an application. - - Delete an application definition - - :param name: str - The name of an application. This field is required. - - :returns: :class:`DeleteAppResponse` - - - .. py:method:: get_app(name) - - Get definition for an application. - - Get an application definition - - :param name: str - The name of an application. This field is required. - - :returns: :class:`GetAppResponse` - - - .. py:method:: get_app_deployment_status(deployment_id [, include_app_log]) - - Get deployment status for an application. - - Get deployment status for an application - - :param deployment_id: str - The deployment id for an application. This field is required. - :param include_app_log: str (optional) - Boolean flag to include application logs - - :returns: :class:`DeploymentStatus` - - - .. py:method:: get_apps() - - List all applications. - - List all available applications - - :returns: :class:`ListAppsResponse` - - - .. py:method:: get_events(name) - - Get deployment events for an application. - - Get deployment events for an application - - :param name: str - The name of an application. This field is required. - - :returns: :class:`ListAppEventsResponse` - \ No newline at end of file diff --git a/docs/workspace/artifact_allowlists.rst b/docs/workspace/artifact_allowlists.rst deleted file mode 100644 index db7610047..000000000 --- a/docs/workspace/artifact_allowlists.rst +++ /dev/null @@ -1,35 +0,0 @@ -Artifact Allowlists -=================== -.. py:class:: ArtifactAllowlistsAPI - - In Databricks Runtime 13.3 and above, you can add libraries and init scripts to the `allowlist` in UC so - that users can leverage these artifacts on compute configured with shared access mode. - - .. py:method:: get(artifact_type) - - Get an artifact allowlist. - - Get the artifact allowlist of a certain artifact type. The caller must be a metastore admin or have - the **MANAGE ALLOWLIST** privilege on the metastore. - - :param artifact_type: :class:`ArtifactType` - The artifact type of the allowlist. - - :returns: :class:`ArtifactAllowlistInfo` - - - .. py:method:: update(artifact_type, artifact_matchers) - - Set an artifact allowlist. - - Set the artifact allowlist of a certain artifact type. The whole artifact allowlist is replaced with - the new allowlist. The caller must be a metastore admin or have the **MANAGE ALLOWLIST** privilege on - the metastore. - - :param artifact_type: :class:`ArtifactType` - The artifact type of the allowlist. - :param artifact_matchers: List[:class:`ArtifactMatcher`] - A list of allowed artifact match patterns. - - :returns: :class:`ArtifactAllowlistInfo` - \ No newline at end of file diff --git a/docs/workspace/catalogs.rst b/docs/workspace/catalogs.rst deleted file mode 100644 index 27ebe10a9..000000000 --- a/docs/workspace/catalogs.rst +++ /dev/null @@ -1,164 +0,0 @@ -Catalogs -======== -.. py:class:: CatalogsAPI - - A catalog is the first layer of Unity Catalog’s three-level namespace. It’s used to organize your data - assets. Users can see all catalogs on which they have been assigned the USE_CATALOG data permission. - - In Unity Catalog, admins and data stewards manage users and their access to data centrally across all of - the workspaces in a Databricks account. Users in different workspaces can share access to the same data, - depending on privileges granted centrally in Unity Catalog. - - .. py:method:: create(name [, comment, connection_name, options, properties, provider_name, share_name, storage_root]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - # cleanup - w.catalogs.delete(name=created.name, force=True) - - Create a catalog. - - Creates a new catalog instance in the parent metastore if the caller is a metastore admin or has the - **CREATE_CATALOG** privilege. - - :param name: str - Name of catalog. - :param comment: str (optional) - User-provided free-form text description. - :param connection_name: str (optional) - The name of the connection to an external data source. - :param options: Dict[str,str] (optional) - A map of key-value properties attached to the securable. - :param properties: Dict[str,str] (optional) - A map of key-value properties attached to the securable. - :param provider_name: str (optional) - The name of delta sharing provider. - - A Delta Sharing catalog is a catalog that is based on a Delta share on a remote sharing server. - :param share_name: str (optional) - The name of the share under the share provider. - :param storage_root: str (optional) - Storage root URL for managed tables within catalog. - - :returns: :class:`CatalogInfo` - - - .. py:method:: delete(name [, force]) - - Delete a catalog. - - Deletes the catalog that matches the supplied name. The caller must be a metastore admin or the owner - of the catalog. - - :param name: str - The name of the catalog. - :param force: bool (optional) - Force deletion even if the catalog is not empty. - - - - - .. py:method:: get(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - _ = w.catalogs.get(name=created.name) - - # cleanup - w.catalogs.delete(name=created.name, force=True) - - Get a catalog. - - Gets the specified catalog in a metastore. The caller must be a metastore admin, the owner of the - catalog, or a user that has the **USE_CATALOG** privilege set for their account. - - :param name: str - The name of the catalog. - - :returns: :class:`CatalogInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.catalogs.list() - - List catalogs. - - Gets an array of catalogs in the metastore. If the caller is the metastore admin, all catalogs will be - retrieved. Otherwise, only catalogs owned by the caller (or for which the caller has the - **USE_CATALOG** privilege) will be retrieved. There is no guarantee of a specific ordering of the - elements in the array. - - :returns: Iterator over :class:`CatalogInfo` - - - .. py:method:: update(name [, comment, enable_predictive_optimization, isolation_mode, owner, properties]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - _ = w.catalogs.update(name=created.name, - comment="updated", - enable_predictive_optimization=catalog.EnablePredictiveOptimization.ENABLE) - - # cleanup - w.catalogs.delete(name=created.name, force=True) - - Update a catalog. - - Updates the catalog that matches the supplied name. The caller must be either the owner of the - catalog, or a metastore admin (when changing the owner field of the catalog). - - :param name: str - Name of catalog. - :param comment: str (optional) - User-provided free-form text description. - :param enable_predictive_optimization: :class:`EnablePredictiveOptimization` (optional) - Whether predictive optimization should be enabled for this object and objects under it. - :param isolation_mode: :class:`IsolationMode` (optional) - Whether the current securable is accessible from all workspaces or a specific set of workspaces. - :param owner: str (optional) - Username of current owner of catalog. - :param properties: Dict[str,str] (optional) - A map of key-value properties attached to the securable. - - :returns: :class:`CatalogInfo` - \ No newline at end of file diff --git a/docs/workspace/clean_rooms.rst b/docs/workspace/clean_rooms.rst deleted file mode 100644 index d32b3539b..000000000 --- a/docs/workspace/clean_rooms.rst +++ /dev/null @@ -1,100 +0,0 @@ -Clean Rooms -=========== -.. py:class:: CleanRoomsAPI - - A clean room is a secure, privacy-protecting environment where two or more parties can share sensitive - enterprise data, including customer data, for measurements, insights, activation and other use cases. - - To create clean rooms, you must be a metastore admin or a user with the **CREATE_CLEAN_ROOM** privilege. - - .. py:method:: create(name, remote_detailed_info [, comment]) - - Create a clean room. - - Creates a new clean room with specified colaborators. The caller must be a metastore admin or have the - **CREATE_CLEAN_ROOM** privilege on the metastore. - - :param name: str - Name of the clean room. - :param remote_detailed_info: :class:`CentralCleanRoomInfo` - Central clean room details. - :param comment: str (optional) - User-provided free-form text description. - - :returns: :class:`CleanRoomInfo` - - - .. py:method:: delete(name_arg) - - Delete a clean room. - - Deletes a data object clean room from the metastore. The caller must be an owner of the clean room. - - :param name_arg: str - The name of the clean room. - - - - - .. py:method:: get(name_arg [, include_remote_details]) - - Get a clean room. - - Gets a data object clean room from the metastore. The caller must be a metastore admin or the owner of - the clean room. - - :param name_arg: str - The name of the clean room. - :param include_remote_details: bool (optional) - Whether to include remote details (central) on the clean room. - - :returns: :class:`CleanRoomInfo` - - - .. py:method:: list( [, max_results, page_token]) - - List clean rooms. - - Gets an array of data object clean rooms from the metastore. The caller must be a metastore admin or - the owner of the clean room. There is no guarantee of a specific ordering of the elements in the - array. - - :param max_results: int (optional) - Maximum number of clean rooms to return. - :param page_token: str (optional) - Pagination token to go to next page based on previous query. - - :returns: Iterator over :class:`CleanRoomInfo` - - - .. py:method:: update(name_arg [, catalog_updates, comment, name, owner]) - - Update a clean room. - - Updates the clean room with the changes and data objects in the request. The caller must be the owner - of the clean room or a metastore admin. - - When the caller is a metastore admin, only the __owner__ field can be updated. - - In the case that the clean room name is changed **updateCleanRoom** requires that the caller is both - the clean room owner and a metastore admin. - - For each table that is added through this method, the clean room owner must also have **SELECT** - privilege on the table. The privilege must be maintained indefinitely for recipients to be able to - access the table. Typically, you should use a group as the clean room owner. - - Table removals through **update** do not require additional privileges. - - :param name_arg: str - The name of the clean room. - :param catalog_updates: List[:class:`CleanRoomCatalogUpdate`] (optional) - Array of shared data object updates. - :param comment: str (optional) - User-provided free-form text description. - :param name: str (optional) - Name of the clean room. - :param owner: str (optional) - Username of current owner of clean room. - - :returns: :class:`CleanRoomInfo` - \ No newline at end of file diff --git a/docs/workspace/cluster_policies.rst b/docs/workspace/cluster_policies.rst deleted file mode 100644 index 451d4b7bd..000000000 --- a/docs/workspace/cluster_policies.rst +++ /dev/null @@ -1,283 +0,0 @@ -Cluster Policies -================ -.. py:class:: ClusterPoliciesAPI - - You can use cluster policies to control users' ability to configure clusters based on a set of rules. - These rules specify which attributes or attribute values can be used during cluster creation. Cluster - policies have ACLs that limit their use to specific users and groups. - - With cluster policies, you can: - Auto-install cluster libraries on the next restart by listing them in - the policy's "libraries" field. - Limit users to creating clusters with the prescribed settings. - - Simplify the user interface, enabling more users to create clusters, by fixing and hiding some fields. - - Manage costs by setting limits on attributes that impact the hourly rate. - - Cluster policy permissions limit which policies a user can select in the Policy drop-down when the user - creates a cluster: - A user who has unrestricted cluster create permission can select the Unrestricted - policy and create fully-configurable clusters. - A user who has both unrestricted cluster create - permission and access to cluster policies can select the Unrestricted policy and policies they have access - to. - A user that has access to only cluster policies, can select the policies they have access to. - - If no policies exist in the workspace, the Policy drop-down doesn't appear. Only admin users can create, - edit, and delete policies. Admin users also have access to all policies. - - .. py:method:: create(name [, definition, description, libraries, max_clusters_per_user, policy_family_definition_overrides, policy_family_id]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.cluster_policies.create(name=f'sdk-{time.time_ns()}', - definition="""{ - "spark_conf.spark.databricks.delta.preview.enabled": { - "type": "fixed", - "value": true - } - } - """) - - # cleanup - w.cluster_policies.delete(policy_id=created.policy_id) - - Create a new policy. - - Creates a new policy with prescribed settings. - - :param name: str - Cluster Policy name requested by the user. This has to be unique. Length must be between 1 and 100 - characters. - :param definition: str (optional) - Policy definition document expressed in [Databricks Cluster Policy Definition Language]. - - [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - :param description: str (optional) - Additional human-readable description of the cluster policy. - :param libraries: List[:class:`Library`] (optional) - A list of libraries to be installed on the next cluster restart that uses this policy. - :param max_clusters_per_user: int (optional) - Max number of clusters per user that can be active using this policy. If not present, there is no - max limit. - :param policy_family_definition_overrides: str (optional) - Policy definition JSON document expressed in [Databricks Policy Definition Language]. The JSON - document must be passed as a string and cannot be embedded in the requests. - - You can use this to customize the policy definition inherited from the policy family. Policy rules - specified here are merged into the inherited policy definition. - - [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - :param policy_family_id: str (optional) - ID of the policy family. The cluster policy's policy definition inherits the policy family's policy - definition. - - Cannot be used with `definition`. Use `policy_family_definition_overrides` instead to customize the - policy definition. - - :returns: :class:`CreatePolicyResponse` - - - .. py:method:: delete(policy_id) - - Delete a cluster policy. - - Delete a policy for a cluster. Clusters governed by this policy can still run, but cannot be edited. - - :param policy_id: str - The ID of the policy to delete. - - - - - .. py:method:: edit(policy_id, name [, definition, description, libraries, max_clusters_per_user, policy_family_definition_overrides, policy_family_id]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.cluster_policies.create(name=f'sdk-{time.time_ns()}', - definition="""{ - "spark_conf.spark.databricks.delta.preview.enabled": { - "type": "fixed", - "value": true - } - } - """) - - policy = w.cluster_policies.get(policy_id=created.policy_id) - - w.cluster_policies.edit(policy_id=policy.policy_id, - name=policy.name, - definition="""{ - "spark_conf.spark.databricks.delta.preview.enabled": { - "type": "fixed", - "value": false - } - } - """) - - # cleanup - w.cluster_policies.delete(policy_id=created.policy_id) - - Update a cluster policy. - - Update an existing policy for cluster. This operation may make some clusters governed by the previous - policy invalid. - - :param policy_id: str - The ID of the policy to update. - :param name: str - Cluster Policy name requested by the user. This has to be unique. Length must be between 1 and 100 - characters. - :param definition: str (optional) - Policy definition document expressed in [Databricks Cluster Policy Definition Language]. - - [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - :param description: str (optional) - Additional human-readable description of the cluster policy. - :param libraries: List[:class:`Library`] (optional) - A list of libraries to be installed on the next cluster restart that uses this policy. - :param max_clusters_per_user: int (optional) - Max number of clusters per user that can be active using this policy. If not present, there is no - max limit. - :param policy_family_definition_overrides: str (optional) - Policy definition JSON document expressed in [Databricks Policy Definition Language]. The JSON - document must be passed as a string and cannot be embedded in the requests. - - You can use this to customize the policy definition inherited from the policy family. Policy rules - specified here are merged into the inherited policy definition. - - [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - :param policy_family_id: str (optional) - ID of the policy family. The cluster policy's policy definition inherits the policy family's policy - definition. - - Cannot be used with `definition`. Use `policy_family_definition_overrides` instead to customize the - policy definition. - - - - - .. py:method:: get(policy_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.cluster_policies.create(name=f'sdk-{time.time_ns()}', - definition="""{ - "spark_conf.spark.databricks.delta.preview.enabled": { - "type": "fixed", - "value": true - } - } - """) - - policy = w.cluster_policies.get(policy_id=created.policy_id) - - # cleanup - w.cluster_policies.delete(policy_id=created.policy_id) - - Get a cluster policy. - - Get a cluster policy entity. Creation and editing is available to admins only. - - :param policy_id: str - Canonical unique identifier for the cluster policy. - - :returns: :class:`Policy` - - - .. py:method:: get_permission_levels(cluster_policy_id) - - Get cluster policy permission levels. - - Gets the permission levels that a user can have on an object. - - :param cluster_policy_id: str - The cluster policy for which to get or manage permissions. - - :returns: :class:`GetClusterPolicyPermissionLevelsResponse` - - - .. py:method:: get_permissions(cluster_policy_id) - - Get cluster policy permissions. - - Gets the permissions of a cluster policy. Cluster policies can inherit permissions from their root - object. - - :param cluster_policy_id: str - The cluster policy for which to get or manage permissions. - - :returns: :class:`ClusterPolicyPermissions` - - - .. py:method:: list( [, sort_column, sort_order]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - all = w.cluster_policies.list(compute.ListClusterPoliciesRequest()) - - List cluster policies. - - Returns a list of policies accessible by the requesting user. - - :param sort_column: :class:`ListSortColumn` (optional) - The cluster policy attribute to sort by. * `POLICY_CREATION_TIME` - Sort result list by policy - creation time. * `POLICY_NAME` - Sort result list by policy name. - :param sort_order: :class:`ListSortOrder` (optional) - The order in which the policies get listed. * `DESC` - Sort result list in descending order. * `ASC` - - Sort result list in ascending order. - - :returns: Iterator over :class:`Policy` - - - .. py:method:: set_permissions(cluster_policy_id [, access_control_list]) - - Set cluster policy permissions. - - Sets permissions on a cluster policy. Cluster policies can inherit permissions from their root object. - - :param cluster_policy_id: str - The cluster policy for which to get or manage permissions. - :param access_control_list: List[:class:`ClusterPolicyAccessControlRequest`] (optional) - - :returns: :class:`ClusterPolicyPermissions` - - - .. py:method:: update_permissions(cluster_policy_id [, access_control_list]) - - Update cluster policy permissions. - - Updates the permissions on a cluster policy. Cluster policies can inherit permissions from their root - object. - - :param cluster_policy_id: str - The cluster policy for which to get or manage permissions. - :param access_control_list: List[:class:`ClusterPolicyAccessControlRequest`] (optional) - - :returns: :class:`ClusterPolicyPermissions` - \ No newline at end of file diff --git a/docs/workspace/clusters.rst b/docs/workspace/clusters.rst deleted file mode 100644 index dc4beabdc..000000000 --- a/docs/workspace/clusters.rst +++ /dev/null @@ -1,961 +0,0 @@ -Clusters -======== -.. py:class:: ClustersExt - - The Clusters API allows you to create, start, edit, list, terminate, and delete clusters. - - Databricks maps cluster node instance types to compute units known as DBUs. See the instance type pricing - page for a list of the supported instance types and their corresponding DBUs. - - A Databricks cluster is a set of computation resources and configurations on which you run data - engineering, data science, and data analytics workloads, such as production ETL pipelines, streaming - analytics, ad-hoc analytics, and machine learning. - - You run these workloads as a set of commands in a notebook or as an automated job. Databricks makes a - distinction between all-purpose clusters and job clusters. You use all-purpose clusters to analyze data - collaboratively using interactive notebooks. You use job clusters to run fast and robust automated jobs. - - You can create an all-purpose cluster using the UI, CLI, or REST API. You can manually terminate and - restart an all-purpose cluster. Multiple users can share such clusters to do collaborative interactive - analysis. - - IMPORTANT: Databricks retains cluster configuration information for up to 200 all-purpose clusters - terminated in the last 30 days and up to 30 job clusters recently terminated by the job scheduler. To keep - an all-purpose cluster configuration even after it has been terminated for more than 30 days, an - administrator can pin a cluster to the cluster list. - - .. py:method:: change_owner(cluster_id, owner_username) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - other_owner = w.users.create(user_name=f'sdk-{time.time_ns()}@example.com') - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - w.clusters.change_owner(cluster_id=clstr.cluster_id, owner_username=other_owner.user_name) - - # cleanup - w.users.delete(id=other_owner.id) - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Change cluster owner. - - Change the owner of the cluster. You must be an admin to perform this operation. - - :param cluster_id: str - - :param owner_username: str - New owner of the cluster_id after this RPC. - - - - - .. py:method:: create(spark_version [, apply_policy_default_values, autoscale, autotermination_minutes, aws_attributes, azure_attributes, cluster_log_conf, cluster_name, cluster_source, custom_tags, data_security_mode, docker_image, driver_instance_pool_id, driver_node_type_id, enable_elastic_disk, enable_local_disk_encryption, gcp_attributes, init_scripts, instance_pool_id, node_type_id, num_workers, policy_id, runtime_engine, single_user_name, spark_conf, spark_env_vars, ssh_public_keys, workload_type]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Create new cluster. - - Creates a new Spark cluster. This method will acquire new instances from the cloud provider if - necessary. Note: Databricks may not be able to acquire some of the requested nodes, due to cloud - provider limitations (account limits, spot price, etc.) or transient network issues. - - If Databricks acquires at least 85% of the requested on-demand nodes, cluster creation will succeed. - Otherwise the cluster will terminate with an informative error message. - - :param spark_version: str - The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can be - retrieved by using the :method:clusters/sparkVersions API call. - :param apply_policy_default_values: bool (optional) - :param autoscale: :class:`AutoScale` (optional) - Parameters needed in order to automatically scale clusters up and down based on load. Note: - autoscaling works best with DB runtime versions 3.0 or later. - :param autotermination_minutes: int (optional) - Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this - cluster will not be automatically terminated. If specified, the threshold must be between 10 and - 10000 minutes. Users can also set this value to 0 to explicitly disable automatic termination. - :param aws_attributes: :class:`AwsAttributes` (optional) - Attributes related to clusters running on Amazon Web Services. If not specified at cluster creation, - a set of default values will be used. - :param azure_attributes: :class:`AzureAttributes` (optional) - Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, a - set of default values will be used. - :param cluster_log_conf: :class:`ClusterLogConf` (optional) - The configuration for delivering spark logs to a long-term storage destination. Two kinds of - destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. If - the conf is given, the logs will be delivered to the destination every `5 mins`. The destination of - driver logs is `$destination/$clusterId/driver`, while the destination of executor logs is - `$destination/$clusterId/executor`. - :param cluster_name: str (optional) - Cluster name requested by the user. This doesn't have to be unique. If not specified at creation, - the cluster name will be an empty string. - :param cluster_source: :class:`ClusterSource` (optional) - Determines whether the cluster was created by a user through the UI, created by the Databricks Jobs - Scheduler, or through an API request. This is the same as cluster_creator, but read only. - :param custom_tags: Dict[str,str] (optional) - Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS - instances and EBS volumes) with these tags in addition to `default_tags`. Notes: - - - Currently, Databricks allows at most 45 custom tags - - - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster tags - :param data_security_mode: :class:`DataSecurityMode` (optional) - Data security mode decides what data governance model to use when accessing data from a cluster. - - * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features are - not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively used by a - single user specified in `single_user_name`. Most programming languages, cluster features and data - governance features are available in this mode. * `USER_ISOLATION`: A secure cluster that can be - shared by multiple users. Cluster users are fully isolated so that they cannot see each other's data - and credentials. Most data governance features are supported in this mode. But programming languages - and cluster features might be limited. * `LEGACY_TABLE_ACL`: This mode is for users migrating from - legacy Table ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy - Passthrough on high concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating - from legacy Passthrough on standard clusters. - :param docker_image: :class:`DockerImage` (optional) - :param driver_instance_pool_id: str (optional) - The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster uses - the instance pool with id (instance_pool_id) if the driver pool is not assigned. - :param driver_node_type_id: str (optional) - The node type of the Spark driver. Note that this field is optional; if unset, the driver node type - will be set as the same value as `node_type_id` defined above. - :param enable_elastic_disk: bool (optional) - Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space - when its Spark workers are running low on disk space. This feature requires specific AWS permissions - to function correctly - refer to the User Guide for more details. - :param enable_local_disk_encryption: bool (optional) - Whether to enable LUKS on cluster VMs' local disks - :param gcp_attributes: :class:`GcpAttributes` (optional) - Attributes related to clusters running on Google Cloud Platform. If not specified at cluster - creation, a set of default values will be used. - :param init_scripts: List[:class:`InitScriptInfo`] (optional) - The configuration for storing init scripts. Any number of destinations can be specified. The scripts - are executed sequentially in the order provided. If `cluster_log_conf` is specified, init script - logs are sent to `//init_scripts`. - :param instance_pool_id: str (optional) - The optional ID of the instance pool to which the cluster belongs. - :param node_type_id: str (optional) - This field encodes, through a single value, the resources available to each of the Spark nodes in - this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute - intensive workloads. A list of available node types can be retrieved by using the - :method:clusters/listNodeTypes API call. - :param num_workers: int (optional) - Number of worker nodes that this cluster should have. A cluster has one Spark Driver and - `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. - - Note: When reading the properties of a cluster, this field reflects the desired number of workers - rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 - workers, this field will immediately be updated to reflect the target size of 10 workers, whereas - the workers listed in `spark_info` will gradually increase from 5 to 10 as the new nodes are - provisioned. - :param policy_id: str (optional) - The ID of the cluster policy used to create the cluster if applicable. - :param runtime_engine: :class:`RuntimeEngine` (optional) - Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime engine - is inferred from spark_version. - :param single_user_name: str (optional) - Single user name if data_security_mode is `SINGLE_USER` - :param spark_conf: Dict[str,str] (optional) - An object containing a set of optional, user-specified Spark configuration key-value pairs. Users - can also pass in a string of extra JVM options to the driver and the executors via - `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively. - :param spark_env_vars: Dict[str,str] (optional) - An object containing a set of optional, user-specified environment variable key-value pairs. Please - note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) while - launching the driver and workers. - - In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them to - `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default databricks - managed environmental variables are included as well. - - Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": - "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS - -Dspark.shuffle.service.enabled=true"}` - :param ssh_public_keys: List[str] (optional) - SSH public key contents that will be added to each Spark node in this cluster. The corresponding - private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can be - specified. - :param workload_type: :class:`WorkloadType` (optional) - - :returns: - Long-running operation waiter for :class:`ClusterDetails`. - See :method:wait_get_cluster_running for more details. - - - .. py:method:: delete(cluster_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - _ = w.clusters.delete(cluster_id=clstr.cluster_id).result() - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Terminate cluster. - - Terminates the Spark cluster with the specified ID. The cluster is removed asynchronously. Once the - termination has completed, the cluster will be in a `TERMINATED` state. If the cluster is already in a - `TERMINATING` or `TERMINATED` state, nothing will happen. - - :param cluster_id: str - The cluster to be terminated. - - :returns: - Long-running operation waiter for :class:`ClusterDetails`. - See :method:wait_get_cluster_terminated for more details. - - - .. py:method:: edit(cluster_id, spark_version [, apply_policy_default_values, autoscale, autotermination_minutes, aws_attributes, azure_attributes, cluster_log_conf, cluster_name, cluster_source, custom_tags, data_security_mode, docker_image, driver_instance_pool_id, driver_node_type_id, enable_elastic_disk, enable_local_disk_encryption, gcp_attributes, init_scripts, instance_pool_id, node_type_id, num_workers, policy_id, runtime_engine, single_user_name, spark_conf, spark_env_vars, ssh_public_keys, workload_type]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - cluster_name = f'sdk-{time.time_ns()}' - - latest = w.clusters.select_spark_version(latest=True) - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - _ = w.clusters.edit(cluster_id=clstr.cluster_id, - spark_version=latest, - cluster_name=cluster_name, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=10, - num_workers=2).result() - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Update cluster configuration. - - Updates the configuration of a cluster to match the provided attributes and size. A cluster can be - updated if it is in a `RUNNING` or `TERMINATED` state. - - If a cluster is updated while in a `RUNNING` state, it will be restarted so that the new attributes - can take effect. - - If a cluster is updated while in a `TERMINATED` state, it will remain `TERMINATED`. The next time it - is started using the `clusters/start` API, the new attributes will take effect. Any attempt to update - a cluster in any other state will be rejected with an `INVALID_STATE` error code. - - Clusters created by the Databricks Jobs service cannot be edited. - - :param cluster_id: str - ID of the cluser - :param spark_version: str - The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of available Spark versions can be - retrieved by using the :method:clusters/sparkVersions API call. - :param apply_policy_default_values: bool (optional) - :param autoscale: :class:`AutoScale` (optional) - Parameters needed in order to automatically scale clusters up and down based on load. Note: - autoscaling works best with DB runtime versions 3.0 or later. - :param autotermination_minutes: int (optional) - Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this - cluster will not be automatically terminated. If specified, the threshold must be between 10 and - 10000 minutes. Users can also set this value to 0 to explicitly disable automatic termination. - :param aws_attributes: :class:`AwsAttributes` (optional) - Attributes related to clusters running on Amazon Web Services. If not specified at cluster creation, - a set of default values will be used. - :param azure_attributes: :class:`AzureAttributes` (optional) - Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, a - set of default values will be used. - :param cluster_log_conf: :class:`ClusterLogConf` (optional) - The configuration for delivering spark logs to a long-term storage destination. Two kinds of - destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. If - the conf is given, the logs will be delivered to the destination every `5 mins`. The destination of - driver logs is `$destination/$clusterId/driver`, while the destination of executor logs is - `$destination/$clusterId/executor`. - :param cluster_name: str (optional) - Cluster name requested by the user. This doesn't have to be unique. If not specified at creation, - the cluster name will be an empty string. - :param cluster_source: :class:`ClusterSource` (optional) - Determines whether the cluster was created by a user through the UI, created by the Databricks Jobs - Scheduler, or through an API request. This is the same as cluster_creator, but read only. - :param custom_tags: Dict[str,str] (optional) - Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS - instances and EBS volumes) with these tags in addition to `default_tags`. Notes: - - - Currently, Databricks allows at most 45 custom tags - - - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster tags - :param data_security_mode: :class:`DataSecurityMode` (optional) - Data security mode decides what data governance model to use when accessing data from a cluster. - - * `NONE`: No security isolation for multiple users sharing the cluster. Data governance features are - not available in this mode. * `SINGLE_USER`: A secure cluster that can only be exclusively used by a - single user specified in `single_user_name`. Most programming languages, cluster features and data - governance features are available in this mode. * `USER_ISOLATION`: A secure cluster that can be - shared by multiple users. Cluster users are fully isolated so that they cannot see each other's data - and credentials. Most data governance features are supported in this mode. But programming languages - and cluster features might be limited. * `LEGACY_TABLE_ACL`: This mode is for users migrating from - legacy Table ACL clusters. * `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy - Passthrough on high concurrency clusters. * `LEGACY_SINGLE_USER`: This mode is for users migrating - from legacy Passthrough on standard clusters. - :param docker_image: :class:`DockerImage` (optional) - :param driver_instance_pool_id: str (optional) - The optional ID of the instance pool for the driver of the cluster belongs. The pool cluster uses - the instance pool with id (instance_pool_id) if the driver pool is not assigned. - :param driver_node_type_id: str (optional) - The node type of the Spark driver. Note that this field is optional; if unset, the driver node type - will be set as the same value as `node_type_id` defined above. - :param enable_elastic_disk: bool (optional) - Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space - when its Spark workers are running low on disk space. This feature requires specific AWS permissions - to function correctly - refer to the User Guide for more details. - :param enable_local_disk_encryption: bool (optional) - Whether to enable LUKS on cluster VMs' local disks - :param gcp_attributes: :class:`GcpAttributes` (optional) - Attributes related to clusters running on Google Cloud Platform. If not specified at cluster - creation, a set of default values will be used. - :param init_scripts: List[:class:`InitScriptInfo`] (optional) - The configuration for storing init scripts. Any number of destinations can be specified. The scripts - are executed sequentially in the order provided. If `cluster_log_conf` is specified, init script - logs are sent to `//init_scripts`. - :param instance_pool_id: str (optional) - The optional ID of the instance pool to which the cluster belongs. - :param node_type_id: str (optional) - This field encodes, through a single value, the resources available to each of the Spark nodes in - this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute - intensive workloads. A list of available node types can be retrieved by using the - :method:clusters/listNodeTypes API call. - :param num_workers: int (optional) - Number of worker nodes that this cluster should have. A cluster has one Spark Driver and - `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. - - Note: When reading the properties of a cluster, this field reflects the desired number of workers - rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 - workers, this field will immediately be updated to reflect the target size of 10 workers, whereas - the workers listed in `spark_info` will gradually increase from 5 to 10 as the new nodes are - provisioned. - :param policy_id: str (optional) - The ID of the cluster policy used to create the cluster if applicable. - :param runtime_engine: :class:`RuntimeEngine` (optional) - Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime engine - is inferred from spark_version. - :param single_user_name: str (optional) - Single user name if data_security_mode is `SINGLE_USER` - :param spark_conf: Dict[str,str] (optional) - An object containing a set of optional, user-specified Spark configuration key-value pairs. Users - can also pass in a string of extra JVM options to the driver and the executors via - `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively. - :param spark_env_vars: Dict[str,str] (optional) - An object containing a set of optional, user-specified environment variable key-value pairs. Please - note that key-value pair of the form (X,Y) will be exported as is (i.e., `export X='Y'`) while - launching the driver and workers. - - In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending them to - `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all default databricks - managed environmental variables are included as well. - - Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": - "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS - -Dspark.shuffle.service.enabled=true"}` - :param ssh_public_keys: List[str] (optional) - SSH public key contents that will be added to each Spark node in this cluster. The corresponding - private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can be - specified. - :param workload_type: :class:`WorkloadType` (optional) - - :returns: - Long-running operation waiter for :class:`ClusterDetails`. - See :method:wait_get_cluster_running for more details. - - - .. py:method:: ensure_cluster_is_running(cluster_id) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - cluster_id = os.environ["TEST_DEFAULT_CLUSTER_ID"] - - context = w.command_execution.create(cluster_id=cluster_id, language=compute.Language.PYTHON).result() - - w.clusters.ensure_cluster_is_running(cluster_id) - - # cleanup - w.command_execution.destroy(cluster_id=cluster_id, context_id=context.id) - - Ensures that given cluster is running, regardless of the current state - - .. py:method:: events(cluster_id [, end_time, event_types, limit, offset, order, start_time]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - events = w.clusters.events(cluster_id=clstr.cluster_id) - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - List cluster activity events. - - Retrieves a list of events about the activity of a cluster. This API is paginated. If there are more - events to read, the response includes all the nparameters necessary to request the next page of - events. - - :param cluster_id: str - The ID of the cluster to retrieve events about. - :param end_time: int (optional) - The end time in epoch milliseconds. If empty, returns events up to the current time. - :param event_types: List[:class:`EventType`] (optional) - An optional set of event types to filter on. If empty, all event types are returned. - :param limit: int (optional) - The maximum number of events to include in a page of events. Defaults to 50, and maximum allowed - value is 500. - :param offset: int (optional) - The offset in the result set. Defaults to 0 (no offset). When an offset is specified and the results - are requested in descending order, the end_time field is required. - :param order: :class:`GetEventsOrder` (optional) - The order to list events in; either "ASC" or "DESC". Defaults to "DESC". - :param start_time: int (optional) - The start time in epoch milliseconds. If empty, returns events starting from the beginning of time. - - :returns: Iterator over :class:`ClusterEvent` - - - .. py:method:: get(cluster_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - by_id = w.clusters.get(cluster_id=clstr.cluster_id) - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Get cluster info. - - Retrieves the information for a cluster given its identifier. Clusters can be described while they are - running, or up to 60 days after they are terminated. - - :param cluster_id: str - The cluster about which to retrieve information. - - :returns: :class:`ClusterDetails` - - - .. py:method:: get_permission_levels(cluster_id) - - Get cluster permission levels. - - Gets the permission levels that a user can have on an object. - - :param cluster_id: str - The cluster for which to get or manage permissions. - - :returns: :class:`GetClusterPermissionLevelsResponse` - - - .. py:method:: get_permissions(cluster_id) - - Get cluster permissions. - - Gets the permissions of a cluster. Clusters can inherit permissions from their root object. - - :param cluster_id: str - The cluster for which to get or manage permissions. - - :returns: :class:`ClusterPermissions` - - - .. py:method:: list( [, can_use_client]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - all = w.clusters.list(compute.ListClustersRequest()) - - List all clusters. - - Return information about all pinned clusters, active clusters, up to 200 of the most recently - terminated all-purpose clusters in the past 30 days, and up to 30 of the most recently terminated job - clusters in the past 30 days. - - For example, if there is 1 pinned cluster, 4 active clusters, 45 terminated all-purpose clusters in - the past 30 days, and 50 terminated job clusters in the past 30 days, then this API returns the 1 - pinned cluster, 4 active clusters, all 45 terminated all-purpose clusters, and the 30 most recently - terminated job clusters. - - :param can_use_client: str (optional) - Filter clusters based on what type of client it can be used for. Could be either NOTEBOOKS or JOBS. - No input for this field will get all clusters in the workspace without filtering on its supported - client - - :returns: Iterator over :class:`ClusterDetails` - - - .. py:method:: list_node_types() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - nodes = w.clusters.list_node_types() - - List node types. - - Returns a list of supported Spark node types. These node types can be used to launch a cluster. - - :returns: :class:`ListNodeTypesResponse` - - - .. py:method:: list_zones() - - List availability zones. - - Returns a list of availability zones where clusters can be created in (For example, us-west-2a). These - zones can be used to launch a cluster. - - :returns: :class:`ListAvailableZonesResponse` - - - .. py:method:: permanent_delete(cluster_id) - - Permanently delete cluster. - - Permanently deletes a Spark cluster. This cluster is terminated and resources are asynchronously - removed. - - In addition, users will no longer see permanently deleted clusters in the cluster list, and API users - can no longer perform any action on permanently deleted clusters. - - :param cluster_id: str - The cluster to be deleted. - - - - - .. py:method:: pin(cluster_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - w.clusters.pin(cluster_id=clstr.cluster_id) - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Pin cluster. - - Pinning a cluster ensures that the cluster will always be returned by the ListClusters API. Pinning a - cluster that is already pinned will have no effect. This API can only be called by workspace admins. - - :param cluster_id: str - - - - - - .. py:method:: resize(cluster_id [, autoscale, num_workers]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - by_id = w.clusters.resize(cluster_id=clstr.cluster_id, num_workers=1).result() - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Resize cluster. - - Resizes a cluster to have a desired number of workers. This will fail unless the cluster is in a - `RUNNING` state. - - :param cluster_id: str - The cluster to be resized. - :param autoscale: :class:`AutoScale` (optional) - Parameters needed in order to automatically scale clusters up and down based on load. Note: - autoscaling works best with DB runtime versions 3.0 or later. - :param num_workers: int (optional) - Number of worker nodes that this cluster should have. A cluster has one Spark Driver and - `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. - - Note: When reading the properties of a cluster, this field reflects the desired number of workers - rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 - workers, this field will immediately be updated to reflect the target size of 10 workers, whereas - the workers listed in `spark_info` will gradually increase from 5 to 10 as the new nodes are - provisioned. - - :returns: - Long-running operation waiter for :class:`ClusterDetails`. - See :method:wait_get_cluster_running for more details. - - - .. py:method:: restart(cluster_id [, restart_user]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - _ = w.clusters.restart(cluster_id=clstr.cluster_id).result() - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Restart cluster. - - Restarts a Spark cluster with the supplied ID. If the cluster is not currently in a `RUNNING` state, - nothing will happen. - - :param cluster_id: str - The cluster to be started. - :param restart_user: str (optional) - - - :returns: - Long-running operation waiter for :class:`ClusterDetails`. - See :method:wait_get_cluster_running for more details. - - - .. py:method:: select_node_type(min_memory_gb, gb_per_core, min_cores, min_gpus, local_disk, local_disk_min_size, category, photon_worker_capable, photon_driver_capable, graviton, is_io_cache_enabled, support_port_forwarding, fleet) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - smallest = w.clusters.select_node_type(local_disk=True) - - Selects smallest available node type given the conditions. - - :param min_memory_gb: int - :param gb_per_core: int - :param min_cores: int - :param min_gpus: int - :param local_disk: bool - :param local_disk_min_size: bool - :param category: bool - :param photon_worker_capable: bool - :param photon_driver_capable: bool - :param graviton: bool - :param is_io_cache_enabled: bool - - :returns: `node_type` compatible string - - - .. py:method:: select_spark_version(long_term_support, beta, latest, ml, genomics, gpu, scala, spark_version, photon, graviton) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - Selects the latest Databricks Runtime Version. - - :param long_term_support: bool - :param beta: bool - :param latest: bool - :param ml: bool - :param gpu: bool - :param scala: bool - :param spark_version: bool - :param photon: bool - :param graviton: bool - - :returns: `spark_version` compatible string - - - .. py:method:: set_permissions(cluster_id [, access_control_list]) - - Set cluster permissions. - - Sets permissions on a cluster. Clusters can inherit permissions from their root object. - - :param cluster_id: str - The cluster for which to get or manage permissions. - :param access_control_list: List[:class:`ClusterAccessControlRequest`] (optional) - - :returns: :class:`ClusterPermissions` - - - .. py:method:: spark_versions() - - List available Spark versions. - - Returns the list of available Spark versions. These versions can be used to launch a cluster. - - :returns: :class:`GetSparkVersionsResponse` - - - .. py:method:: start(cluster_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - _ = w.clusters.start(cluster_id=clstr.cluster_id).result() - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Start terminated cluster. - - Starts a terminated Spark cluster with the supplied ID. This works similar to `createCluster` except: - - * The previous cluster id and attributes are preserved. * The cluster starts with the last specified - cluster size. * If the previous cluster was an autoscaling cluster, the current cluster starts with - the minimum number of nodes. * If the cluster is not currently in a `TERMINATED` state, nothing will - happen. * Clusters launched to run a job cannot be started. - - :param cluster_id: str - The cluster to be started. - - :returns: - Long-running operation waiter for :class:`ClusterDetails`. - See :method:wait_get_cluster_running for more details. - - - .. py:method:: unpin(cluster_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - latest = w.clusters.select_spark_version(latest=True) - - cluster_name = f'sdk-{time.time_ns()}' - - clstr = w.clusters.create(cluster_name=cluster_name, - spark_version=latest, - instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - autotermination_minutes=15, - num_workers=1).result() - - w.clusters.unpin(cluster_id=clstr.cluster_id) - - # cleanup - w.clusters.permanent_delete(cluster_id=clstr.cluster_id) - - Unpin cluster. - - Unpinning a cluster will allow the cluster to eventually be removed from the ListClusters API. - Unpinning a cluster that is not pinned will have no effect. This API can only be called by workspace - admins. - - :param cluster_id: str - - - - - - .. py:method:: update_permissions(cluster_id [, access_control_list]) - - Update cluster permissions. - - Updates the permissions on a cluster. Clusters can inherit permissions from their root object. - - :param cluster_id: str - The cluster for which to get or manage permissions. - :param access_control_list: List[:class:`ClusterAccessControlRequest`] (optional) - - :returns: :class:`ClusterPermissions` - \ No newline at end of file diff --git a/docs/workspace/command_execution.rst b/docs/workspace/command_execution.rst deleted file mode 100644 index f2d15635a..000000000 --- a/docs/workspace/command_execution.rst +++ /dev/null @@ -1,140 +0,0 @@ -Command Execution -================= -.. py:class:: CommandExecutionAPI - - This API allows execution of Python, Scala, SQL, or R commands on running Databricks Clusters. - - .. py:method:: cancel( [, cluster_id, command_id, context_id]) - - Cancel a command. - - Cancels a currently running command within an execution context. - - The command ID is obtained from a prior successful call to __execute__. - - :param cluster_id: str (optional) - :param command_id: str (optional) - :param context_id: str (optional) - - :returns: - Long-running operation waiter for :class:`CommandStatusResponse`. - See :method:wait_command_status_command_execution_cancelled for more details. - - - .. py:method:: command_status(cluster_id, context_id, command_id) - - Get command info. - - Gets the status of and, if available, the results from a currently executing command. - - The command ID is obtained from a prior successful call to __execute__. - - :param cluster_id: str - :param context_id: str - :param command_id: str - - :returns: :class:`CommandStatusResponse` - - - .. py:method:: context_status(cluster_id, context_id) - - Get status. - - Gets the status for an execution context. - - :param cluster_id: str - :param context_id: str - - :returns: :class:`ContextStatusResponse` - - - .. py:method:: create( [, cluster_id, language]) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - cluster_id = os.environ["TEST_DEFAULT_CLUSTER_ID"] - - context = w.command_execution.create(cluster_id=cluster_id, language=compute.Language.PYTHON).result() - - # cleanup - w.command_execution.destroy(cluster_id=cluster_id, context_id=context.id) - - Create an execution context. - - Creates an execution context for running cluster commands. - - If successful, this method returns the ID of the new execution context. - - :param cluster_id: str (optional) - Running cluster id - :param language: :class:`Language` (optional) - - :returns: - Long-running operation waiter for :class:`ContextStatusResponse`. - See :method:wait_context_status_command_execution_running for more details. - - - .. py:method:: destroy(cluster_id, context_id) - - Delete an execution context. - - Deletes an execution context. - - :param cluster_id: str - :param context_id: str - - - - - .. py:method:: execute( [, cluster_id, command, context_id, language]) - - Usage: - - .. code-block:: - - import os - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - cluster_id = os.environ["TEST_DEFAULT_CLUSTER_ID"] - - context = w.command_execution.create(cluster_id=cluster_id, language=compute.Language.PYTHON).result() - - text_results = w.command_execution.execute(cluster_id=cluster_id, - context_id=context.id, - language=compute.Language.PYTHON, - command="print(1)").result() - - # cleanup - w.command_execution.destroy(cluster_id=cluster_id, context_id=context.id) - - Run a command. - - Runs a cluster command in the given execution context, using the provided language. - - If successful, it returns an ID for tracking the status of the command's execution. - - :param cluster_id: str (optional) - Running cluster id - :param command: str (optional) - Executable code - :param context_id: str (optional) - Running context id - :param language: :class:`Language` (optional) - - :returns: - Long-running operation waiter for :class:`CommandStatusResponse`. - See :method:wait_command_status_command_execution_finished_or_error for more details. - \ No newline at end of file diff --git a/docs/workspace/connections.rst b/docs/workspace/connections.rst deleted file mode 100644 index 1e2f2b3ca..000000000 --- a/docs/workspace/connections.rst +++ /dev/null @@ -1,200 +0,0 @@ -Connections -=========== -.. py:class:: ConnectionsAPI - - Connections allow for creating a connection to an external data source. - - A connection is an abstraction of an external data source that can be connected from Databricks Compute. - Creating a connection object is the first step to managing external data sources within Unity Catalog, - with the second step being creating a data object (catalog, schema, or table) using the connection. Data - objects derived from a connection can be written to or read from similar to other Unity Catalog data - objects based on cloud storage. Users may create different types of connections with each connection - having a unique set of configuration options to support credential management and other settings. - - .. py:method:: create(name, connection_type, options [, comment, properties, read_only]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - conn_create = w.connections.create(comment="Go SDK Acceptance Test Connection", - connection_type=catalog.ConnectionType.DATABRICKS, - name=f'sdk-{time.time_ns()}', - options={ - "host": - "%s-fake-workspace.cloud.databricks.com" % (f'sdk-{time.time_ns()}'), - "httpPath": - "/sql/1.0/warehouses/%s" % (f'sdk-{time.time_ns()}'), - "personalAccessToken": - f'sdk-{time.time_ns()}', - }) - - # cleanup - w.connections.delete(name_arg=conn_create.name) - - Create a connection. - - Creates a new connection - - Creates a new connection to an external data source. It allows users to specify connection details and - configurations for interaction with the external server. - - :param name: str - Name of the connection. - :param connection_type: :class:`ConnectionType` - The type of connection. - :param options: Dict[str,str] - A map of key-value properties attached to the securable. - :param comment: str (optional) - User-provided free-form text description. - :param properties: Dict[str,str] (optional) - An object containing map of key-value properties attached to the connection. - :param read_only: bool (optional) - If the connection is read only. - - :returns: :class:`ConnectionInfo` - - - .. py:method:: delete(name_arg) - - Delete a connection. - - Deletes the connection that matches the supplied name. - - :param name_arg: str - The name of the connection to be deleted. - - - - - .. py:method:: get(name_arg) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - conn_create = w.connections.create(comment="Go SDK Acceptance Test Connection", - connection_type=catalog.ConnectionType.DATABRICKS, - name=f'sdk-{time.time_ns()}', - options={ - "host": - "%s-fake-workspace.cloud.databricks.com" % (f'sdk-{time.time_ns()}'), - "httpPath": - "/sql/1.0/warehouses/%s" % (f'sdk-{time.time_ns()}'), - "personalAccessToken": - f'sdk-{time.time_ns()}', - }) - - conn_update = w.connections.update(name=conn_create.name, - name_arg=conn_create.name, - options={ - "host": - "%s-fake-workspace.cloud.databricks.com" % (f'sdk-{time.time_ns()}'), - "httpPath": - "/sql/1.0/warehouses/%s" % (f'sdk-{time.time_ns()}'), - "personalAccessToken": - f'sdk-{time.time_ns()}', - }) - - conn = w.connections.get(name_arg=conn_update.name) - - # cleanup - w.connections.delete(name_arg=conn_create.name) - - Get a connection. - - Gets a connection from it's name. - - :param name_arg: str - Name of the connection. - - :returns: :class:`ConnectionInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - conn_list = w.connections.list() - - List connections. - - List all connections. - - :returns: Iterator over :class:`ConnectionInfo` - - - .. py:method:: update(name_arg, name, options [, owner]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - conn_create = w.connections.create(comment="Go SDK Acceptance Test Connection", - connection_type=catalog.ConnectionType.DATABRICKS, - name=f'sdk-{time.time_ns()}', - options={ - "host": - "%s-fake-workspace.cloud.databricks.com" % (f'sdk-{time.time_ns()}'), - "httpPath": - "/sql/1.0/warehouses/%s" % (f'sdk-{time.time_ns()}'), - "personalAccessToken": - f'sdk-{time.time_ns()}', - }) - - conn_update = w.connections.update(name=conn_create.name, - name_arg=conn_create.name, - options={ - "host": - "%s-fake-workspace.cloud.databricks.com" % (f'sdk-{time.time_ns()}'), - "httpPath": - "/sql/1.0/warehouses/%s" % (f'sdk-{time.time_ns()}'), - "personalAccessToken": - f'sdk-{time.time_ns()}', - }) - - # cleanup - w.connections.delete(name_arg=conn_create.name) - - Update a connection. - - Updates the connection that matches the supplied name. - - :param name_arg: str - Name of the connection. - :param name: str - Name of the connection. - :param options: Dict[str,str] - A map of key-value properties attached to the securable. - :param owner: str (optional) - Username of current owner of the connection. - - :returns: :class:`ConnectionInfo` - \ No newline at end of file diff --git a/docs/workspace/credentials_manager.rst b/docs/workspace/credentials_manager.rst deleted file mode 100644 index 8c83088ce..000000000 --- a/docs/workspace/credentials_manager.rst +++ /dev/null @@ -1,21 +0,0 @@ -Credentials Manager -=================== -.. py:class:: CredentialsManagerAPI - - Credentials manager interacts with with Identity Providers to to perform token exchanges using stored - credentials and refresh tokens. - - .. py:method:: exchange_token(partition_id, token_type, scopes) - - Exchange token. - - Exchange tokens with an Identity Provider to get a new access token. It allowes specifying scopes to - determine token permissions. - - :param partition_id: :class:`PartitionId` - :param token_type: List[:class:`TokenType`] - :param scopes: List[str] - Array of scopes for the token request. - - :returns: :class:`ExchangeTokenResponse` - \ No newline at end of file diff --git a/docs/workspace/current_user.rst b/docs/workspace/current_user.rst deleted file mode 100644 index 94e4dd82d..000000000 --- a/docs/workspace/current_user.rst +++ /dev/null @@ -1,24 +0,0 @@ -CurrentUser -=========== -.. py:class:: CurrentUserAPI - - This API allows retrieving information about currently authenticated user or service principal. - - .. py:method:: me() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - me2 = w.current_user.me() - - Get current user info. - - Get details about the current method caller's identity. - - :returns: :class:`User` - \ No newline at end of file diff --git a/docs/workspace/dashboard_widgets.rst b/docs/workspace/dashboard_widgets.rst deleted file mode 100644 index 87bf2e5a9..000000000 --- a/docs/workspace/dashboard_widgets.rst +++ /dev/null @@ -1,52 +0,0 @@ -Dashboard Widgets -================= -.. py:class:: DashboardWidgetsAPI - - This is an evolving API that facilitates the addition and removal of widgets from existing dashboards - within the Databricks Workspace. Data structures may change over time. - - .. py:method:: create(dashboard_id, options, width [, text, visualization_id]) - - Add widget to a dashboard. - - :param dashboard_id: str - Dashboard ID returned by :method:dashboards/create. - :param options: :class:`WidgetOptions` - :param width: int - Width of a widget - :param text: str (optional) - If this is a textbox widget, the application displays this text. This field is ignored if the widget - contains a visualization in the `visualization` field. - :param visualization_id: str (optional) - Query Vizualization ID returned by :method:queryvisualizations/create. - - :returns: :class:`Widget` - - - .. py:method:: delete(id) - - Remove widget. - - :param id: str - - - - - .. py:method:: update(id, dashboard_id, options, width [, text, visualization_id]) - - Update existing widget. - - :param id: str - :param dashboard_id: str - Dashboard ID returned by :method:dashboards/create. - :param options: :class:`WidgetOptions` - :param width: int - Width of a widget - :param text: str (optional) - If this is a textbox widget, the application displays this text. This field is ignored if the widget - contains a visualization in the `visualization` field. - :param visualization_id: str (optional) - Query Vizualization ID returned by :method:queryvisualizations/create. - - :returns: :class:`Widget` - \ No newline at end of file diff --git a/docs/workspace/dashboards.rst b/docs/workspace/dashboards.rst deleted file mode 100644 index 9dbbb5776..000000000 --- a/docs/workspace/dashboards.rst +++ /dev/null @@ -1,158 +0,0 @@ -Dashboards -========== -.. py:class:: DashboardsAPI - - In general, there is little need to modify dashboards using the API. However, it can be useful to use - dashboard objects to look-up a collection of related query IDs. The API can also be used to duplicate - multiple dashboards at once since you can get a dashboard definition with a GET request and then POST it - to create a new one. Dashboards can be scheduled using the `sql_task` type of the Jobs API, e.g. - :method:jobs/create. - - .. py:method:: create(name [, dashboard_filters_enabled, is_favorite, parent, run_as_role, tags]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.dashboards.create(name=f'sdk-{time.time_ns()}') - - # cleanup - w.dashboards.delete(dashboard_id=created.id) - - Create a dashboard object. - - :param name: str - The title of this dashboard that appears in list views and at the top of the dashboard page. - :param dashboard_filters_enabled: bool (optional) - Indicates whether the dashboard filters are enabled - :param is_favorite: bool (optional) - Indicates whether this query object should appear in the current user's favorites list. The - application uses this flag to determine whether or not the "favorite star " should selected. - :param parent: str (optional) - The identifier of the workspace folder containing the object. - :param run_as_role: :class:`RunAsRole` (optional) - Run as role - :param tags: List[str] (optional) - - :returns: :class:`Dashboard` - - - .. py:method:: delete(dashboard_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.dashboards.create(name=f'sdk-{time.time_ns()}') - - w.dashboards.delete(dashboard_id=created.id) - - # cleanup - w.dashboards.delete(dashboard_id=created.id) - - Remove a dashboard. - - Moves a dashboard to the trash. Trashed dashboards do not appear in list views or searches, and cannot - be shared. - - :param dashboard_id: str - - - - - .. py:method:: get(dashboard_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.dashboards.create(name=f'sdk-{time.time_ns()}') - - by_id = w.dashboards.get(dashboard_id=created.id) - - # cleanup - w.dashboards.delete(dashboard_id=created.id) - - Retrieve a definition. - - Returns a JSON representation of a dashboard object, including its visualization and query objects. - - :param dashboard_id: str - - :returns: :class:`Dashboard` - - - .. py:method:: list( [, order, page, page_size, q]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sql - - w = WorkspaceClient() - - all = w.dashboards.list(sql.ListDashboardsRequest()) - - Get dashboard objects. - - Fetch a paginated list of dashboard objects. - - :param order: :class:`ListOrder` (optional) - Name of dashboard attribute to order by. - :param page: int (optional) - Page number to retrieve. - :param page_size: int (optional) - Number of dashboards to return per page. - :param q: str (optional) - Full text search term. - - :returns: Iterator over :class:`Dashboard` - - - .. py:method:: restore(dashboard_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.dashboards.create(name=f'sdk-{time.time_ns()}') - - w.dashboards.restore(dashboard_id=created.id) - - # cleanup - w.dashboards.delete(dashboard_id=created.id) - - Restore a dashboard. - - A restored dashboard appears in list views and searches and can be shared. - - :param dashboard_id: str - - - \ No newline at end of file diff --git a/docs/workspace/data_sources.rst b/docs/workspace/data_sources.rst deleted file mode 100644 index e17c9e169..000000000 --- a/docs/workspace/data_sources.rst +++ /dev/null @@ -1,32 +0,0 @@ -Data Sources -============ -.. py:class:: DataSourcesAPI - - This API is provided to assist you in making new query objects. When creating a query object, you may - optionally specify a `data_source_id` for the SQL warehouse against which it will run. If you don't - already know the `data_source_id` for your desired SQL warehouse, this API will help you find it. - - This API does not support searches. It returns the full list of SQL warehouses in your workspace. We - advise you to use any text editor, REST client, or `grep` to search the response from this API for the - name of your SQL warehouse as it appears in Databricks SQL. - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - Get a list of SQL warehouses. - - Retrieves a full list of SQL warehouses available in this workspace. All fields that appear in this - API response are enumerated for clarity. However, you need only a SQL warehouse's `id` to create new - queries against it. - - :returns: Iterator over :class:`DataSource` - \ No newline at end of file diff --git a/docs/workspace/dbfs.rst b/docs/workspace/dbfs.rst deleted file mode 100644 index 754e8b8d1..000000000 --- a/docs/workspace/dbfs.rst +++ /dev/null @@ -1,232 +0,0 @@ -DBFS -==== -.. py:class:: DbfsExt - - DBFS API makes it simple to interact with various data sources without having to include a users - credentials every time to read a file. - - .. py:method:: add_block(handle, data) - - Append data block. - - Appends a block of data to the stream specified by the input handle. If the handle does not exist, - this call will throw an exception with `RESOURCE_DOES_NOT_EXIST`. - - If the block of data exceeds 1 MB, this call will throw an exception with `MAX_BLOCK_SIZE_EXCEEDED`. - - :param handle: int - The handle on an open stream. - :param data: str - The base64-encoded data to append to the stream. This has a limit of 1 MB. - - - - - .. py:method:: close(handle) - - Close the stream. - - Closes the stream specified by the input handle. If the handle does not exist, this call throws an - exception with `RESOURCE_DOES_NOT_EXIST`. - - :param handle: int - The handle on an open stream. - - - - - .. py:method:: copy(src, dst [, recursive, overwrite]) - - Copy files between DBFS and local filesystems - - .. py:method:: create(path [, overwrite]) - - Open a stream. - - Opens a stream to write to a file and returns a handle to this stream. There is a 10 minute idle - timeout on this handle. If a file or directory already exists on the given path and __overwrite__ is - set to `false`, this call throws an exception with `RESOURCE_ALREADY_EXISTS`. - - A typical workflow for file upload would be: - - 1. Issue a `create` call and get a handle. 2. Issue one or more `add-block` calls with the handle you - have. 3. Issue a `close` call with the handle you have. - - :param path: str - The path of the new file. The path should be the absolute DBFS path. - :param overwrite: bool (optional) - The flag that specifies whether to overwrite existing file/files. - - :returns: :class:`CreateResponse` - - - .. py:method:: delete(path [, recursive]) - - Delete a file/directory. - - Delete the file or directory (optionally recursively delete all files in the directory). This call - throws an exception with `IO_ERROR` if the path is a non-empty directory and `recursive` is set to - `false` or on other similar errors. - - When you delete a large number of files, the delete operation is done in increments. The call returns - a response after approximately 45 seconds with an error message (503 Service Unavailable) asking you - to re-invoke the delete operation until the directory structure is fully deleted. - - For operations that delete more than 10K files, we discourage using the DBFS REST API, but advise you - to perform such operations in the context of a cluster, using the [File system utility - (dbutils.fs)](/dev-tools/databricks-utils.html#dbutils-fs). `dbutils.fs` covers the functional scope - of the DBFS REST API, but from notebooks. Running such operations using notebooks provides better - control and manageability, such as selective deletes, and the possibility to automate periodic delete - jobs. - - :param path: str - The path of the file or directory to delete. The path should be the absolute DBFS path. - :param recursive: bool (optional) - Whether or not to recursively delete the directory's contents. Deleting empty directories can be - done without providing the recursive flag. - - - - - .. py:method:: download(path) - - Usage: - - .. code-block:: - - import io - import pathlib - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - root = pathlib.Path(f'/tmp/{time.time_ns()}') - - f = io.BytesIO(b"some text data") - w.dbfs.upload(f'{root}/01', f) - - with w.dbfs.download(f'{root}/01') as f: - assert f.read() == b"some text data" - - Download file from DBFS - - .. py:method:: exists(path) - - If file exists on DBFS - - .. py:method:: get_status(path) - - Get the information of a file or directory. - - Gets the file information for a file or directory. If the file or directory does not exist, this call - throws an exception with `RESOURCE_DOES_NOT_EXIST`. - - :param path: str - The path of the file or directory. The path should be the absolute DBFS path. - - :returns: :class:`FileInfo` - - - .. py:method:: list(path [, recursive]) - - List directory contents or file details. - - List the contents of a directory, or details of the file. If the file or directory does not exist, - this call throws an exception with `RESOURCE_DOES_NOT_EXIST`. - - When calling list on a large directory, the list operation will time out after approximately 60 - seconds. - - :param recursive: traverse deep into directory tree - :returns iterator of metadata for every file - - - .. py:method:: mkdirs(path) - - Create a directory. - - Creates the given directory and necessary parent directories if they do not exist. If a file (not a - directory) exists at any prefix of the input path, this call throws an exception with - `RESOURCE_ALREADY_EXISTS`. **Note**: If this operation fails, it might have succeeded in creating some - of the necessary parent directories. - - :param path: str - The path of the new directory. The path should be the absolute DBFS path. - - - - - .. py:method:: move(source_path, destination_path) - - Move a file. - - Moves a file from one location to another location within DBFS. If the source file does not exist, - this call throws an exception with `RESOURCE_DOES_NOT_EXIST`. If a file already exists in the - destination path, this call throws an exception with `RESOURCE_ALREADY_EXISTS`. If the given source - path is a directory, this call always recursively moves all files.", - - :param source_path: str - The source path of the file or directory. The path should be the absolute DBFS path. - :param destination_path: str - The destination path of the file or directory. The path should be the absolute DBFS path. - - - - - .. py:method:: move_(src, dst [, recursive, overwrite]) - - Move files between local and DBFS systems - - .. py:method:: put(path [, contents, overwrite]) - - Upload a file. - - Uploads a file through the use of multipart form post. It is mainly used for streaming uploads, but - can also be used as a convenient single call for data upload. - - Alternatively you can pass contents as base64 string. - - The amount of data that can be passed (when not streaming) using the __contents__ parameter is limited - to 1 MB. `MAX_BLOCK_SIZE_EXCEEDED` will be thrown if this limit is exceeded. - - If you want to upload large files, use the streaming upload. For details, see :method:dbfs/create, - :method:dbfs/addBlock, :method:dbfs/close. - - :param path: str - The path of the new file. The path should be the absolute DBFS path. - :param contents: str (optional) - This parameter might be absent, and instead a posted file will be used. - :param overwrite: bool (optional) - The flag that specifies whether to overwrite existing file/files. - - - - - .. py:method:: read(path [, length, offset]) - - Get the contents of a file. - - Returns the contents of a file. If the file does not exist, this call throws an exception with - `RESOURCE_DOES_NOT_EXIST`. If the path is a directory, the read length is negative, or if the offset - is negative, this call throws an exception with `INVALID_PARAMETER_VALUE`. If the read length exceeds - 1 MB, this call throws an exception with `MAX_READ_SIZE_EXCEEDED`. - - If `offset + length` exceeds the number of bytes in a file, it reads the contents until the end of - file.", - - :param path: str - The path of the file to read. The path should be the absolute DBFS path. - :param length: int (optional) - The number of bytes to read starting from the offset. This has a limit of 1 MB, and a default value - of 0.5 MB. - :param offset: int (optional) - The offset to read from in bytes. - - :returns: :class:`ReadResponse` - - - .. py:method:: upload(path, src [, overwrite]) - - Upload file to DBFS \ No newline at end of file diff --git a/docs/workspace/dbsql_permissions.rst b/docs/workspace/dbsql_permissions.rst deleted file mode 100644 index 4dfc50fb4..000000000 --- a/docs/workspace/dbsql_permissions.rst +++ /dev/null @@ -1,61 +0,0 @@ -ACL / Permissions -================= -.. py:class:: DbsqlPermissionsAPI - - The SQL Permissions API is similar to the endpoints of the :method:permissions/set. However, this exposes - only one endpoint, which gets the Access Control List for a given object. You cannot modify any - permissions using this API. - - There are three levels of permission: - - - `CAN_VIEW`: Allows read-only access - - - `CAN_RUN`: Allows read access and run access (superset of `CAN_VIEW`) - - - `CAN_MANAGE`: Allows all actions: read, run, edit, delete, modify permissions (superset of `CAN_RUN`) - - .. py:method:: get(object_type, object_id) - - Get object ACL. - - Gets a JSON representation of the access control list (ACL) for a specified object. - - :param object_type: :class:`ObjectTypePlural` - The type of object permissions to check. - :param object_id: str - Object ID. An ACL is returned for the object with this UUID. - - :returns: :class:`GetResponse` - - - .. py:method:: set(object_type, object_id [, access_control_list]) - - Set object ACL. - - Sets the access control list (ACL) for a specified object. This operation will complete rewrite the - ACL. - - :param object_type: :class:`ObjectTypePlural` - The type of object permission to set. - :param object_id: str - Object ID. The ACL for the object with this UUID is overwritten by this request's POST content. - :param access_control_list: List[:class:`AccessControl`] (optional) - - :returns: :class:`SetResponse` - - - .. py:method:: transfer_ownership(object_type, object_id [, new_owner]) - - Transfer object ownership. - - Transfers ownership of a dashboard, query, or alert to an active user. Requires an admin API key. - - :param object_type: :class:`OwnableObjectType` - The type of object on which to change ownership. - :param object_id: :class:`TransferOwnershipObjectId` - The ID of the object on which to change ownership. - :param new_owner: str (optional) - Email address for the new owner, who must exist in the workspace. - - :returns: :class:`Success` - \ No newline at end of file diff --git a/docs/workspace/experiments.rst b/docs/workspace/experiments.rst deleted file mode 100644 index d824e742c..000000000 --- a/docs/workspace/experiments.rst +++ /dev/null @@ -1,680 +0,0 @@ -Experiments -=========== -.. py:class:: ExperimentsAPI - - Experiments are the primary unit of organization in MLflow; all MLflow runs belong to an experiment. Each - experiment lets you visualize, search, and compare runs, as well as download run artifacts or metadata for - analysis in other tools. Experiments are maintained in a Databricks hosted MLflow tracking server. - - Experiments are located in the workspace file tree. You manage experiments using the same tools you use to - manage other workspace objects such as folders, notebooks, and libraries. - - .. py:method:: create_experiment(name [, artifact_location, tags]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - experiment = w.experiments.create_experiment(name=f'sdk-{time.time_ns()}') - - # cleanup - w.experiments.delete_experiment(experiment_id=experiment.experiment_id) - - Create experiment. - - Creates an experiment with a name. Returns the ID of the newly created experiment. Validates that - another experiment with the same name does not already exist and fails if another experiment with the - same name already exists. - - Throws `RESOURCE_ALREADY_EXISTS` if a experiment with the given name exists. - - :param name: str - Experiment name. - :param artifact_location: str (optional) - Location where all artifacts for the experiment are stored. If not provided, the remote server will - select an appropriate default. - :param tags: List[:class:`ExperimentTag`] (optional) - A collection of tags to set on the experiment. Maximum tag size and number of tags per request - depends on the storage backend. All storage backends are guaranteed to support tag keys up to 250 - bytes in size and tag values up to 5000 bytes in size. All storage backends are also guaranteed to - support up to 20 tags per request. - - :returns: :class:`CreateExperimentResponse` - - - .. py:method:: create_run( [, experiment_id, start_time, tags, user_id]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - experiment = w.experiments.create_experiment(name=f'sdk-{time.time_ns()}') - - created = w.experiments.create_run(experiment_id=experiment.experiment_id, - tags=[ml.RunTag(key="foo", value="bar")]) - - # cleanup - w.experiments.delete_experiment(experiment_id=experiment.experiment_id) - w.experiments.delete_run(run_id=created.run.info.run_id) - - Create a run. - - Creates a new run within an experiment. A run is usually a single execution of a machine learning or - data ETL pipeline. MLflow uses runs to track the `mlflowParam`, `mlflowMetric` and `mlflowRunTag` - associated with a single execution. - - :param experiment_id: str (optional) - ID of the associated experiment. - :param start_time: int (optional) - Unix timestamp in milliseconds of when the run started. - :param tags: List[:class:`RunTag`] (optional) - Additional metadata for run. - :param user_id: str (optional) - ID of the user executing the run. This field is deprecated as of MLflow 1.0, and will be removed in - a future MLflow release. Use 'mlflow.user' tag instead. - - :returns: :class:`CreateRunResponse` - - - .. py:method:: delete_experiment(experiment_id) - - Delete an experiment. - - Marks an experiment and associated metadata, runs, metrics, params, and tags for deletion. If the - experiment uses FileStore, artifacts associated with experiment are also deleted. - - :param experiment_id: str - ID of the associated experiment. - - - - - .. py:method:: delete_run(run_id) - - Delete a run. - - Marks a run for deletion. - - :param run_id: str - ID of the run to delete. - - - - - .. py:method:: delete_runs(experiment_id, max_timestamp_millis [, max_runs]) - - Delete runs by creation time. - - Bulk delete runs in an experiment that were created prior to or at the specified timestamp. Deletes at - most max_runs per request. - - :param experiment_id: str - The ID of the experiment containing the runs to delete. - :param max_timestamp_millis: int - The maximum creation timestamp in milliseconds since the UNIX epoch for deleting runs. Only runs - created prior to or at this timestamp are deleted. - :param max_runs: int (optional) - An optional positive integer indicating the maximum number of runs to delete. The maximum allowed - value for max_runs is 10000. - - :returns: :class:`DeleteRunsResponse` - - - .. py:method:: delete_tag(run_id, key) - - Delete a tag. - - Deletes a tag on a run. Tags are run metadata that can be updated during a run and after a run - completes. - - :param run_id: str - ID of the run that the tag was logged under. Must be provided. - :param key: str - Name of the tag. Maximum size is 255 bytes. Must be provided. - - - - - .. py:method:: get_by_name(experiment_name) - - Get metadata. - - Gets metadata for an experiment. - - This endpoint will return deleted experiments, but prefers the active experiment if an active and - deleted experiment share the same name. If multiple deleted experiments share the same name, the API - will return one of them. - - Throws `RESOURCE_DOES_NOT_EXIST` if no experiment with the specified name exists. - - :param experiment_name: str - Name of the associated experiment. - - :returns: :class:`GetExperimentResponse` - - - .. py:method:: get_experiment(experiment_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - experiment = w.experiments.create_experiment(name=f'sdk-{time.time_ns()}') - - _ = w.experiments.get_experiment(experiment_id=experiment.experiment_id) - - # cleanup - w.experiments.delete_experiment(experiment_id=experiment.experiment_id) - - Get an experiment. - - Gets metadata for an experiment. This method works on deleted experiments. - - :param experiment_id: str - ID of the associated experiment. - - :returns: :class:`GetExperimentResponse` - - - .. py:method:: get_history(metric_key [, max_results, page_token, run_id, run_uuid]) - - Get history of a given metric within a run. - - Gets a list of all values for the specified metric for a given run. - - :param metric_key: str - Name of the metric. - :param max_results: int (optional) - Maximum number of Metric records to return per paginated request. Default is set to 25,000. If set - higher than 25,000, a request Exception will be raised. - :param page_token: str (optional) - Token indicating the page of metric histories to fetch. - :param run_id: str (optional) - ID of the run from which to fetch metric values. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run from which to fetch metric values. This field will be - removed in a future MLflow version. - - :returns: Iterator over :class:`Metric` - - - .. py:method:: get_permission_levels(experiment_id) - - Get experiment permission levels. - - Gets the permission levels that a user can have on an object. - - :param experiment_id: str - The experiment for which to get or manage permissions. - - :returns: :class:`GetExperimentPermissionLevelsResponse` - - - .. py:method:: get_permissions(experiment_id) - - Get experiment permissions. - - Gets the permissions of an experiment. Experiments can inherit permissions from their root object. - - :param experiment_id: str - The experiment for which to get or manage permissions. - - :returns: :class:`ExperimentPermissions` - - - .. py:method:: get_run(run_id [, run_uuid]) - - Get a run. - - Gets the metadata, metrics, params, and tags for a run. In the case where multiple metrics with the - same key are logged for a run, return only the value with the latest timestamp. - - If there are multiple values with the latest timestamp, return the maximum of these values. - - :param run_id: str - ID of the run to fetch. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run to fetch. This field will be removed in a future - MLflow version. - - :returns: :class:`GetRunResponse` - - - .. py:method:: list_artifacts( [, page_token, path, run_id, run_uuid]) - - Get all artifacts. - - List artifacts for a run. Takes an optional `artifact_path` prefix. If it is specified, the response - contains only artifacts with the specified prefix.", - - :param page_token: str (optional) - Token indicating the page of artifact results to fetch - :param path: str (optional) - Filter artifacts matching this path (a relative path from the root artifact directory). - :param run_id: str (optional) - ID of the run whose artifacts to list. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run whose artifacts to list. This field will be removed - in a future MLflow version. - - :returns: Iterator over :class:`FileInfo` - - - .. py:method:: list_experiments( [, max_results, page_token, view_type]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - all = w.experiments.list_experiments(ml.ListExperimentsRequest()) - - List experiments. - - Gets a list of all experiments. - - :param max_results: int (optional) - Maximum number of experiments desired. If `max_results` is unspecified, return all experiments. If - `max_results` is too large, it'll be automatically capped at 1000. Callers of this endpoint are - encouraged to pass max_results explicitly and leverage page_token to iterate through experiments. - :param page_token: str (optional) - Token indicating the page of experiments to fetch - :param view_type: str (optional) - Qualifier for type of experiments to be returned. If unspecified, return only active experiments. - - :returns: Iterator over :class:`Experiment` - - - .. py:method:: log_batch( [, metrics, params, run_id, tags]) - - Log a batch. - - Logs a batch of metrics, params, and tags for a run. If any data failed to be persisted, the server - will respond with an error (non-200 status code). - - In case of error (due to internal server error or an invalid request), partial data may be written. - - You can write metrics, params, and tags in interleaving fashion, but within a given entity type are - guaranteed to follow the order specified in the request body. - - The overwrite behavior for metrics, params, and tags is as follows: - - * Metrics: metric values are never overwritten. Logging a metric (key, value, timestamp) appends to - the set of values for the metric with the provided key. - - * Tags: tag values can be overwritten by successive writes to the same tag key. That is, if multiple - tag values with the same key are provided in the same API request, the last-provided tag value is - written. Logging the same tag (key, value) is permitted. Specifically, logging a tag is idempotent. - - * Parameters: once written, param values cannot be changed (attempting to overwrite a param value will - result in an error). However, logging the same param (key, value) is permitted. Specifically, logging - a param is idempotent. - - Request Limits ------------------------------- A single JSON-serialized API request may be up to 1 MB - in size and contain: - - * No more than 1000 metrics, params, and tags in total * Up to 1000 metrics * Up to 100 params * Up to - 100 tags - - For example, a valid request might contain 900 metrics, 50 params, and 50 tags, but logging 900 - metrics, 50 params, and 51 tags is invalid. - - The following limits also apply to metric, param, and tag keys and values: - - * Metric keys, param keys, and tag keys can be up to 250 characters in length * Parameter and tag - values can be up to 250 characters in length - - :param metrics: List[:class:`Metric`] (optional) - Metrics to log. A single request can contain up to 1000 metrics, and up to 1000 metrics, params, and - tags in total. - :param params: List[:class:`Param`] (optional) - Params to log. A single request can contain up to 100 params, and up to 1000 metrics, params, and - tags in total. - :param run_id: str (optional) - ID of the run to log under - :param tags: List[:class:`RunTag`] (optional) - Tags to log. A single request can contain up to 100 tags, and up to 1000 metrics, params, and tags - in total. - - - - - .. py:method:: log_inputs( [, datasets, run_id]) - - Log inputs to a run. - - **NOTE:** Experimental: This API may change or be removed in a future release without warning. - - :param datasets: List[:class:`DatasetInput`] (optional) - Dataset inputs - :param run_id: str (optional) - ID of the run to log under - - - - - .. py:method:: log_metric(key, value, timestamp [, run_id, run_uuid, step]) - - Log a metric. - - Logs a metric for a run. A metric is a key-value pair (string key, float value) with an associated - timestamp. Examples include the various metrics that represent ML model accuracy. A metric can be - logged multiple times. - - :param key: str - Name of the metric. - :param value: float - Double value of the metric being logged. - :param timestamp: int - Unix timestamp in milliseconds at the time metric was logged. - :param run_id: str (optional) - ID of the run under which to log the metric. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run under which to log the metric. This field will be - removed in a future MLflow version. - :param step: int (optional) - Step at which to log the metric - - - - - .. py:method:: log_model( [, model_json, run_id]) - - Log a model. - - **NOTE:** Experimental: This API may change or be removed in a future release without warning. - - :param model_json: str (optional) - MLmodel file in json format. - :param run_id: str (optional) - ID of the run to log under - - - - - .. py:method:: log_param(key, value [, run_id, run_uuid]) - - Log a param. - - Logs a param used for a run. A param is a key-value pair (string key, string value). Examples include - hyperparameters used for ML model training and constant dates and values used in an ETL pipeline. A - param can be logged only once for a run. - - :param key: str - Name of the param. Maximum size is 255 bytes. - :param value: str - String value of the param being logged. Maximum size is 500 bytes. - :param run_id: str (optional) - ID of the run under which to log the param. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run under which to log the param. This field will be - removed in a future MLflow version. - - - - - .. py:method:: restore_experiment(experiment_id) - - Restores an experiment. - - Restore an experiment marked for deletion. This also restores associated metadata, runs, metrics, - params, and tags. If experiment uses FileStore, underlying artifacts associated with experiment are - also restored. - - Throws `RESOURCE_DOES_NOT_EXIST` if experiment was never created or was permanently deleted. - - :param experiment_id: str - ID of the associated experiment. - - - - - .. py:method:: restore_run(run_id) - - Restore a run. - - Restores a deleted run. - - :param run_id: str - ID of the run to restore. - - - - - .. py:method:: restore_runs(experiment_id, min_timestamp_millis [, max_runs]) - - Restore runs by deletion time. - - Bulk restore runs in an experiment that were deleted no earlier than the specified timestamp. Restores - at most max_runs per request. - - :param experiment_id: str - The ID of the experiment containing the runs to restore. - :param min_timestamp_millis: int - The minimum deletion timestamp in milliseconds since the UNIX epoch for restoring runs. Only runs - deleted no earlier than this timestamp are restored. - :param max_runs: int (optional) - An optional positive integer indicating the maximum number of runs to restore. The maximum allowed - value for max_runs is 10000. - - :returns: :class:`RestoreRunsResponse` - - - .. py:method:: search_experiments( [, filter, max_results, order_by, page_token, view_type]) - - Search experiments. - - Searches for experiments that satisfy specified search criteria. - - :param filter: str (optional) - String representing a SQL filter condition (e.g. "name ILIKE 'my-experiment%'") - :param max_results: int (optional) - Maximum number of experiments desired. Max threshold is 3000. - :param order_by: List[str] (optional) - List of columns for ordering search results, which can include experiment name and last updated - timestamp with an optional "DESC" or "ASC" annotation, where "ASC" is the default. Tiebreaks are - done by experiment id DESC. - :param page_token: str (optional) - Token indicating the page of experiments to fetch - :param view_type: :class:`SearchExperimentsViewType` (optional) - Qualifier for type of experiments to be returned. If unspecified, return only active experiments. - - :returns: Iterator over :class:`Experiment` - - - .. py:method:: search_runs( [, experiment_ids, filter, max_results, order_by, page_token, run_view_type]) - - Search for runs. - - Searches for runs that satisfy expressions. - - Search expressions can use `mlflowMetric` and `mlflowParam` keys.", - - :param experiment_ids: List[str] (optional) - List of experiment IDs to search over. - :param filter: str (optional) - A filter expression over params, metrics, and tags, that allows returning a subset of runs. The - syntax is a subset of SQL that supports ANDing together binary operations between a param, metric, - or tag and a constant. - - Example: `metrics.rmse < 1 and params.model_class = 'LogisticRegression'` - - You can select columns with special characters (hyphen, space, period, etc.) by using double quotes: - `metrics."model class" = 'LinearRegression' and tags."user-name" = 'Tomas'` - - Supported operators are `=`, `!=`, `>`, `>=`, `<`, and `<=`. - :param max_results: int (optional) - Maximum number of runs desired. Max threshold is 50000 - :param order_by: List[str] (optional) - List of columns to be ordered by, including attributes, params, metrics, and tags with an optional - "DESC" or "ASC" annotation, where "ASC" is the default. Example: ["params.input DESC", - "metrics.alpha ASC", "metrics.rmse"] Tiebreaks are done by start_time DESC followed by run_id for - runs with the same start time (and this is the default ordering criterion if order_by is not - provided). - :param page_token: str (optional) - Token for the current page of runs. - :param run_view_type: :class:`SearchRunsRunViewType` (optional) - Whether to display only active, only deleted, or all runs. Defaults to only active runs. - - :returns: Iterator over :class:`Run` - - - .. py:method:: set_experiment_tag(experiment_id, key, value) - - Set a tag. - - Sets a tag on an experiment. Experiment tags are metadata that can be updated. - - :param experiment_id: str - ID of the experiment under which to log the tag. Must be provided. - :param key: str - Name of the tag. Maximum size depends on storage backend. All storage backends are guaranteed to - support key values up to 250 bytes in size. - :param value: str - String value of the tag being logged. Maximum size depends on storage backend. All storage backends - are guaranteed to support key values up to 5000 bytes in size. - - - - - .. py:method:: set_permissions(experiment_id [, access_control_list]) - - Set experiment permissions. - - Sets permissions on an experiment. Experiments can inherit permissions from their root object. - - :param experiment_id: str - The experiment for which to get or manage permissions. - :param access_control_list: List[:class:`ExperimentAccessControlRequest`] (optional) - - :returns: :class:`ExperimentPermissions` - - - .. py:method:: set_tag(key, value [, run_id, run_uuid]) - - Set a tag. - - Sets a tag on a run. Tags are run metadata that can be updated during a run and after a run completes. - - :param key: str - Name of the tag. Maximum size depends on storage backend. All storage backends are guaranteed to - support key values up to 250 bytes in size. - :param value: str - String value of the tag being logged. Maximum size depends on storage backend. All storage backends - are guaranteed to support key values up to 5000 bytes in size. - :param run_id: str (optional) - ID of the run under which to log the tag. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run under which to log the tag. This field will be - removed in a future MLflow version. - - - - - .. py:method:: update_experiment(experiment_id [, new_name]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - experiment = w.experiments.create_experiment(name=f'sdk-{time.time_ns()}') - - w.experiments.update_experiment(new_name=f'sdk-{time.time_ns()}', experiment_id=experiment.experiment_id) - - # cleanup - w.experiments.delete_experiment(experiment_id=experiment.experiment_id) - - Update an experiment. - - Updates experiment metadata. - - :param experiment_id: str - ID of the associated experiment. - :param new_name: str (optional) - If provided, the experiment's name is changed to the new name. The new name must be unique. - - - - - .. py:method:: update_permissions(experiment_id [, access_control_list]) - - Update experiment permissions. - - Updates the permissions on an experiment. Experiments can inherit permissions from their root object. - - :param experiment_id: str - The experiment for which to get or manage permissions. - :param access_control_list: List[:class:`ExperimentAccessControlRequest`] (optional) - - :returns: :class:`ExperimentPermissions` - - - .. py:method:: update_run( [, end_time, run_id, run_uuid, status]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - experiment = w.experiments.create_experiment(name=f'sdk-{time.time_ns()}') - - created = w.experiments.create_run(experiment_id=experiment.experiment_id, - tags=[ml.RunTag(key="foo", value="bar")]) - - _ = w.experiments.update_run(run_id=created.run.info.run_id, status=ml.UpdateRunStatus.KILLED) - - # cleanup - w.experiments.delete_experiment(experiment_id=experiment.experiment_id) - w.experiments.delete_run(run_id=created.run.info.run_id) - - Update a run. - - Updates run metadata. - - :param end_time: int (optional) - Unix timestamp in milliseconds of when the run ended. - :param run_id: str (optional) - ID of the run to update. Must be provided. - :param run_uuid: str (optional) - [Deprecated, use run_id instead] ID of the run to update.. This field will be removed in a future - MLflow version. - :param status: :class:`UpdateRunStatus` (optional) - Updated status of the run. - - :returns: :class:`UpdateRunResponse` - \ No newline at end of file diff --git a/docs/workspace/external_locations.rst b/docs/workspace/external_locations.rst deleted file mode 100644 index 0bc966b10..000000000 --- a/docs/workspace/external_locations.rst +++ /dev/null @@ -1,200 +0,0 @@ -External Locations -================== -.. py:class:: ExternalLocationsAPI - - An external location is an object that combines a cloud storage path with a storage credential that - authorizes access to the cloud storage path. Each external location is subject to Unity Catalog - access-control policies that control which users and groups can access the credential. If a user does not - have access to an external location in Unity Catalog, the request fails and Unity Catalog does not attempt - to authenticate to your cloud tenant on the user’s behalf. - - Databricks recommends using external locations rather than using storage credentials directly. - - To create external locations, you must be a metastore admin or a user with the - **CREATE_EXTERNAL_LOCATION** privilege. - - .. py:method:: create(name, url, credential_name [, access_point, comment, encryption_details, read_only, skip_validation]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - storage_credential = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]), - comment="created via SDK") - - external_location = w.external_locations.create(name=f'sdk-{time.time_ns()}', - credential_name=storage_credential.name, - comment="created via SDK", - url="s3://" + os.environ["TEST_BUCKET"] + "/" + - f'sdk-{time.time_ns()}') - - Create an external location. - - Creates a new external location entry in the metastore. The caller must be a metastore admin or have - the **CREATE_EXTERNAL_LOCATION** privilege on both the metastore and the associated storage - credential. - - :param name: str - Name of the external location. - :param url: str - Path URL of the external location. - :param credential_name: str - Name of the storage credential used with this location. - :param access_point: str (optional) - The AWS access point to use when accesing s3 for this external location. - :param comment: str (optional) - User-provided free-form text description. - :param encryption_details: :class:`EncryptionDetails` (optional) - Encryption options that apply to clients connecting to cloud storage. - :param read_only: bool (optional) - Indicates whether the external location is read-only. - :param skip_validation: bool (optional) - Skips validation of the storage credential associated with the external location. - - :returns: :class:`ExternalLocationInfo` - - - .. py:method:: delete(name [, force]) - - Delete an external location. - - Deletes the specified external location from the metastore. The caller must be the owner of the - external location. - - :param name: str - Name of the external location. - :param force: bool (optional) - Force deletion even if there are dependent external tables or mounts. - - - - - .. py:method:: get(name) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - credential = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - created = w.external_locations.create(name=f'sdk-{time.time_ns()}', - credential_name=credential.name, - url=f's3://{os.environ["TEST_BUCKET"]}/sdk-{time.time_ns()}') - - _ = w.external_locations.get(get=created.name) - - # cleanup - w.storage_credentials.delete(delete=credential.name) - w.external_locations.delete(delete=created.name) - - Get an external location. - - Gets an external location from the metastore. The caller must be either a metastore admin, the owner - of the external location, or a user that has some privilege on the external location. - - :param name: str - Name of the external location. - - :returns: :class:`ExternalLocationInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.external_locations.list() - - List external locations. - - Gets an array of external locations (__ExternalLocationInfo__ objects) from the metastore. The caller - must be a metastore admin, the owner of the external location, or a user that has some privilege on - the external location. There is no guarantee of a specific ordering of the elements in the array. - - :returns: Iterator over :class:`ExternalLocationInfo` - - - .. py:method:: update(name [, access_point, comment, credential_name, encryption_details, force, owner, read_only, skip_validation, url]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - credential = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - created = w.external_locations.create(name=f'sdk-{time.time_ns()}', - credential_name=credential.name, - url="s3://%s/%s" % (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - _ = w.external_locations.update(name=created.name, - credential_name=credential.name, - url="s3://%s/%s" % (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - # cleanup - w.storage_credentials.delete(name=credential.name) - w.external_locations.delete(name=created.name) - - Update an external location. - - Updates an external location in the metastore. The caller must be the owner of the external location, - or be a metastore admin. In the second case, the admin can only update the name of the external - location. - - :param name: str - Name of the external location. - :param access_point: str (optional) - The AWS access point to use when accesing s3 for this external location. - :param comment: str (optional) - User-provided free-form text description. - :param credential_name: str (optional) - Name of the storage credential used with this location. - :param encryption_details: :class:`EncryptionDetails` (optional) - Encryption options that apply to clients connecting to cloud storage. - :param force: bool (optional) - Force update even if changing url invalidates dependent external tables or mounts. - :param owner: str (optional) - The owner of the external location. - :param read_only: bool (optional) - Indicates whether the external location is read-only. - :param skip_validation: bool (optional) - Skips validation of the storage credential associated with the external location. - :param url: str (optional) - Path URL of the external location. - - :returns: :class:`ExternalLocationInfo` - \ No newline at end of file diff --git a/docs/workspace/functions.rst b/docs/workspace/functions.rst deleted file mode 100644 index e3aa43af2..000000000 --- a/docs/workspace/functions.rst +++ /dev/null @@ -1,100 +0,0 @@ -Functions -========= -.. py:class:: FunctionsAPI - - Functions implement User-Defined Functions (UDFs) in Unity Catalog. - - The function implementation can be any SQL expression or Query, and it can be invoked wherever a table - reference is allowed in a query. In Unity Catalog, a function resides at the same level as a table, so it - can be referenced with the form __catalog_name__.__schema_name__.__function_name__. - - .. py:method:: create(function_info) - - Create a function. - - Creates a new function - - The user must have the following permissions in order for the function to be created: - - **USE_CATALOG** on the function's parent catalog - **USE_SCHEMA** and **CREATE_FUNCTION** on the - function's parent schema - - :param function_info: :class:`CreateFunction` - Partial __FunctionInfo__ specifying the function to be created. - - :returns: :class:`FunctionInfo` - - - .. py:method:: delete(name [, force]) - - Delete a function. - - Deletes the function that matches the supplied name. For the deletion to succeed, the user must - satisfy one of the following conditions: - Is the owner of the function's parent catalog - Is the - owner of the function's parent schema and have the **USE_CATALOG** privilege on its parent catalog - - Is the owner of the function itself and have both the **USE_CATALOG** privilege on its parent catalog - and the **USE_SCHEMA** privilege on its parent schema - - :param name: str - The fully-qualified name of the function (of the form - __catalog_name__.__schema_name__.__function__name__). - :param force: bool (optional) - Force deletion even if the function is notempty. - - - - - .. py:method:: get(name) - - Get a function. - - Gets a function from within a parent catalog and schema. For the fetch to succeed, the user must - satisfy one of the following requirements: - Is a metastore admin - Is an owner of the function's - parent catalog - Have the **USE_CATALOG** privilege on the function's parent catalog and be the owner - of the function - Have the **USE_CATALOG** privilege on the function's parent catalog, the - **USE_SCHEMA** privilege on the function's parent schema, and the **EXECUTE** privilege on the - function itself - - :param name: str - The fully-qualified name of the function (of the form - __catalog_name__.__schema_name__.__function__name__). - - :returns: :class:`FunctionInfo` - - - .. py:method:: list(catalog_name, schema_name) - - List functions. - - List functions within the specified parent catalog and schema. If the user is a metastore admin, all - functions are returned in the output list. Otherwise, the user must have the **USE_CATALOG** privilege - on the catalog and the **USE_SCHEMA** privilege on the schema, and the output list contains only - functions for which either the user has the **EXECUTE** privilege or the user is the owner. There is - no guarantee of a specific ordering of the elements in the array. - - :param catalog_name: str - Name of parent catalog for functions of interest. - :param schema_name: str - Parent schema of functions. - - :returns: Iterator over :class:`FunctionInfo` - - - .. py:method:: update(name [, owner]) - - Update a function. - - Updates the function that matches the supplied name. Only the owner of the function can be updated. If - the user is not a metastore admin, the user must be a member of the group that is the new function - owner. - Is a metastore admin - Is the owner of the function's parent catalog - Is the owner of the - function's parent schema and has the **USE_CATALOG** privilege on its parent catalog - Is the owner of - the function itself and has the **USE_CATALOG** privilege on its parent catalog as well as the - **USE_SCHEMA** privilege on the function's parent schema. - - :param name: str - The fully-qualified name of the function (of the form - __catalog_name__.__schema_name__.__function__name__). - :param owner: str (optional) - Username of current owner of function. - - :returns: :class:`FunctionInfo` - \ No newline at end of file diff --git a/docs/workspace/git_credentials.rst b/docs/workspace/git_credentials.rst deleted file mode 100644 index 9c0eb3e4e..000000000 --- a/docs/workspace/git_credentials.rst +++ /dev/null @@ -1,140 +0,0 @@ -Git Credentials -=============== -.. py:class:: GitCredentialsAPI - - Registers personal access token for Databricks to do operations on behalf of the user. - - See [more info]. - - [more info]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html - - .. py:method:: create(git_provider [, git_username, personal_access_token]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - cr = w.git_credentials.create(git_provider="gitHub", git_username="test", personal_access_token="test") - - # cleanup - w.git_credentials.delete(credential_id=cr.credential_id) - - Create a credential entry. - - Creates a Git credential entry for the user. Only one Git credential per user is supported, so any - attempts to create credentials if an entry already exists will fail. Use the PATCH endpoint to update - existing credentials, or the DELETE endpoint to delete existing credentials. - - :param git_provider: str - Git provider. This field is case-insensitive. The available Git providers are gitHub, - bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, - gitLabEnterpriseEdition and awsCodeCommit. - :param git_username: str (optional) - Git username. - :param personal_access_token: str (optional) - The personal access token used to authenticate to the corresponding Git provider. - - :returns: :class:`CreateCredentialsResponse` - - - .. py:method:: delete(credential_id) - - Delete a credential. - - Deletes the specified Git credential. - - :param credential_id: int - The ID for the corresponding credential to access. - - - - - .. py:method:: get(credential_id) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - cr = w.git_credentials.create(git_provider="gitHub", git_username="test", personal_access_token="test") - - by_id = w.git_credentials.get(credential_id=cr.credential_id) - - # cleanup - w.git_credentials.delete(credential_id=cr.credential_id) - - Get a credential entry. - - Gets the Git credential with the specified credential ID. - - :param credential_id: int - The ID for the corresponding credential to access. - - :returns: :class:`CredentialInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - list = w.git_credentials.list() - - Get Git credentials. - - Lists the calling user's Git credentials. One credential per user is supported. - - :returns: Iterator over :class:`CredentialInfo` - - - .. py:method:: update(credential_id [, git_provider, git_username, personal_access_token]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - cr = w.git_credentials.create(git_provider="gitHub", git_username="test", personal_access_token="test") - - w.git_credentials.update(credential_id=cr.credential_id, - git_provider="gitHub", - git_username=f'sdk-{time.time_ns()}@example.com', - personal_access_token=f'sdk-{time.time_ns()}') - - # cleanup - w.git_credentials.delete(credential_id=cr.credential_id) - - Update a credential. - - Updates the specified Git credential. - - :param credential_id: int - The ID for the corresponding credential to access. - :param git_provider: str (optional) - Git provider. This field is case-insensitive. The available Git providers are gitHub, - bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, - gitLabEnterpriseEdition and awsCodeCommit. - :param git_username: str (optional) - Git username. - :param personal_access_token: str (optional) - The personal access token used to authenticate to the corresponding Git provider. - - - \ No newline at end of file diff --git a/docs/workspace/global_init_scripts.rst b/docs/workspace/global_init_scripts.rst deleted file mode 100644 index 4de04c228..000000000 --- a/docs/workspace/global_init_scripts.rst +++ /dev/null @@ -1,174 +0,0 @@ -Global Init Scripts -=================== -.. py:class:: GlobalInitScriptsAPI - - The Global Init Scripts API enables Workspace administrators to configure global initialization scripts - for their workspace. These scripts run on every node in every cluster in the workspace. - - **Important:** Existing clusters must be restarted to pick up any changes made to global init scripts. - Global init scripts are run in order. If the init script returns with a bad exit code, the Apache Spark - container fails to launch and init scripts with later position are skipped. If enough containers fail, the - entire cluster fails with a `GLOBAL_INIT_SCRIPT_FAILURE` error code. - - .. py:method:: create(name, script [, enabled, position]) - - Usage: - - .. code-block:: - - import base64 - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.global_init_scripts.create(name=f'sdk-{time.time_ns()}', - script=base64.b64encode(("echo 1").encode()).decode(), - enabled=True, - position=10) - - # cleanup - w.global_init_scripts.delete(script_id=created.script_id) - - Create init script. - - Creates a new global init script in this workspace. - - :param name: str - The name of the script - :param script: str - The Base64-encoded content of the script. - :param enabled: bool (optional) - Specifies whether the script is enabled. The script runs only if enabled. - :param position: int (optional) - The position of a global init script, where 0 represents the first script to run, 1 is the second - script to run, in ascending order. - - If you omit the numeric position for a new global init script, it defaults to last position. It will - run after all current scripts. Setting any value greater than the position of the last script is - equivalent to the last position. Example: Take three existing scripts with positions 0, 1, and 2. - Any position of (3) or greater puts the script in the last position. If an explicit position value - conflicts with an existing script value, your request succeeds, but the original script at that - position and all later scripts have their positions incremented by 1. - - :returns: :class:`CreateResponse` - - - .. py:method:: delete(script_id) - - Delete init script. - - Deletes a global init script. - - :param script_id: str - The ID of the global init script. - - - - - .. py:method:: get(script_id) - - Usage: - - .. code-block:: - - import base64 - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.global_init_scripts.create(name=f'sdk-{time.time_ns()}', - script=base64.b64encode(("echo 1").encode()).decode(), - enabled=True, - position=10) - - by_id = w.global_init_scripts.get(script_id=created.script_id) - - # cleanup - w.global_init_scripts.delete(script_id=created.script_id) - - Get an init script. - - Gets all the details of a script, including its Base64-encoded contents. - - :param script_id: str - The ID of the global init script. - - :returns: :class:`GlobalInitScriptDetailsWithContent` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.global_init_scripts.list() - - Get init scripts. - - Get a list of all global init scripts for this workspace. This returns all properties for each script - but **not** the script contents. To retrieve the contents of a script, use the [get a global init - script](#operation/get-script) operation. - - :returns: Iterator over :class:`GlobalInitScriptDetails` - - - .. py:method:: update(script_id, name, script [, enabled, position]) - - Usage: - - .. code-block:: - - import base64 - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.global_init_scripts.create(name=f'sdk-{time.time_ns()}', - script=base64.b64encode(("echo 1").encode()).decode(), - enabled=True, - position=10) - - w.global_init_scripts.update(script_id=created.script_id, - name=f'sdk-{time.time_ns()}', - script=base64.b64encode(("echo 2").encode()).decode()) - - # cleanup - w.global_init_scripts.delete(script_id=created.script_id) - - Update init script. - - Updates a global init script, specifying only the fields to change. All fields are optional. - Unspecified fields retain their current value. - - :param script_id: str - The ID of the global init script. - :param name: str - The name of the script - :param script: str - The Base64-encoded content of the script. - :param enabled: bool (optional) - Specifies whether the script is enabled. The script runs only if enabled. - :param position: int (optional) - The position of a script, where 0 represents the first script to run, 1 is the second script to run, - in ascending order. To move the script to run first, set its position to 0. - - To move the script to the end, set its position to any value greater or equal to the position of the - last script. Example, three existing scripts with positions 0, 1, and 2. Any position value of 2 or - greater puts the script in the last position (2). - - If an explicit position value conflicts with an existing script, your request succeeds, but the - original script at that position and all later scripts have their positions incremented by 1. - - - \ No newline at end of file diff --git a/docs/workspace/grants.rst b/docs/workspace/grants.rst deleted file mode 100644 index 09f2df957..000000000 --- a/docs/workspace/grants.rst +++ /dev/null @@ -1,171 +0,0 @@ -Grants -====== -.. py:class:: GrantsAPI - - In Unity Catalog, data is secure by default. Initially, users have no access to data in a metastore. - Access can be granted by either a metastore admin, the owner of an object, or the owner of the catalog or - schema that contains the object. Securable objects in Unity Catalog are hierarchical and privileges are - inherited downward. - - Securable objects in Unity Catalog are hierarchical and privileges are inherited downward. This means that - granting a privilege on the catalog automatically grants the privilege to all current and future objects - within the catalog. Similarly, privileges granted on a schema are inherited by all current and future - objects within that schema. - - .. py:method:: get(securable_type, full_name [, principal]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - table_name = f'sdk-{time.time_ns()}' - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - _ = w.statement_execution.execute(warehouse_id=os.environ["TEST_DEFAULT_WAREHOUSE_ID"], - catalog=created_catalog.name, - schema=created_schema.name, - statement="CREATE TABLE %s AS SELECT 2+2 as four" % (table_name)).result() - - table_full_name = "%s.%s.%s" % (created_catalog.name, created_schema.name, table_name) - - created_table = w.tables.get(full_name=table_full_name) - - grants = w.grants.get_effective(securable_type=catalog.SecurableType.TABLE, full_name=created_table.full_name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.tables.delete(full_name=table_full_name) - - Get permissions. - - Gets the permissions for a securable. - - :param securable_type: :class:`SecurableType` - Type of securable. - :param full_name: str - Full name of securable. - :param principal: str (optional) - If provided, only the permissions for the specified principal (user or group) are returned. - - :returns: :class:`PermissionsList` - - - .. py:method:: get_effective(securable_type, full_name [, principal]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - table_name = f'sdk-{time.time_ns()}' - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - _ = w.statement_execution.execute(warehouse_id=os.environ["TEST_DEFAULT_WAREHOUSE_ID"], - catalog=created_catalog.name, - schema=created_schema.name, - statement="CREATE TABLE %s AS SELECT 2+2 as four" % (table_name)).result() - - table_full_name = "%s.%s.%s" % (created_catalog.name, created_schema.name, table_name) - - created_table = w.tables.get(full_name=table_full_name) - - grants = w.grants.get_effective(securable_type=catalog.SecurableType.TABLE, full_name=created_table.full_name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.tables.delete(full_name=table_full_name) - - Get effective permissions. - - Gets the effective permissions for a securable. - - :param securable_type: :class:`SecurableType` - Type of securable. - :param full_name: str - Full name of securable. - :param principal: str (optional) - If provided, only the effective permissions for the specified principal (user or group) are - returned. - - :returns: :class:`EffectivePermissionsList` - - - .. py:method:: update(securable_type, full_name [, changes]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - table_name = f'sdk-{time.time_ns()}' - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - _ = w.statement_execution.execute(warehouse_id=os.environ["TEST_DEFAULT_WAREHOUSE_ID"], - catalog=created_catalog.name, - schema=created_schema.name, - statement="CREATE TABLE %s AS SELECT 2+2 as four" % (table_name)).result() - - table_full_name = "%s.%s.%s" % (created_catalog.name, created_schema.name, table_name) - - account_level_group_name = os.environ["TEST_DATA_ENG_GROUP"] - - created_table = w.tables.get(full_name=table_full_name) - - x = w.grants.update(full_name=created_table.full_name, - securable_type=catalog.SecurableType.TABLE, - changes=[ - catalog.PermissionsChange(add=[catalog.Privilege.MODIFY, catalog.Privilege.SELECT], - principal=account_level_group_name) - ]) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.tables.delete(full_name=table_full_name) - - Update permissions. - - Updates the permissions for a securable. - - :param securable_type: :class:`SecurableType` - Type of securable. - :param full_name: str - Full name of securable. - :param changes: List[:class:`PermissionsChange`] (optional) - Array of permissions change objects. - - :returns: :class:`PermissionsList` - \ No newline at end of file diff --git a/docs/workspace/groups.rst b/docs/workspace/groups.rst deleted file mode 100644 index 009e622bb..000000000 --- a/docs/workspace/groups.rst +++ /dev/null @@ -1,180 +0,0 @@ -Groups -====== -.. py:class:: GroupsAPI - - Groups simplify identity management, making it easier to assign access to Databricks workspace, data, and - other securable objects. - - It is best practice to assign access to workspaces and access-control policies in Unity Catalog to groups, - instead of to users individually. All Databricks workspace identities can be assigned as members of - groups, and members inherit permissions that are assigned to their group. - - .. py:method:: create( [, display_name, entitlements, external_id, groups, id, members, meta, roles, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - # cleanup - w.groups.delete(id=group.id) - - Create a new group. - - Creates a group in the Databricks workspace with a unique name, using the supplied group details. - - :param display_name: str (optional) - String that represents a human-readable group name - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the group. See [assigning entitlements] for a full list of supported - values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param id: str (optional) - Databricks group ID - :param members: List[:class:`ComplexValue`] (optional) - :param meta: :class:`ResourceMeta` (optional) - Container for the group identifier. Workspace local versus account. - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`GroupSchema`] (optional) - The schema of the group. - - :returns: :class:`Group` - - - .. py:method:: delete(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - w.groups.delete(id=group.id) - - Delete a group. - - Deletes a group from the Databricks workspace. - - :param id: str - Unique ID for a group in the Databricks workspace. - - - - - .. py:method:: get(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - fetch = w.groups.get(id=group.id) - - # cleanup - w.groups.delete(id=group.id) - - Get group details. - - Gets the information for a specific group in the Databricks workspace. - - :param id: str - Unique ID for a group in the Databricks workspace. - - :returns: :class:`Group` - - - .. py:method:: list( [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - List group details. - - Gets all details of the groups associated with the Databricks workspace. - - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. - :param sort_order: :class:`ListSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: Iterator over :class:`Group` - - - .. py:method:: patch(id [, operations, schemas]) - - Update group details. - - Partially updates the details of a group. - - :param id: str - Unique ID for a group in the Databricks workspace. - :param operations: List[:class:`Patch`] (optional) - :param schemas: List[:class:`PatchSchema`] (optional) - The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - - - - - .. py:method:: update(id [, display_name, entitlements, external_id, groups, members, meta, roles, schemas]) - - Replace a group. - - Updates the details of a group by replacing the entire group entity. - - :param id: str - Databricks group ID - :param display_name: str (optional) - String that represents a human-readable group name - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the group. See [assigning entitlements] for a full list of supported - values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param members: List[:class:`ComplexValue`] (optional) - :param meta: :class:`ResourceMeta` (optional) - Container for the group identifier. Workspace local versus account. - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`GroupSchema`] (optional) - The schema of the group. - - - \ No newline at end of file diff --git a/docs/workspace/index.rst b/docs/workspace/index.rst deleted file mode 100644 index caf3d2f81..000000000 --- a/docs/workspace/index.rst +++ /dev/null @@ -1,21 +0,0 @@ - -Workspace APIs -============== - -These APIs are available from WorkspaceClient - -.. toctree:: - :maxdepth: 1 - - workspace-workspace - workspace-compute - workspace-jobs - workspace-pipelines - workspace-files - workspace-ml - workspace-serving - workspace-iam - workspace-sql - workspace-catalog - workspace-sharing - workspace-settings \ No newline at end of file diff --git a/docs/workspace/instance_pools.rst b/docs/workspace/instance_pools.rst deleted file mode 100644 index b6522396a..000000000 --- a/docs/workspace/instance_pools.rst +++ /dev/null @@ -1,263 +0,0 @@ -Instance Pools -============== -.. py:class:: InstancePoolsAPI - - Instance Pools API are used to create, edit, delete and list instance pools by using ready-to-use cloud - instances which reduces a cluster start and auto-scaling times. - - Databricks pools reduce cluster start and auto-scaling times by maintaining a set of idle, ready-to-use - instances. When a cluster is attached to a pool, cluster nodes are created using the pool’s idle - instances. If the pool has no idle instances, the pool expands by allocating a new instance from the - instance provider in order to accommodate the cluster’s request. When a cluster releases an instance, it - returns to the pool and is free for another cluster to use. Only clusters attached to a pool can use that - pool’s idle instances. - - You can specify a different pool for the driver node and worker nodes, or use the same pool for both. - - Databricks does not charge DBUs while instances are idle in the pool. Instance provider billing does - apply. See pricing. - - .. py:method:: create(instance_pool_name, node_type_id [, aws_attributes, azure_attributes, custom_tags, disk_spec, enable_elastic_disk, gcp_attributes, idle_instance_autotermination_minutes, max_capacity, min_idle_instances, preloaded_docker_images, preloaded_spark_versions]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - smallest = w.clusters.select_node_type(local_disk=True) - - created = w.instance_pools.create(instance_pool_name=f'sdk-{time.time_ns()}', node_type_id=smallest) - - # cleanup - w.instance_pools.delete(instance_pool_id=created.instance_pool_id) - - Create a new instance pool. - - Creates a new instance pool using idle and ready-to-use cloud instances. - - :param instance_pool_name: str - Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 - characters. - :param node_type_id: str - This field encodes, through a single value, the resources available to each of the Spark nodes in - this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute - intensive workloads. A list of available node types can be retrieved by using the - :method:clusters/listNodeTypes API call. - :param aws_attributes: :class:`InstancePoolAwsAttributes` (optional) - Attributes related to instance pools running on Amazon Web Services. If not specified at pool - creation, a set of default values will be used. - :param azure_attributes: :class:`InstancePoolAzureAttributes` (optional) - Attributes related to instance pools running on Azure. If not specified at pool creation, a set of - default values will be used. - :param custom_tags: Dict[str,str] (optional) - Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS instances and - EBS volumes) with these tags in addition to `default_tags`. Notes: - - - Currently, Databricks allows at most 45 custom tags - :param disk_spec: :class:`DiskSpec` (optional) - Defines the specification of the disks that will be attached to all spark containers. - :param enable_elastic_disk: bool (optional) - Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire - additional disk space when its Spark workers are running low on disk space. In AWS, this feature - requires specific AWS permissions to function correctly - refer to the User Guide for more details. - :param gcp_attributes: :class:`InstancePoolGcpAttributes` (optional) - Attributes related to instance pools running on Google Cloud Platform. If not specified at pool - creation, a set of default values will be used. - :param idle_instance_autotermination_minutes: int (optional) - Automatically terminates the extra instances in the pool cache after they are inactive for this time - in minutes if min_idle_instances requirement is already met. If not set, the extra pool instances - will be automatically terminated after a default timeout. If specified, the threshold must be - between 0 and 10000 minutes. Users can also set this value to 0 to instantly remove idle instances - from the cache if min cache size could still hold. - :param max_capacity: int (optional) - Maximum number of outstanding instances to keep in the pool, including both instances used by - clusters and idle instances. Clusters that require further instance provisioning will fail during - upsize requests. - :param min_idle_instances: int (optional) - Minimum number of idle instances to keep in the instance pool - :param preloaded_docker_images: List[:class:`DockerImage`] (optional) - Custom Docker Image BYOC - :param preloaded_spark_versions: List[str] (optional) - A list containing at most one preloaded Spark image version for the pool. Pool-backed clusters - started with the preloaded Spark version will start faster. A list of available Spark versions can - be retrieved by using the :method:clusters/sparkVersions API call. - - :returns: :class:`CreateInstancePoolResponse` - - - .. py:method:: delete(instance_pool_id) - - Delete an instance pool. - - Deletes the instance pool permanently. The idle instances in the pool are terminated asynchronously. - - :param instance_pool_id: str - The instance pool to be terminated. - - - - - .. py:method:: edit(instance_pool_id, instance_pool_name, node_type_id [, custom_tags, idle_instance_autotermination_minutes, max_capacity, min_idle_instances]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - smallest = w.clusters.select_node_type(local_disk=True) - - created = w.instance_pools.create(instance_pool_name=f'sdk-{time.time_ns()}', node_type_id=smallest) - - w.instance_pools.edit(instance_pool_id=created.instance_pool_id, - instance_pool_name=f'sdk-{time.time_ns()}', - node_type_id=smallest) - - # cleanup - w.instance_pools.delete(instance_pool_id=created.instance_pool_id) - - Edit an existing instance pool. - - Modifies the configuration of an existing instance pool. - - :param instance_pool_id: str - Instance pool ID - :param instance_pool_name: str - Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 - characters. - :param node_type_id: str - This field encodes, through a single value, the resources available to each of the Spark nodes in - this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute - intensive workloads. A list of available node types can be retrieved by using the - :method:clusters/listNodeTypes API call. - :param custom_tags: Dict[str,str] (optional) - Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS instances and - EBS volumes) with these tags in addition to `default_tags`. Notes: - - - Currently, Databricks allows at most 45 custom tags - :param idle_instance_autotermination_minutes: int (optional) - Automatically terminates the extra instances in the pool cache after they are inactive for this time - in minutes if min_idle_instances requirement is already met. If not set, the extra pool instances - will be automatically terminated after a default timeout. If specified, the threshold must be - between 0 and 10000 minutes. Users can also set this value to 0 to instantly remove idle instances - from the cache if min cache size could still hold. - :param max_capacity: int (optional) - Maximum number of outstanding instances to keep in the pool, including both instances used by - clusters and idle instances. Clusters that require further instance provisioning will fail during - upsize requests. - :param min_idle_instances: int (optional) - Minimum number of idle instances to keep in the instance pool - - - - - .. py:method:: get(instance_pool_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - smallest = w.clusters.select_node_type(local_disk=True) - - created = w.instance_pools.create(instance_pool_name=f'sdk-{time.time_ns()}', node_type_id=smallest) - - by_id = w.instance_pools.get(instance_pool_id=created.instance_pool_id) - - # cleanup - w.instance_pools.delete(instance_pool_id=created.instance_pool_id) - - Get instance pool information. - - Retrieve the information for an instance pool based on its identifier. - - :param instance_pool_id: str - The canonical unique identifier for the instance pool. - - :returns: :class:`GetInstancePool` - - - .. py:method:: get_permission_levels(instance_pool_id) - - Get instance pool permission levels. - - Gets the permission levels that a user can have on an object. - - :param instance_pool_id: str - The instance pool for which to get or manage permissions. - - :returns: :class:`GetInstancePoolPermissionLevelsResponse` - - - .. py:method:: get_permissions(instance_pool_id) - - Get instance pool permissions. - - Gets the permissions of an instance pool. Instance pools can inherit permissions from their root - object. - - :param instance_pool_id: str - The instance pool for which to get or manage permissions. - - :returns: :class:`InstancePoolPermissions` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.instance_pools.list() - - List instance pool info. - - Gets a list of instance pools with their statistics. - - :returns: Iterator over :class:`InstancePoolAndStats` - - - .. py:method:: set_permissions(instance_pool_id [, access_control_list]) - - Set instance pool permissions. - - Sets permissions on an instance pool. Instance pools can inherit permissions from their root object. - - :param instance_pool_id: str - The instance pool for which to get or manage permissions. - :param access_control_list: List[:class:`InstancePoolAccessControlRequest`] (optional) - - :returns: :class:`InstancePoolPermissions` - - - .. py:method:: update_permissions(instance_pool_id [, access_control_list]) - - Update instance pool permissions. - - Updates the permissions on an instance pool. Instance pools can inherit permissions from their root - object. - - :param instance_pool_id: str - The instance pool for which to get or manage permissions. - :param access_control_list: List[:class:`InstancePoolAccessControlRequest`] (optional) - - :returns: :class:`InstancePoolPermissions` - \ No newline at end of file diff --git a/docs/workspace/instance_profiles.rst b/docs/workspace/instance_profiles.rst deleted file mode 100644 index b67b63a66..000000000 --- a/docs/workspace/instance_profiles.rst +++ /dev/null @@ -1,139 +0,0 @@ -Instance Profiles -================= -.. py:class:: InstanceProfilesAPI - - The Instance Profiles API allows admins to add, list, and remove instance profiles that users can launch - clusters with. Regular users can list the instance profiles available to them. See [Secure access to S3 - buckets] using instance profiles for more information. - - [Secure access to S3 buckets]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/instance-profiles.html - - .. py:method:: add(instance_profile_arn [, iam_role_arn, is_meta_instance_profile, skip_validation]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - arn = "arn:aws:iam::000000000000:instance-profile/abc" - - w.instance_profiles.add(instance_profile_arn=arn, - skip_validation=True, - iam_role_arn="arn:aws:iam::000000000000:role/bcd") - - Register an instance profile. - - In the UI, you can select the instance profile when launching clusters. This API is only available to - admin users. - - :param instance_profile_arn: str - The AWS ARN of the instance profile to register with Databricks. This field is required. - :param iam_role_arn: str (optional) - The AWS IAM role ARN of the role associated with the instance profile. This field is required if - your role name and instance profile name do not match and you want to use the instance profile with - [Databricks SQL Serverless]. - - Otherwise, this field is optional. - - [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html - :param is_meta_instance_profile: bool (optional) - Boolean flag indicating whether the instance profile should only be used in credential passthrough - scenarios. If true, it means the instance profile contains an meta IAM role which could assume a - wide range of roles. Therefore it should always be used with authorization. This field is optional, - the default value is `false`. - :param skip_validation: bool (optional) - By default, Databricks validates that it has sufficient permissions to launch instances with the - instance profile. This validation uses AWS dry-run mode for the RunInstances API. If validation - fails with an error message that does not indicate an IAM related permission issue, (e.g. “Your - requested instance type is not supported in your requested availability zone”), you can pass this - flag to skip the validation and forcibly add the instance profile. - - - - - .. py:method:: edit(instance_profile_arn [, iam_role_arn, is_meta_instance_profile]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - arn = "arn:aws:iam::000000000000:instance-profile/abc" - - w.instance_profiles.edit(instance_profile_arn=arn, iam_role_arn="arn:aws:iam::000000000000:role/bcdf") - - Edit an instance profile. - - The only supported field to change is the optional IAM role ARN associated with the instance profile. - It is required to specify the IAM role ARN if both of the following are true: - - * Your role name and instance profile name do not match. The name is the part after the last slash in - each ARN. * You want to use the instance profile with [Databricks SQL Serverless]. - - To understand where these fields are in the AWS console, see [Enable serverless SQL warehouses]. - - This API is only available to admin users. - - [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html - [Enable serverless SQL warehouses]: https://docs.databricks.com/sql/admin/serverless.html - - :param instance_profile_arn: str - The AWS ARN of the instance profile to register with Databricks. This field is required. - :param iam_role_arn: str (optional) - The AWS IAM role ARN of the role associated with the instance profile. This field is required if - your role name and instance profile name do not match and you want to use the instance profile with - [Databricks SQL Serverless]. - - Otherwise, this field is optional. - - [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html - :param is_meta_instance_profile: bool (optional) - Boolean flag indicating whether the instance profile should only be used in credential passthrough - scenarios. If true, it means the instance profile contains an meta IAM role which could assume a - wide range of roles. Therefore it should always be used with authorization. This field is optional, - the default value is `false`. - - - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.instance_profiles.list() - - List available instance profiles. - - List the instance profiles that the calling user can use to launch a cluster. - - This API is available to all users. - - :returns: Iterator over :class:`InstanceProfile` - - - .. py:method:: remove(instance_profile_arn) - - Remove the instance profile. - - Remove the instance profile with the provided ARN. Existing clusters with this instance profile will - continue to function. - - This API is only accessible to admin users. - - :param instance_profile_arn: str - The ARN of the instance profile to remove. This field is required. - - - \ No newline at end of file diff --git a/docs/workspace/ip_access_lists.rst b/docs/workspace/ip_access_lists.rst deleted file mode 100644 index 181dc71d7..000000000 --- a/docs/workspace/ip_access_lists.rst +++ /dev/null @@ -1,230 +0,0 @@ -IP Access Lists -=============== -.. py:class:: IpAccessListsAPI - - IP Access List enables admins to configure IP access lists. - - IP access lists affect web application access and REST API access to this workspace only. If the feature - is disabled for a workspace, all access is allowed for this workspace. There is support for allow lists - (inclusion) and block lists (exclusion). - - When a connection is attempted: 1. **First, all block lists are checked.** If the connection IP address - matches any block list, the connection is rejected. 2. **If the connection was not rejected by block - lists**, the IP address is compared with the allow lists. - - If there is at least one allow list for the workspace, the connection is allowed only if the IP address - matches an allow list. If there are no allow lists for the workspace, all IP addresses are allowed. - - For all allow lists and block lists combined, the workspace supports a maximum of 1000 IP/CIDR values, - where one CIDR counts as a single value. - - After changes to the IP access list feature, it can take a few minutes for changes to take effect. - - .. py:method:: create(label, list_type, ip_addresses) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - created = w.ip_access_lists.create(label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/16"], - list_type=settings.ListType.BLOCK) - - # cleanup - w.ip_access_lists.delete(ip_access_list_id=created.ip_access_list.list_id) - - Create access list. - - Creates an IP access list for this workspace. - - A list can be an allow list or a block list. See the top of this file for a description of how the - server treats allow lists and block lists at runtime. - - When creating or updating an IP access list: - - * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, - where one CIDR counts as a single value. Attempts to exceed that number return error 400 with - `error_code` value `QUOTA_EXCEEDED`. * If the new list would block the calling user's current IP, - error 400 is returned with `error_code` value `INVALID_STATE`. - - It can take a few minutes for the changes to take effect. **Note**: Your new IP access list has no - effect until you enable the feature. See :method:workspaceconf/setStatus - - :param label: str - Label for the IP access list. This **cannot** be empty. - :param list_type: :class:`ListType` - Type of IP access list. Valid values are as follows and are case-sensitive: - - * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - :param ip_addresses: List[str] - Array of IP addresses or CIDR values to be added to the IP access list. - - :returns: :class:`CreateIpAccessListResponse` - - - .. py:method:: delete(ip_access_list_id) - - Delete access list. - - Deletes an IP access list, specified by its list ID. - - :param ip_access_list_id: str - The ID for the corresponding IP access list to modify. - - - - - .. py:method:: get(ip_access_list_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - created = w.ip_access_lists.create(label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/16"], - list_type=settings.ListType.BLOCK) - - by_id = w.ip_access_lists.get(ip_access_list_id=created.ip_access_list.list_id) - - # cleanup - w.ip_access_lists.delete(ip_access_list_id=created.ip_access_list.list_id) - - Get access list. - - Gets an IP access list, specified by its list ID. - - :param ip_access_list_id: str - The ID for the corresponding IP access list to modify. - - :returns: :class:`FetchIpAccessListResponse` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.ip_access_lists.list() - - Get access lists. - - Gets all IP access lists for the specified workspace. - - :returns: Iterator over :class:`IpAccessListInfo` - - - .. py:method:: replace(ip_access_list_id, label, list_type, ip_addresses, enabled [, list_id]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - created = w.ip_access_lists.create(label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/16"], - list_type=settings.ListType.BLOCK) - - w.ip_access_lists.replace(ip_access_list_id=created.ip_access_list.list_id, - label=f'sdk-{time.time_ns()}', - ip_addresses=["1.0.0.0/24"], - list_type=settings.ListType.BLOCK, - enabled=False) - - # cleanup - w.ip_access_lists.delete(ip_access_list_id=created.ip_access_list.list_id) - - Replace access list. - - Replaces an IP access list, specified by its ID. - - A list can include allow lists and block lists. See the top of this file for a description of how the - server treats allow lists and block lists at run time. When replacing an IP access list: * For all - allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, where one - CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code` value - `QUOTA_EXCEEDED`. * If the resulting list would block the calling user's current IP, error 400 is - returned with `error_code` value `INVALID_STATE`. It can take a few minutes for the changes to take - effect. Note that your resulting IP access list has no effect until you enable the feature. See - :method:workspaceconf/setStatus. - - :param ip_access_list_id: str - The ID for the corresponding IP access list to modify. - :param label: str - Label for the IP access list. This **cannot** be empty. - :param list_type: :class:`ListType` - Type of IP access list. Valid values are as follows and are case-sensitive: - - * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - :param ip_addresses: List[str] - Array of IP addresses or CIDR values to be added to the IP access list. - :param enabled: bool - Specifies whether this IP access list is enabled. - :param list_id: str (optional) - Universally unique identifier (UUID) of the IP access list. - - - - - .. py:method:: update(ip_access_list_id, label, list_type, ip_addresses, enabled [, list_id]) - - Update access list. - - Updates an existing IP access list, specified by its ID. - - A list can include allow lists and block lists. See the top of this file for a description of how the - server treats allow lists and block lists at run time. - - When updating an IP access list: - - * For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, - where one CIDR counts as a single value. Attempts to exceed that number return error 400 with - `error_code` value `QUOTA_EXCEEDED`. * If the updated list would block the calling user's current IP, - error 400 is returned with `error_code` value `INVALID_STATE`. - - It can take a few minutes for the changes to take effect. Note that your resulting IP access list has - no effect until you enable the feature. See :method:workspaceconf/setStatus. - - :param ip_access_list_id: str - The ID for the corresponding IP access list to modify. - :param label: str - Label for the IP access list. This **cannot** be empty. - :param list_type: :class:`ListType` - Type of IP access list. Valid values are as follows and are case-sensitive: - - * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - :param ip_addresses: List[str] - Array of IP addresses or CIDR values to be added to the IP access list. - :param enabled: bool - Specifies whether this IP access list is enabled. - :param list_id: str (optional) - Universally unique identifier (UUID) of the IP access list. - - - \ No newline at end of file diff --git a/docs/workspace/jobs.rst b/docs/workspace/jobs.rst deleted file mode 100644 index a0fd97a9b..000000000 --- a/docs/workspace/jobs.rst +++ /dev/null @@ -1,1065 +0,0 @@ -Jobs -==== -.. py:class:: JobsAPI - - The Jobs API allows you to create, edit, and delete jobs. - - You can use a Databricks job to run a data processing or data analysis task in a Databricks cluster with - scalable resources. Your job can consist of a single task or can be a large, multi-task workflow with - complex dependencies. Databricks manages the task orchestration, cluster management, monitoring, and error - reporting for all of your jobs. You can run your jobs immediately or periodically through an easy-to-use - scheduling system. You can implement job tasks using notebooks, JARS, Delta Live Tables pipelines, or - Python, Scala, Spark submit, and Java applications. - - You should never hard code secrets or store them in plain text. Use the [Secrets CLI] to manage secrets in - the [Databricks CLI]. Use the [Secrets utility] to reference secrets in notebooks and jobs. - - [Databricks CLI]: https://docs.databricks.com/dev-tools/cli/index.html - [Secrets CLI]: https://docs.databricks.com/dev-tools/cli/secrets-cli.html - [Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets - - .. py:method:: cancel_all_runs( [, all_queued_runs, job_id]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - w.jobs.cancel_all_runs(job_id=created_job.job_id) - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Cancel all runs of a job. - - Cancels all active runs of a job. The runs are canceled asynchronously, so it doesn't prevent new runs - from being started. - - :param all_queued_runs: bool (optional) - Optional boolean parameter to cancel all queued runs. If no job_id is provided, all queued runs in - the workspace are canceled. - :param job_id: int (optional) - The canonical identifier of the job to cancel all runs of. - - - - - .. py:method:: cancel_run(run_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - run_now_response = w.jobs.run_now(job_id=created_job.job_id) - - cancelled_run = w.jobs.cancel_run(run_id=run_now_response.response.run_id).result() - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Cancel a run. - - Cancels a job run or a task run. The run is canceled asynchronously, so it may still be running when - this request completes. - - :param run_id: int - This field is required. - - :returns: - Long-running operation waiter for :class:`Run`. - See :method:wait_get_run_job_terminated_or_skipped for more details. - - - .. py:method:: create( [, access_control_list, compute, continuous, deployment, description, edit_mode, email_notifications, format, git_source, health, job_clusters, max_concurrent_runs, name, notification_settings, parameters, queue, run_as, schedule, tags, tasks, timeout_seconds, trigger, webhook_notifications]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Create a new job. - - Create a new job. - - :param access_control_list: List[:class:`AccessControlRequest`] (optional) - List of permissions to set on the job. - :param compute: List[:class:`JobCompute`] (optional) - A list of compute requirements that can be referenced by tasks of this job. - :param continuous: :class:`Continuous` (optional) - An optional continuous property for this job. The continuous property will ensure that there is - always one run executing. Only one of `schedule` and `continuous` can be used. - :param deployment: :class:`JobDeployment` (optional) - Deployment information for jobs managed by external sources. - :param description: str (optional) - An optional description for the job. The maximum length is 1024 characters in UTF-8 encoding. - :param edit_mode: :class:`CreateJobEditMode` (optional) - Edit mode of the job. - - * `UI_LOCKED`: The job is in a locked UI state and cannot be modified. * `EDITABLE`: The job is in - an editable state and can be modified. - :param email_notifications: :class:`JobEmailNotifications` (optional) - An optional set of email addresses that is notified when runs of this job begin or complete as well - as when this job is deleted. - :param format: :class:`Format` (optional) - Used to tell what is the format of the job. This field is ignored in Create/Update/Reset calls. When - using the Jobs API 2.1 this value is always set to `"MULTI_TASK"`. - :param git_source: :class:`GitSource` (optional) - An optional specification for a remote Git repository containing the source code used by tasks. - Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. - - If `git_source` is set, these tasks retrieve the file from the remote repository by default. - However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. - - Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks are - used, `git_source` must be defined on the job. - :param health: :class:`JobsHealthRules` (optional) - An optional set of health rules that can be defined for this job. - :param job_clusters: List[:class:`JobCluster`] (optional) - A list of job cluster specifications that can be shared and reused by tasks of this job. Libraries - cannot be declared in a shared job cluster. You must declare dependent libraries in task settings. - :param max_concurrent_runs: int (optional) - An optional maximum allowed number of concurrent runs of the job. - - Set this value if you want to be able to execute multiple runs of the same job concurrently. This is - useful for example if you trigger your job on a frequent schedule and want to allow consecutive runs - to overlap with each other, or if you want to trigger multiple runs which differ by their input - parameters. - - This setting affects only new runs. For example, suppose the job’s concurrency is 4 and there are - 4 concurrent active runs. Then setting the concurrency to 3 won’t kill any of the active runs. - However, from then on, new runs are skipped unless there are fewer than 3 active runs. - - This value cannot exceed 1000. Setting this value to `0` causes all new runs to be skipped. - :param name: str (optional) - An optional name for the job. The maximum length is 4096 bytes in UTF-8 encoding. - :param notification_settings: :class:`JobNotificationSettings` (optional) - Optional notification settings that are used when sending notifications to each of the - `email_notifications` and `webhook_notifications` for this job. - :param parameters: List[:class:`JobParameterDefinition`] (optional) - Job-level parameter definitions - :param queue: :class:`QueueSettings` (optional) - The queue settings of the job. - :param run_as: :class:`JobRunAs` (optional) - Write-only setting, available only in Create/Update/Reset and Submit calls. Specifies the user or - service principal that the job runs as. If not specified, the job runs as the user who created the - job. - - Only `user_name` or `service_principal_name` can be specified. If both are specified, an error is - thrown. - :param schedule: :class:`CronSchedule` (optional) - An optional periodic schedule for this job. The default behavior is that the job only runs when - triggered by clicking “Run Now” in the Jobs UI or sending an API request to `runNow`. - :param tags: Dict[str,str] (optional) - A map of tags associated with the job. These are forwarded to the cluster as cluster tags for jobs - clusters, and are subject to the same limitations as cluster tags. A maximum of 25 tags can be added - to the job. - :param tasks: List[:class:`Task`] (optional) - A list of task specifications to be executed by this job. - :param timeout_seconds: int (optional) - An optional timeout applied to each run of this job. A value of `0` means no timeout. - :param trigger: :class:`TriggerSettings` (optional) - Trigger settings for the job. Can be used to trigger a run when new files arrive in an external - location. The default behavior is that the job runs only when triggered by clicking “Run Now” in - the Jobs UI or sending an API request to `runNow`. - :param webhook_notifications: :class:`WebhookNotifications` (optional) - A collection of system notification IDs to notify when runs of this job begin or complete. - - :returns: :class:`CreateResponse` - - - .. py:method:: delete(job_id) - - Delete a job. - - Deletes a job. - - :param job_id: int - The canonical identifier of the job to delete. This field is required. - - - - - .. py:method:: delete_run(run_id) - - Delete a job run. - - Deletes a non-active run. Returns an error if the run is active. - - :param run_id: int - The canonical identifier of the run for which to retrieve the metadata. - - - - - .. py:method:: export_run(run_id [, views_to_export]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - run_by_id = w.jobs.run_now(job_id=created_job.job_id).result() - - exported_view = w.jobs.export_run(run_id=run_by_id.tasks[0].run_id, views_to_export="CODE") - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Export and retrieve a job run. - - Export and retrieve the job run task. - - :param run_id: int - The canonical identifier for the run. This field is required. - :param views_to_export: :class:`ViewsToExport` (optional) - Which views to export (CODE, DASHBOARDS, or ALL). Defaults to CODE. - - :returns: :class:`ExportRunOutput` - - - .. py:method:: get(job_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - run = w.jobs.submit(run_name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.SubmitTask(existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key=f'sdk-{time.time_ns()}') - ]).result() - - output = w.jobs.get_run_output(run_id=run.tasks[0].run_id) - - # cleanup - w.jobs.delete_run(run_id=run.run_id) - - Get a single job. - - Retrieves the details for a single job. - - :param job_id: int - The canonical identifier of the job to retrieve information about. This field is required. - - :returns: :class:`Job` - - - .. py:method:: get_permission_levels(job_id) - - Get job permission levels. - - Gets the permission levels that a user can have on an object. - - :param job_id: str - The job for which to get or manage permissions. - - :returns: :class:`GetJobPermissionLevelsResponse` - - - .. py:method:: get_permissions(job_id) - - Get job permissions. - - Gets the permissions of a job. Jobs can inherit permissions from their root object. - - :param job_id: str - The job for which to get or manage permissions. - - :returns: :class:`JobPermissions` - - - .. py:method:: get_run(run_id [, include_history, include_resolved_values]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - run = w.jobs.submit(run_name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.SubmitTask(existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key=f'sdk-{time.time_ns()}') - ]).result() - - output = w.jobs.get_run_output(run_id=run.tasks[0].run_id) - - # cleanup - w.jobs.delete_run(run_id=run.run_id) - - Get a single job run. - - Retrieve the metadata of a run. - - :param run_id: int - The canonical identifier of the run for which to retrieve the metadata. This field is required. - :param include_history: bool (optional) - Whether to include the repair history in the response. - :param include_resolved_values: bool (optional) - Whether to include resolved parameter values in the response. - - :returns: :class:`Run` - - - .. py:method:: get_run_output(run_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - run = w.jobs.submit(run_name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.SubmitTask(existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key=f'sdk-{time.time_ns()}') - ]).result() - - output = w.jobs.get_run_output(run_id=run.tasks[0].run_id) - - # cleanup - w.jobs.delete_run(run_id=run.run_id) - - Get the output for a single run. - - Retrieve the output and metadata of a single task run. When a notebook task returns a value through - the `dbutils.notebook.exit()` call, you can use this endpoint to retrieve that value. Databricks - restricts this API to returning the first 5 MB of the output. To return a larger result, you can store - job results in a cloud storage service. - - This endpoint validates that the __run_id__ parameter is valid and returns an HTTP status code 400 if - the __run_id__ parameter is invalid. Runs are automatically removed after 60 days. If you to want to - reference them beyond 60 days, you must save old run results before they expire. - - :param run_id: int - The canonical identifier for the run. This field is required. - - :returns: :class:`RunOutput` - - - .. py:method:: list( [, expand_tasks, limit, name, offset, page_token]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - run_list = w.jobs.list_runs(job_id=created_job.job_id) - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - List jobs. - - Retrieves a list of jobs. - - :param expand_tasks: bool (optional) - Whether to include task and cluster details in the response. - :param limit: int (optional) - The number of jobs to return. This value must be greater than 0 and less or equal to 100. The - default value is 20. - :param name: str (optional) - A filter on the list based on the exact (case insensitive) job name. - :param offset: int (optional) - The offset of the first job to return, relative to the most recently created job. - - Deprecated since June 2023. Use `page_token` to iterate through the pages instead. - :param page_token: str (optional) - Use `next_page_token` or `prev_page_token` returned from the previous request to list the next or - previous page of jobs respectively. - - :returns: Iterator over :class:`BaseJob` - - - .. py:method:: list_runs( [, active_only, completed_only, expand_tasks, job_id, limit, offset, page_token, run_type, start_time_from, start_time_to]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - run_list = w.jobs.list_runs(job_id=created_job.job_id) - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - List job runs. - - List runs in descending order by start time. - - :param active_only: bool (optional) - If active_only is `true`, only active runs are included in the results; otherwise, lists both active - and completed runs. An active run is a run in the `QUEUED`, `PENDING`, `RUNNING`, or `TERMINATING`. - This field cannot be `true` when completed_only is `true`. - :param completed_only: bool (optional) - If completed_only is `true`, only completed runs are included in the results; otherwise, lists both - active and completed runs. This field cannot be `true` when active_only is `true`. - :param expand_tasks: bool (optional) - Whether to include task and cluster details in the response. - :param job_id: int (optional) - The job for which to list runs. If omitted, the Jobs service lists runs from all jobs. - :param limit: int (optional) - The number of runs to return. This value must be greater than 0 and less than 25. The default value - is 20. If a request specifies a limit of 0, the service instead uses the maximum limit. - :param offset: int (optional) - The offset of the first run to return, relative to the most recent run. - - Deprecated since June 2023. Use `page_token` to iterate through the pages instead. - :param page_token: str (optional) - Use `next_page_token` or `prev_page_token` returned from the previous request to list the next or - previous page of runs respectively. - :param run_type: :class:`ListRunsRunType` (optional) - The type of runs to return. For a description of run types, see :method:jobs/getRun. - :param start_time_from: int (optional) - Show runs that started _at or after_ this value. The value must be a UTC timestamp in milliseconds. - Can be combined with _start_time_to_ to filter by a time range. - :param start_time_to: int (optional) - Show runs that started _at or before_ this value. The value must be a UTC timestamp in milliseconds. - Can be combined with _start_time_from_ to filter by a time range. - - :returns: Iterator over :class:`BaseRun` - - - .. py:method:: repair_run(run_id [, dbt_commands, jar_params, job_parameters, latest_repair_id, notebook_params, pipeline_params, python_named_params, python_params, rerun_all_failed_tasks, rerun_dependent_tasks, rerun_tasks, spark_submit_params, sql_params]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - run_now_response = w.jobs.run_now(job_id=created_job.job_id) - - cancelled_run = w.jobs.cancel_run(run_id=run_now_response.response.run_id).result() - - repaired_run = w.jobs.repair_run(rerun_tasks=[cancelled_run.tasks[0].task_key], - run_id=run_now_response.response.run_id).result() - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Repair a job run. - - Re-run one or more tasks. Tasks are re-run as part of the original job run. They use the current job - and task settings, and can be viewed in the history for the original job run. - - :param run_id: int - The job run ID of the run to repair. The run must not be in progress. - :param dbt_commands: List[str] (optional) - An array of commands to execute for jobs with the dbt task, for example `"dbt_commands": ["dbt - deps", "dbt seed", "dbt run"]` - :param jar_params: List[str] (optional) - A list of parameters for jobs with Spark JAR tasks, for example `"jar_params": ["john doe", "35"]`. - The parameters are used to invoke the main function of the main class specified in the Spark JAR - task. If not specified upon `run-now`, it defaults to an empty list. jar_params cannot be specified - in conjunction with notebook_params. The JSON representation of this field (for example - `{"jar_params":["john doe","35"]}`) cannot exceed 10,000 bytes. - - Use [Task parameter variables](/jobs.html"#parameter-variables") to set parameters containing - information about job runs. - :param job_parameters: Dict[str,str] (optional) - Job-level parameters used in the run. for example `"param": "overriding_val"` - :param latest_repair_id: int (optional) - The ID of the latest repair. This parameter is not required when repairing a run for the first time, - but must be provided on subsequent requests to repair the same run. - :param notebook_params: Dict[str,str] (optional) - A map from keys to values for jobs with notebook task, for example `"notebook_params": {"name": - "john doe", "age": "35"}`. The map is passed to the notebook and is accessible through the - [dbutils.widgets.get] function. - - If not specified upon `run-now`, the triggered run uses the job’s base parameters. - - notebook_params cannot be specified in conjunction with jar_params. - - Use [Task parameter variables] to set parameters containing information about job runs. - - The JSON representation of this field (for example `{"notebook_params":{"name":"john - doe","age":"35"}}`) cannot exceed 10,000 bytes. - - [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - :param pipeline_params: :class:`PipelineParams` (optional) - :param python_named_params: Dict[str,str] (optional) - A map from keys to values for jobs with Python wheel task, for example `"python_named_params": - {"name": "task", "data": "dbfs:/path/to/data.json"}`. - :param python_params: List[str] (optional) - A list of parameters for jobs with Python tasks, for example `"python_params": ["john doe", "35"]`. - The parameters are passed to Python file as command-line parameters. If specified upon `run-now`, it - would overwrite the parameters specified in job setting. The JSON representation of this field (for - example `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. - - Use [Task parameter variables] to set parameters containing information about job runs. - - Important - - These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters - returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and - emojis. - - [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - :param rerun_all_failed_tasks: bool (optional) - If true, repair all failed tasks. Only one of `rerun_tasks` or `rerun_all_failed_tasks` can be used. - :param rerun_dependent_tasks: bool (optional) - If true, repair all tasks that depend on the tasks in `rerun_tasks`, even if they were previously - successful. Can be also used in combination with `rerun_all_failed_tasks`. - :param rerun_tasks: List[str] (optional) - The task keys of the task runs to repair. - :param spark_submit_params: List[str] (optional) - A list of parameters for jobs with spark submit task, for example `"spark_submit_params": - ["--class", "org.apache.spark.examples.SparkPi"]`. The parameters are passed to spark-submit script - as command-line parameters. If specified upon `run-now`, it would overwrite the parameters specified - in job setting. The JSON representation of this field (for example `{"python_params":["john - doe","35"]}`) cannot exceed 10,000 bytes. - - Use [Task parameter variables] to set parameters containing information about job runs - - Important - - These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters - returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and - emojis. - - [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - :param sql_params: Dict[str,str] (optional) - A map from keys to values for jobs with SQL task, for example `"sql_params": {"name": "john doe", - "age": "35"}`. The SQL alert task does not support custom parameters. - - :returns: - Long-running operation waiter for :class:`Run`. - See :method:wait_get_run_job_terminated_or_skipped for more details. - - - .. py:method:: reset(job_id, new_settings) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - new_name = f'sdk-{time.time_ns()}' - - by_id = w.jobs.get(job_id=created_job.job_id) - - w.jobs.reset(job_id=by_id.job_id, new_settings=jobs.JobSettings(name=new_name, tasks=by_id.settings.tasks)) - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Overwrite all settings for a job. - - Overwrite all settings for the given job. Use the Update endpoint to update job settings partially. - - :param job_id: int - The canonical identifier of the job to reset. This field is required. - :param new_settings: :class:`JobSettings` - The new settings of the job. These settings completely replace the old settings. - - Changes to the field `JobBaseSettings.timeout_seconds` are applied to active runs. Changes to other - fields are applied to future runs only. - - - - - .. py:method:: run_now(job_id [, dbt_commands, idempotency_token, jar_params, job_parameters, notebook_params, pipeline_params, python_named_params, python_params, queue, spark_submit_params, sql_params]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - run_by_id = w.jobs.run_now(job_id=created_job.job_id).result() - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Trigger a new job run. - - Run a job and return the `run_id` of the triggered run. - - :param job_id: int - The ID of the job to be executed - :param dbt_commands: List[str] (optional) - An array of commands to execute for jobs with the dbt task, for example `"dbt_commands": ["dbt - deps", "dbt seed", "dbt run"]` - :param idempotency_token: str (optional) - An optional token to guarantee the idempotency of job run requests. If a run with the provided token - already exists, the request does not create a new run but returns the ID of the existing run - instead. If a run with the provided token is deleted, an error is returned. - - If you specify the idempotency token, upon failure you can retry until the request succeeds. - Databricks guarantees that exactly one run is launched with that idempotency token. - - This token must have at most 64 characters. - - For more information, see [How to ensure idempotency for jobs]. - - [How to ensure idempotency for jobs]: https://kb.databricks.com/jobs/jobs-idempotency.html - :param jar_params: List[str] (optional) - A list of parameters for jobs with Spark JAR tasks, for example `"jar_params": ["john doe", "35"]`. - The parameters are used to invoke the main function of the main class specified in the Spark JAR - task. If not specified upon `run-now`, it defaults to an empty list. jar_params cannot be specified - in conjunction with notebook_params. The JSON representation of this field (for example - `{"jar_params":["john doe","35"]}`) cannot exceed 10,000 bytes. - - Use [Task parameter variables](/jobs.html"#parameter-variables") to set parameters containing - information about job runs. - :param job_parameters: Dict[str,str] (optional) - Job-level parameters used in the run. for example `"param": "overriding_val"` - :param notebook_params: Dict[str,str] (optional) - A map from keys to values for jobs with notebook task, for example `"notebook_params": {"name": - "john doe", "age": "35"}`. The map is passed to the notebook and is accessible through the - [dbutils.widgets.get] function. - - If not specified upon `run-now`, the triggered run uses the job’s base parameters. - - notebook_params cannot be specified in conjunction with jar_params. - - Use [Task parameter variables] to set parameters containing information about job runs. - - The JSON representation of this field (for example `{"notebook_params":{"name":"john - doe","age":"35"}}`) cannot exceed 10,000 bytes. - - [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - :param pipeline_params: :class:`PipelineParams` (optional) - :param python_named_params: Dict[str,str] (optional) - A map from keys to values for jobs with Python wheel task, for example `"python_named_params": - {"name": "task", "data": "dbfs:/path/to/data.json"}`. - :param python_params: List[str] (optional) - A list of parameters for jobs with Python tasks, for example `"python_params": ["john doe", "35"]`. - The parameters are passed to Python file as command-line parameters. If specified upon `run-now`, it - would overwrite the parameters specified in job setting. The JSON representation of this field (for - example `{"python_params":["john doe","35"]}`) cannot exceed 10,000 bytes. - - Use [Task parameter variables] to set parameters containing information about job runs. - - Important - - These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters - returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and - emojis. - - [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - :param queue: :class:`QueueSettings` (optional) - The queue settings of the run. - :param spark_submit_params: List[str] (optional) - A list of parameters for jobs with spark submit task, for example `"spark_submit_params": - ["--class", "org.apache.spark.examples.SparkPi"]`. The parameters are passed to spark-submit script - as command-line parameters. If specified upon `run-now`, it would overwrite the parameters specified - in job setting. The JSON representation of this field (for example `{"python_params":["john - doe","35"]}`) cannot exceed 10,000 bytes. - - Use [Task parameter variables] to set parameters containing information about job runs - - Important - - These parameters accept only Latin characters (ASCII character set). Using non-ASCII characters - returns an error. Examples of invalid, non-ASCII characters are Chinese, Japanese kanjis, and - emojis. - - [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - :param sql_params: Dict[str,str] (optional) - A map from keys to values for jobs with SQL task, for example `"sql_params": {"name": "john doe", - "age": "35"}`. The SQL alert task does not support custom parameters. - - :returns: - Long-running operation waiter for :class:`Run`. - See :method:wait_get_run_job_terminated_or_skipped for more details. - - - .. py:method:: set_permissions(job_id [, access_control_list]) - - Set job permissions. - - Sets permissions on a job. Jobs can inherit permissions from their root object. - - :param job_id: str - The job for which to get or manage permissions. - :param access_control_list: List[:class:`JobAccessControlRequest`] (optional) - - :returns: :class:`JobPermissions` - - - .. py:method:: submit( [, access_control_list, email_notifications, git_source, health, idempotency_token, notification_settings, queue, run_name, tasks, timeout_seconds, webhook_notifications]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - run = w.jobs.submit(run_name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.SubmitTask(existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key=f'sdk-{time.time_ns()}') - ]).result() - - # cleanup - w.jobs.delete_run(run_id=run.run_id) - - Create and trigger a one-time run. - - Submit a one-time run. This endpoint allows you to submit a workload directly without creating a job. - Runs submitted using this endpoint don’t display in the UI. Use the `jobs/runs/get` API to check the - run state after the job is submitted. - - :param access_control_list: List[:class:`AccessControlRequest`] (optional) - List of permissions to set on the job. - :param email_notifications: :class:`JobEmailNotifications` (optional) - An optional set of email addresses notified when the run begins or completes. - :param git_source: :class:`GitSource` (optional) - An optional specification for a remote Git repository containing the source code used by tasks. - Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks. - - If `git_source` is set, these tasks retrieve the file from the remote repository by default. - However, this behavior can be overridden by setting `source` to `WORKSPACE` on the task. - - Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks are - used, `git_source` must be defined on the job. - :param health: :class:`JobsHealthRules` (optional) - An optional set of health rules that can be defined for this job. - :param idempotency_token: str (optional) - An optional token that can be used to guarantee the idempotency of job run requests. If a run with - the provided token already exists, the request does not create a new run but returns the ID of the - existing run instead. If a run with the provided token is deleted, an error is returned. - - If you specify the idempotency token, upon failure you can retry until the request succeeds. - Databricks guarantees that exactly one run is launched with that idempotency token. - - This token must have at most 64 characters. - - For more information, see [How to ensure idempotency for jobs]. - - [How to ensure idempotency for jobs]: https://kb.databricks.com/jobs/jobs-idempotency.html - :param notification_settings: :class:`JobNotificationSettings` (optional) - Optional notification settings that are used when sending notifications to each of the - `email_notifications` and `webhook_notifications` for this run. - :param queue: :class:`QueueSettings` (optional) - The queue settings of the one-time run. - :param run_name: str (optional) - An optional name for the run. The default value is `Untitled`. - :param tasks: List[:class:`SubmitTask`] (optional) - :param timeout_seconds: int (optional) - An optional timeout applied to each run of this job. A value of `0` means no timeout. - :param webhook_notifications: :class:`WebhookNotifications` (optional) - A collection of system notification IDs to notify when the run begins or completes. - - :returns: - Long-running operation waiter for :class:`Run`. - See :method:wait_get_run_job_terminated_or_skipped for more details. - - - .. py:method:: update(job_id [, fields_to_remove, new_settings]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import jobs - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - cluster_id = w.clusters.ensure_cluster_is_running( - os.environ["DATABRICKS_CLUSTER_ID"]) and os.environ["DATABRICKS_CLUSTER_ID"] - - new_name = f'sdk-{time.time_ns()}' - - created_job = w.jobs.create(name=f'sdk-{time.time_ns()}', - tasks=[ - jobs.Task(description="test", - existing_cluster_id=cluster_id, - notebook_task=jobs.NotebookTask(notebook_path=notebook_path), - task_key="test", - timeout_seconds=0) - ]) - - w.jobs.update(job_id=created_job.job_id, new_settings=jobs.JobSettings(name=new_name, max_concurrent_runs=5)) - - # cleanup - w.jobs.delete(job_id=created_job.job_id) - - Partially update a job. - - Add, update, or remove specific settings of an existing job. Use the ResetJob to overwrite all job - settings. - - :param job_id: int - The canonical identifier of the job to update. This field is required. - :param fields_to_remove: List[str] (optional) - Remove top-level fields in the job settings. Removing nested fields is not supported, except for - tasks and job clusters (`tasks/task_1`). This field is optional. - :param new_settings: :class:`JobSettings` (optional) - The new settings for the job. - - Top-level fields specified in `new_settings` are completely replaced, except for arrays which are - merged. That is, new and existing entries are completely replaced based on the respective key - fields, i.e. `task_key` or `job_cluster_key`, while previous entries are kept. - - Partially updating nested fields is not supported. - - Changes to the field `JobSettings.timeout_seconds` are applied to active runs. Changes to other - fields are applied to future runs only. - - - - - .. py:method:: update_permissions(job_id [, access_control_list]) - - Update job permissions. - - Updates the permissions on a job. Jobs can inherit permissions from their root object. - - :param job_id: str - The job for which to get or manage permissions. - :param access_control_list: List[:class:`JobAccessControlRequest`] (optional) - - :returns: :class:`JobPermissions` - \ No newline at end of file diff --git a/docs/workspace/libraries.rst b/docs/workspace/libraries.rst deleted file mode 100644 index 6c4ab4f45..000000000 --- a/docs/workspace/libraries.rst +++ /dev/null @@ -1,88 +0,0 @@ -Managed Libraries -================= -.. py:class:: LibrariesAPI - - The Libraries API allows you to install and uninstall libraries and get the status of libraries on a - cluster. - - To make third-party or custom code available to notebooks and jobs running on your clusters, you can - install a library. Libraries can be written in Python, Java, Scala, and R. You can upload Java, Scala, and - Python libraries and point to external packages in PyPI, Maven, and CRAN repositories. - - Cluster libraries can be used by all notebooks running on a cluster. You can install a cluster library - directly from a public repository such as PyPI or Maven, using a previously installed workspace library, - or using an init script. - - When you install a library on a cluster, a notebook already attached to that cluster will not immediately - see the new library. You must first detach and then reattach the notebook to the cluster. - - When you uninstall a library from a cluster, the library is removed only when you restart the cluster. - Until you restart the cluster, the status of the uninstalled library appears as Uninstall pending restart. - - .. py:method:: all_cluster_statuses() - - Get all statuses. - - Get the status of all libraries on all clusters. A status will be available for all libraries - installed on this cluster via the API or the libraries UI as well as libraries set to be installed on - all clusters via the libraries UI. - - :returns: :class:`ListAllClusterLibraryStatusesResponse` - - - .. py:method:: cluster_status(cluster_id) - - Get status. - - Get the status of libraries on a cluster. A status will be available for all libraries installed on - this cluster via the API or the libraries UI as well as libraries set to be installed on all clusters - via the libraries UI. The order of returned libraries will be as follows. - - 1. Libraries set to be installed on this cluster will be returned first. Within this group, the final - order will be order in which the libraries were added to the cluster. - - 2. Libraries set to be installed on all clusters are returned next. Within this group there is no - order guarantee. - - 3. Libraries that were previously requested on this cluster or on all clusters, but now marked for - removal. Within this group there is no order guarantee. - - :param cluster_id: str - Unique identifier of the cluster whose status should be retrieved. - - :returns: Iterator over :class:`LibraryFullStatus` - - - .. py:method:: install(cluster_id, libraries) - - Add a library. - - Add libraries to be installed on a cluster. The installation is asynchronous; it happens in the - background after the completion of this request. - - **Note**: The actual set of libraries to be installed on a cluster is the union of the libraries - specified via this method and the libraries set to be installed on all clusters via the libraries UI. - - :param cluster_id: str - Unique identifier for the cluster on which to install these libraries. - :param libraries: List[:class:`Library`] - The libraries to install. - - - - - .. py:method:: uninstall(cluster_id, libraries) - - Uninstall libraries. - - Set libraries to be uninstalled on a cluster. The libraries won't be uninstalled until the cluster is - restarted. Uninstalling libraries that are not installed on the cluster will have no impact but is not - an error. - - :param cluster_id: str - Unique identifier for the cluster on which to uninstall these libraries. - :param libraries: List[:class:`Library`] - The libraries to uninstall. - - - \ No newline at end of file diff --git a/docs/workspace/metastores.rst b/docs/workspace/metastores.rst deleted file mode 100644 index ed24d3c39..000000000 --- a/docs/workspace/metastores.rst +++ /dev/null @@ -1,302 +0,0 @@ -Metastores -========== -.. py:class:: MetastoresAPI - - A metastore is the top-level container of objects in Unity Catalog. It stores data assets (tables and - views) and the permissions that govern access to them. Databricks account admins can create metastores and - assign them to Databricks workspaces to control which workloads use each metastore. For a workspace to use - Unity Catalog, it must have a Unity Catalog metastore attached. - - Each metastore is configured with a root storage location in a cloud storage account. This storage - location is used for metadata and managed tables data. - - NOTE: This metastore is distinct from the metastore included in Databricks workspaces created before Unity - Catalog was released. If your workspace includes a legacy Hive metastore, the data in that metastore is - available in a catalog named hive_metastore. - - .. py:method:: assign(workspace_id, metastore_id, default_catalog_name) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - workspace_id = os.environ["DUMMY_WORKSPACE_ID"] - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - w.metastores.assign(metastore_id=created.metastore_id, workspace_id=workspace_id) - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Create an assignment. - - Creates a new metastore assignment. If an assignment for the same __workspace_id__ exists, it will be - overwritten by the new __metastore_id__ and __default_catalog_name__. The caller must be an account - admin. - - :param workspace_id: int - A workspace ID. - :param metastore_id: str - The unique ID of the metastore. - :param default_catalog_name: str - The name of the default catalog in the metastore. - - - - - .. py:method:: create(name [, region, storage_root]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Create a metastore. - - Creates a new metastore based on a provided name and optional storage root path. By default (if the - __owner__ field is not set), the owner of the new metastore is the user calling the - __createMetastore__ API. If the __owner__ field is set to the empty string (**""**), the ownership is - assigned to the System User instead. - - :param name: str - The user-specified name of the metastore. - :param region: str (optional) - Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). If this field is omitted, the - region of the workspace receiving the request will be used. - :param storage_root: str (optional) - The storage root URL for metastore - - :returns: :class:`MetastoreInfo` - - - .. py:method:: current() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - current_metastore = w.metastores.current() - - Get metastore assignment for workspace. - - Gets the metastore assignment for the workspace being accessed. - - :returns: :class:`MetastoreAssignment` - - - .. py:method:: delete(id [, force]) - - Delete a metastore. - - Deletes a metastore. The caller must be a metastore admin. - - :param id: str - Unique ID of the metastore. - :param force: bool (optional) - Force deletion even if the metastore is not empty. Default is false. - - - - - .. py:method:: get(id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - _ = w.metastores.get(id=created.metastore_id) - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Get a metastore. - - Gets a metastore that matches the supplied ID. The caller must be a metastore admin to retrieve this - info. - - :param id: str - Unique ID of the metastore. - - :returns: :class:`MetastoreInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.metastores.list() - - List metastores. - - Gets an array of the available metastores (as __MetastoreInfo__ objects). The caller must be an admin - to retrieve this info. There is no guarantee of a specific ordering of the elements in the array. - - :returns: Iterator over :class:`MetastoreInfo` - - - .. py:method:: summary() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - summary = w.metastores.summary() - - Get a metastore summary. - - Gets information about a metastore. This summary includes the storage credential, the cloud vendor, - the cloud region, and the global metastore ID. - - :returns: :class:`GetMetastoreSummaryResponse` - - - .. py:method:: unassign(workspace_id, metastore_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - workspace_id = os.environ["DUMMY_WORKSPACE_ID"] - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - w.metastores.unassign(metastore_id=created.metastore_id, workspace_id=workspace_id) - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Delete an assignment. - - Deletes a metastore assignment. The caller must be an account administrator. - - :param workspace_id: int - A workspace ID. - :param metastore_id: str - Query for the ID of the metastore to delete. - - - - - .. py:method:: update(id [, delta_sharing_organization_name, delta_sharing_recipient_token_lifetime_in_seconds, delta_sharing_scope, name, owner, privilege_model_version, storage_root_credential_id]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.metastores.create(name=f'sdk-{time.time_ns()}', - storage_root="s3://%s/%s" % - (os.environ["TEST_BUCKET"], f'sdk-{time.time_ns()}')) - - _ = w.metastores.update(id=created.metastore_id, name=f'sdk-{time.time_ns()}') - - # cleanup - w.metastores.delete(id=created.metastore_id, force=True) - - Update a metastore. - - Updates information for a specific metastore. The caller must be a metastore admin. If the __owner__ - field is set to the empty string (**""**), the ownership is updated to the System User. - - :param id: str - Unique ID of the metastore. - :param delta_sharing_organization_name: str (optional) - The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta - Sharing as the official name. - :param delta_sharing_recipient_token_lifetime_in_seconds: int (optional) - The lifetime of delta sharing recipient token in seconds. - :param delta_sharing_scope: :class:`UpdateMetastoreDeltaSharingScope` (optional) - The scope of Delta Sharing enabled for the metastore. - :param name: str (optional) - The user-specified name of the metastore. - :param owner: str (optional) - The owner of the metastore. - :param privilege_model_version: str (optional) - Privilege model version of the metastore, of the form `major.minor` (e.g., `1.0`). - :param storage_root_credential_id: str (optional) - UUID of storage credential to access the metastore storage_root. - - :returns: :class:`MetastoreInfo` - - - .. py:method:: update_assignment(workspace_id [, default_catalog_name, metastore_id]) - - Update an assignment. - - Updates a metastore assignment. This operation can be used to update __metastore_id__ or - __default_catalog_name__ for a specified Workspace, if the Workspace is already assigned a metastore. - The caller must be an account admin to update __metastore_id__; otherwise, the caller can be a - Workspace admin. - - :param workspace_id: int - A workspace ID. - :param default_catalog_name: str (optional) - The name of the default catalog for the metastore. - :param metastore_id: str (optional) - The unique ID of the metastore. - - - \ No newline at end of file diff --git a/docs/workspace/model_registry.rst b/docs/workspace/model_registry.rst deleted file mode 100644 index 4d71a4f27..000000000 --- a/docs/workspace/model_registry.rst +++ /dev/null @@ -1,900 +0,0 @@ -Model Registry -============== -.. py:class:: ModelRegistryAPI - - Note: This API reference documents APIs for the Workspace Model Registry. Databricks recommends using - [Models in Unity Catalog](/api/workspace/registeredmodels) instead. Models in Unity Catalog provides - centralized model governance, cross-workspace access, lineage, and deployment. Workspace Model Registry - will be deprecated in the future. - - The Workspace Model Registry is a centralized model repository and a UI and set of APIs that enable you to - manage the full lifecycle of MLflow Models. - - .. py:method:: approve_transition_request(name, version, stage, archive_existing_versions [, comment]) - - Approve transition request. - - Approves a model version stage transition request. - - :param name: str - Name of the model. - :param version: str - Version of the model. - :param stage: :class:`Stage` - Target stage of the transition. Valid values are: - - * `None`: The initial stage of a model version. - - * `Staging`: Staging or pre-production stage. - - * `Production`: Production stage. - - * `Archived`: Archived stage. - :param archive_existing_versions: bool - Specifies whether to archive all current model versions in the target stage. - :param comment: str (optional) - User-provided comment on the action. - - :returns: :class:`ApproveTransitionRequestResponse` - - - .. py:method:: create_comment(name, version, comment) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - model = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - mv = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp") - - created = w.model_registry.create_comment(comment=f'sdk-{time.time_ns()}', - name=mv.model_version.name, - version=mv.model_version.version) - - # cleanup - w.model_registry.delete_comment(id=created.comment.id) - - Post a comment. - - Posts a comment on a model version. A comment can be submitted either by a user or programmatically to - display relevant information about the model. For example, test results or deployment errors. - - :param name: str - Name of the model. - :param version: str - Version of the model. - :param comment: str - User-provided comment on the action. - - :returns: :class:`CreateCommentResponse` - - - .. py:method:: create_model(name [, description, tags]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - model = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - Create a model. - - Creates a new registered model with the name specified in the request body. - - Throws `RESOURCE_ALREADY_EXISTS` if a registered model with the given name exists. - - :param name: str - Register models under this name - :param description: str (optional) - Optional description for registered model. - :param tags: List[:class:`ModelTag`] (optional) - Additional metadata for registered model. - - :returns: :class:`CreateModelResponse` - - - .. py:method:: create_model_version(name, source [, description, run_id, run_link, tags]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - model = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - mv = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp") - - Create a model version. - - Creates a model version. - - :param name: str - Register model under this name - :param source: str - URI indicating the location of the model artifacts. - :param description: str (optional) - Optional description for model version. - :param run_id: str (optional) - MLflow run ID for correlation, if `source` was generated by an experiment run in MLflow tracking - server - :param run_link: str (optional) - MLflow run link - this is the exact link of the run that generated this model version, potentially - hosted at another instance of MLflow. - :param tags: List[:class:`ModelVersionTag`] (optional) - Additional metadata for model version. - - :returns: :class:`CreateModelVersionResponse` - - - .. py:method:: create_transition_request(name, version, stage [, comment]) - - Make a transition request. - - Creates a model version stage transition request. - - :param name: str - Name of the model. - :param version: str - Version of the model. - :param stage: :class:`Stage` - Target stage of the transition. Valid values are: - - * `None`: The initial stage of a model version. - - * `Staging`: Staging or pre-production stage. - - * `Production`: Production stage. - - * `Archived`: Archived stage. - :param comment: str (optional) - User-provided comment on the action. - - :returns: :class:`CreateTransitionRequestResponse` - - - .. py:method:: create_webhook(events [, description, http_url_spec, job_spec, model_name, status]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - created = w.model_registry.create_webhook(description=f'sdk-{time.time_ns()}', - events=[ml.RegistryWebhookEvent.MODEL_VERSION_CREATED], - http_url_spec=ml.HttpUrlSpec(url=w.config.host)) - - # cleanup - w.model_registry.delete_webhook(id=created.webhook.id) - - Create a webhook. - - **NOTE**: This endpoint is in Public Preview. - - Creates a registry webhook. - - :param events: List[:class:`RegistryWebhookEvent`] - Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A new model version was - created for the associated model. - - * `MODEL_VERSION_TRANSITIONED_STAGE`: A model version’s stage was changed. - - * `TRANSITION_REQUEST_CREATED`: A user requested a model version’s stage be transitioned. - - * `COMMENT_CREATED`: A user wrote a comment on a registered model. - - * `REGISTERED_MODEL_CREATED`: A new registered model was created. This event type can only be - specified for a registry-wide webhook, which can be created by not specifying a model name in the - create request. - - * `MODEL_VERSION_TAG_SET`: A user set a tag on the model version. - - * `MODEL_VERSION_TRANSITIONED_TO_STAGING`: A model version was transitioned to staging. - - * `MODEL_VERSION_TRANSITIONED_TO_PRODUCTION`: A model version was transitioned to production. - - * `MODEL_VERSION_TRANSITIONED_TO_ARCHIVED`: A model version was archived. - - * `TRANSITION_REQUEST_TO_STAGING_CREATED`: A user requested a model version be transitioned to - staging. - - * `TRANSITION_REQUEST_TO_PRODUCTION_CREATED`: A user requested a model version be transitioned to - production. - - * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model version be archived. - :param description: str (optional) - User-specified description for the webhook. - :param http_url_spec: :class:`HttpUrlSpec` (optional) - :param job_spec: :class:`JobSpec` (optional) - :param model_name: str (optional) - Name of the model whose events would trigger this webhook. - :param status: :class:`RegistryWebhookStatus` (optional) - Enable or disable triggering the webhook, or put the webhook into test mode. The default is - `ACTIVE`: * `ACTIVE`: Webhook is triggered when an associated event happens. - - * `DISABLED`: Webhook is not triggered. - - * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is not triggered on a real - event. - - :returns: :class:`CreateWebhookResponse` - - - .. py:method:: delete_comment(id) - - Delete a comment. - - Deletes a comment on a model version. - - :param id: str - - - - - .. py:method:: delete_model(name) - - Delete a model. - - Deletes a registered model. - - :param name: str - Registered model unique name identifier. - - - - - .. py:method:: delete_model_tag(name, key) - - Delete a model tag. - - Deletes the tag for a registered model. - - :param name: str - Name of the registered model that the tag was logged under. - :param key: str - Name of the tag. The name must be an exact match; wild-card deletion is not supported. Maximum size - is 250 bytes. - - - - - .. py:method:: delete_model_version(name, version) - - Delete a model version. - - Deletes a model version. - - :param name: str - Name of the registered model - :param version: str - Model version number - - - - - .. py:method:: delete_model_version_tag(name, version, key) - - Delete a model version tag. - - Deletes a model version tag. - - :param name: str - Name of the registered model that the tag was logged under. - :param version: str - Model version number that the tag was logged under. - :param key: str - Name of the tag. The name must be an exact match; wild-card deletion is not supported. Maximum size - is 250 bytes. - - - - - .. py:method:: delete_transition_request(name, version, stage, creator [, comment]) - - Delete a transition request. - - Cancels a model version stage transition request. - - :param name: str - Name of the model. - :param version: str - Version of the model. - :param stage: :class:`DeleteTransitionRequestStage` - Target stage of the transition request. Valid values are: - - * `None`: The initial stage of a model version. - - * `Staging`: Staging or pre-production stage. - - * `Production`: Production stage. - - * `Archived`: Archived stage. - :param creator: str - Username of the user who created this request. Of the transition requests matching the specified - details, only the one transition created by this user will be deleted. - :param comment: str (optional) - User-provided comment on the action. - - - - - .. py:method:: delete_webhook( [, id]) - - Delete a webhook. - - **NOTE:** This endpoint is in Public Preview. - - Deletes a registry webhook. - - :param id: str (optional) - Webhook ID required to delete a registry webhook. - - - - - .. py:method:: get_latest_versions(name [, stages]) - - Get the latest version. - - Gets the latest version of a registered model. - - :param name: str - Registered model unique name identifier. - :param stages: List[str] (optional) - List of stages. - - :returns: Iterator over :class:`ModelVersion` - - - .. py:method:: get_model(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - model = w.model_registry.get_model(name=created.registered_model.name) - - Get model. - - Get the details of a model. This is a Databricks workspace version of the [MLflow endpoint] that also - returns the model's Databricks workspace ID and the permission level of the requesting user on the - model. - - [MLflow endpoint]: https://www.mlflow.org/docs/latest/rest-api.html#get-registeredmodel - - :param name: str - Registered model unique name identifier. - - :returns: :class:`GetModelResponse` - - - .. py:method:: get_model_version(name, version) - - Get a model version. - - Get a model version. - - :param name: str - Name of the registered model - :param version: str - Model version number - - :returns: :class:`GetModelVersionResponse` - - - .. py:method:: get_model_version_download_uri(name, version) - - Get a model version URI. - - Gets a URI to download the model version. - - :param name: str - Name of the registered model - :param version: str - Model version number - - :returns: :class:`GetModelVersionDownloadUriResponse` - - - .. py:method:: get_permission_levels(registered_model_id) - - Get registered model permission levels. - - Gets the permission levels that a user can have on an object. - - :param registered_model_id: str - The registered model for which to get or manage permissions. - - :returns: :class:`GetRegisteredModelPermissionLevelsResponse` - - - .. py:method:: get_permissions(registered_model_id) - - Get registered model permissions. - - Gets the permissions of a registered model. Registered models can inherit permissions from their root - object. - - :param registered_model_id: str - The registered model for which to get or manage permissions. - - :returns: :class:`RegisteredModelPermissions` - - - .. py:method:: list_models( [, max_results, page_token]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - all = w.model_registry.list_models(ml.ListModelsRequest()) - - List models. - - Lists all available registered models, up to the limit specified in __max_results__. - - :param max_results: int (optional) - Maximum number of registered models desired. Max threshold is 1000. - :param page_token: str (optional) - Pagination token to go to the next page based on a previous query. - - :returns: Iterator over :class:`Model` - - - .. py:method:: list_transition_requests(name, version) - - List transition requests. - - Gets a list of all open stage transition requests for the model version. - - :param name: str - Name of the model. - :param version: str - Version of the model. - - :returns: Iterator over :class:`Activity` - - - .. py:method:: list_webhooks( [, events, model_name, page_token]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - all = w.model_registry.list_webhooks(ml.ListWebhooksRequest()) - - List registry webhooks. - - **NOTE:** This endpoint is in Public Preview. - - Lists all registry webhooks. - - :param events: List[:class:`RegistryWebhookEvent`] (optional) - If `events` is specified, any webhook with one or more of the specified trigger events is included - in the output. If `events` is not specified, webhooks of all event types are included in the output. - :param model_name: str (optional) - If not specified, all webhooks associated with the specified events are listed, regardless of their - associated model. - :param page_token: str (optional) - Token indicating the page of artifact results to fetch - - :returns: Iterator over :class:`RegistryWebhook` - - - .. py:method:: reject_transition_request(name, version, stage [, comment]) - - Reject a transition request. - - Rejects a model version stage transition request. - - :param name: str - Name of the model. - :param version: str - Version of the model. - :param stage: :class:`Stage` - Target stage of the transition. Valid values are: - - * `None`: The initial stage of a model version. - - * `Staging`: Staging or pre-production stage. - - * `Production`: Production stage. - - * `Archived`: Archived stage. - :param comment: str (optional) - User-provided comment on the action. - - :returns: :class:`RejectTransitionRequestResponse` - - - .. py:method:: rename_model(name [, new_name]) - - Rename a model. - - Renames a registered model. - - :param name: str - Registered model unique name identifier. - :param new_name: str (optional) - If provided, updates the name for this `registered_model`. - - :returns: :class:`RenameModelResponse` - - - .. py:method:: search_model_versions( [, filter, max_results, order_by, page_token]) - - Searches model versions. - - Searches for specific model versions based on the supplied __filter__. - - :param filter: str (optional) - String filter condition, like "name='my-model-name'". Must be a single boolean condition, with - string values wrapped in single quotes. - :param max_results: int (optional) - Maximum number of models desired. Max threshold is 10K. - :param order_by: List[str] (optional) - List of columns to be ordered by including model name, version, stage with an optional "DESC" or - "ASC" annotation, where "ASC" is the default. Tiebreaks are done by latest stage transition - timestamp, followed by name ASC, followed by version DESC. - :param page_token: str (optional) - Pagination token to go to next page based on previous search query. - - :returns: Iterator over :class:`ModelVersion` - - - .. py:method:: search_models( [, filter, max_results, order_by, page_token]) - - Search models. - - Search for registered models based on the specified __filter__. - - :param filter: str (optional) - String filter condition, like "name LIKE 'my-model-name'". Interpreted in the backend automatically - as "name LIKE '%my-model-name%'". Single boolean condition, with string values wrapped in single - quotes. - :param max_results: int (optional) - Maximum number of models desired. Default is 100. Max threshold is 1000. - :param order_by: List[str] (optional) - List of columns for ordering search results, which can include model name and last updated timestamp - with an optional "DESC" or "ASC" annotation, where "ASC" is the default. Tiebreaks are done by model - name ASC. - :param page_token: str (optional) - Pagination token to go to the next page based on a previous search query. - - :returns: Iterator over :class:`Model` - - - .. py:method:: set_model_tag(name, key, value) - - Set a tag. - - Sets a tag on a registered model. - - :param name: str - Unique name of the model. - :param key: str - Name of the tag. Maximum size depends on storage backend. If a tag with this name already exists, - its preexisting value will be replaced by the specified `value`. All storage backends are guaranteed - to support key values up to 250 bytes in size. - :param value: str - String value of the tag being logged. Maximum size depends on storage backend. All storage backends - are guaranteed to support key values up to 5000 bytes in size. - - - - - .. py:method:: set_model_version_tag(name, version, key, value) - - Set a version tag. - - Sets a model version tag. - - :param name: str - Unique name of the model. - :param version: str - Model version number. - :param key: str - Name of the tag. Maximum size depends on storage backend. If a tag with this name already exists, - its preexisting value will be replaced by the specified `value`. All storage backends are guaranteed - to support key values up to 250 bytes in size. - :param value: str - String value of the tag being logged. Maximum size depends on storage backend. All storage backends - are guaranteed to support key values up to 5000 bytes in size. - - - - - .. py:method:: set_permissions(registered_model_id [, access_control_list]) - - Set registered model permissions. - - Sets permissions on a registered model. Registered models can inherit permissions from their root - object. - - :param registered_model_id: str - The registered model for which to get or manage permissions. - :param access_control_list: List[:class:`RegisteredModelAccessControlRequest`] (optional) - - :returns: :class:`RegisteredModelPermissions` - - - .. py:method:: test_registry_webhook(id [, event]) - - Test a webhook. - - **NOTE:** This endpoint is in Public Preview. - - Tests a registry webhook. - - :param id: str - Webhook ID - :param event: :class:`RegistryWebhookEvent` (optional) - If `event` is specified, the test trigger uses the specified event. If `event` is not specified, the - test trigger uses a randomly chosen event associated with the webhook. - - :returns: :class:`TestRegistryWebhookResponse` - - - .. py:method:: transition_stage(name, version, stage, archive_existing_versions [, comment]) - - Transition a stage. - - Transition a model version's stage. This is a Databricks workspace version of the [MLflow endpoint] - that also accepts a comment associated with the transition to be recorded.", - - [MLflow endpoint]: https://www.mlflow.org/docs/latest/rest-api.html#transition-modelversion-stage - - :param name: str - Name of the model. - :param version: str - Version of the model. - :param stage: :class:`Stage` - Target stage of the transition. Valid values are: - - * `None`: The initial stage of a model version. - - * `Staging`: Staging or pre-production stage. - - * `Production`: Production stage. - - * `Archived`: Archived stage. - :param archive_existing_versions: bool - Specifies whether to archive all current model versions in the target stage. - :param comment: str (optional) - User-provided comment on the action. - - :returns: :class:`TransitionStageResponse` - - - .. py:method:: update_comment(id, comment) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - model = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - mv = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp") - - created = w.model_registry.create_comment(comment=f'sdk-{time.time_ns()}', - name=mv.model_version.name, - version=mv.model_version.version) - - _ = w.model_registry.update_comment(comment=f'sdk-{time.time_ns()}', id=created.comment.id) - - # cleanup - w.model_registry.delete_comment(id=created.comment.id) - - Update a comment. - - Post an edit to a comment on a model version. - - :param id: str - Unique identifier of an activity - :param comment: str - User-provided comment on the action. - - :returns: :class:`UpdateCommentResponse` - - - .. py:method:: update_model(name [, description]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - model = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - created = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp") - - w.model_registry.update_model_version(description=f'sdk-{time.time_ns()}', - name=created.model_version.name, - version=created.model_version.version) - - Update model. - - Updates a registered model. - - :param name: str - Registered model unique name identifier. - :param description: str (optional) - If provided, updates the description for this `registered_model`. - - - - - .. py:method:: update_model_version(name, version [, description]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - model = w.model_registry.create_model(name=f'sdk-{time.time_ns()}') - - created = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp") - - w.model_registry.update_model_version(description=f'sdk-{time.time_ns()}', - name=created.model_version.name, - version=created.model_version.version) - - Update model version. - - Updates the model version. - - :param name: str - Name of the registered model - :param version: str - Model version number - :param description: str (optional) - If provided, updates the description for this `registered_model`. - - - - - .. py:method:: update_permissions(registered_model_id [, access_control_list]) - - Update registered model permissions. - - Updates the permissions on a registered model. Registered models can inherit permissions from their - root object. - - :param registered_model_id: str - The registered model for which to get or manage permissions. - :param access_control_list: List[:class:`RegisteredModelAccessControlRequest`] (optional) - - :returns: :class:`RegisteredModelPermissions` - - - .. py:method:: update_webhook(id [, description, events, http_url_spec, job_spec, status]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import ml - - w = WorkspaceClient() - - created = w.model_registry.create_webhook(description=f'sdk-{time.time_ns()}', - events=[ml.RegistryWebhookEvent.MODEL_VERSION_CREATED], - http_url_spec=ml.HttpUrlSpec(url=w.config.host)) - - w.model_registry.update_webhook(id=created.webhook.id, description=f'sdk-{time.time_ns()}') - - # cleanup - w.model_registry.delete_webhook(id=created.webhook.id) - - Update a webhook. - - **NOTE:** This endpoint is in Public Preview. - - Updates a registry webhook. - - :param id: str - Webhook ID - :param description: str (optional) - User-specified description for the webhook. - :param events: List[:class:`RegistryWebhookEvent`] (optional) - Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A new model version was - created for the associated model. - - * `MODEL_VERSION_TRANSITIONED_STAGE`: A model version’s stage was changed. - - * `TRANSITION_REQUEST_CREATED`: A user requested a model version’s stage be transitioned. - - * `COMMENT_CREATED`: A user wrote a comment on a registered model. - - * `REGISTERED_MODEL_CREATED`: A new registered model was created. This event type can only be - specified for a registry-wide webhook, which can be created by not specifying a model name in the - create request. - - * `MODEL_VERSION_TAG_SET`: A user set a tag on the model version. - - * `MODEL_VERSION_TRANSITIONED_TO_STAGING`: A model version was transitioned to staging. - - * `MODEL_VERSION_TRANSITIONED_TO_PRODUCTION`: A model version was transitioned to production. - - * `MODEL_VERSION_TRANSITIONED_TO_ARCHIVED`: A model version was archived. - - * `TRANSITION_REQUEST_TO_STAGING_CREATED`: A user requested a model version be transitioned to - staging. - - * `TRANSITION_REQUEST_TO_PRODUCTION_CREATED`: A user requested a model version be transitioned to - production. - - * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model version be archived. - :param http_url_spec: :class:`HttpUrlSpec` (optional) - :param job_spec: :class:`JobSpec` (optional) - :param status: :class:`RegistryWebhookStatus` (optional) - Enable or disable triggering the webhook, or put the webhook into test mode. The default is - `ACTIVE`: * `ACTIVE`: Webhook is triggered when an associated event happens. - - * `DISABLED`: Webhook is not triggered. - - * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is not triggered on a real - event. - - - \ No newline at end of file diff --git a/docs/workspace/model_versions.rst b/docs/workspace/model_versions.rst deleted file mode 100644 index 4c51eb84a..000000000 --- a/docs/workspace/model_versions.rst +++ /dev/null @@ -1,112 +0,0 @@ -Model Versions -============== -.. py:class:: ModelVersionsAPI - - Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. Models in Unity Catalog - provide centralized access control, auditing, lineage, and discovery of ML models across Databricks - workspaces. - - This API reference documents the REST endpoints for managing model versions in Unity Catalog. For more - details, see the [registered models API docs](/api/workspace/registeredmodels). - - .. py:method:: delete(full_name, version) - - Delete a Model Version. - - Deletes a model version from the specified registered model. Any aliases assigned to the model version - will also be deleted. - - The caller must be a metastore admin or an owner of the parent registered model. For the latter case, - the caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - The three-level (fully qualified) name of the model version - :param version: int - The integer version number of the model version - - - - - .. py:method:: get(full_name, version) - - Get a Model Version. - - Get a model version. - - The caller must be a metastore admin or an owner of (or have the **EXECUTE** privilege on) the parent - registered model. For the latter case, the caller must also be the owner or have the **USE_CATALOG** - privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - The three-level (fully qualified) name of the model version - :param version: int - The integer version number of the model version - - :returns: :class:`RegisteredModelInfo` - - - .. py:method:: get_by_alias(full_name, alias) - - Get Model Version By Alias. - - Get a model version by alias. - - The caller must be a metastore admin or an owner of (or have the **EXECUTE** privilege on) the - registered model. For the latter case, the caller must also be the owner or have the **USE_CATALOG** - privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - The three-level (fully qualified) name of the registered model - :param alias: str - The name of the alias - - :returns: :class:`ModelVersionInfo` - - - .. py:method:: list(full_name [, max_results, page_token]) - - List Model Versions. - - List model versions. You can list model versions under a particular schema, or list all model versions - in the current metastore. - - The returned models are filtered based on the privileges of the calling user. For example, the - metastore admin is able to list all the model versions. A regular user needs to be the owner or have - the **EXECUTE** privilege on the parent registered model to recieve the model versions in the - response. For the latter case, the caller must also be the owner or have the **USE_CATALOG** privilege - on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - There is no guarantee of a specific ordering of the elements in the response. - - :param full_name: str - The full three-level name of the registered model under which to list model versions - :param max_results: int (optional) - Max number of model versions to return - :param page_token: str (optional) - Opaque token to send for the next page of results (pagination). - - :returns: Iterator over :class:`ModelVersionInfo` - - - .. py:method:: update(full_name, version [, comment]) - - Update a Model Version. - - Updates the specified model version. - - The caller must be a metastore admin or an owner of the parent registered model. For the latter case, - the caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - Currently only the comment of the model version can be updated. - - :param full_name: str - The three-level (fully qualified) name of the model version - :param version: int - The integer version number of the model version - :param comment: str (optional) - The comment attached to the model version - - :returns: :class:`ModelVersionInfo` - \ No newline at end of file diff --git a/docs/workspace/permissions.rst b/docs/workspace/permissions.rst deleted file mode 100644 index b2cdbe0c2..000000000 --- a/docs/workspace/permissions.rst +++ /dev/null @@ -1,167 +0,0 @@ -Permissions -=========== -.. py:class:: PermissionsAPI - - Permissions API are used to create read, write, edit, update and manage access for various users on - different objects and endpoints. - - * **[Cluster permissions](:service:clusters)** — Manage which users can manage, restart, or attach to - clusters. - - * **[Cluster policy permissions](:service:clusterpolicies)** — Manage which users can use cluster - policies. - - * **[Delta Live Tables pipeline permissions](:service:pipelines)** — Manage which users can view, - manage, run, cancel, or own a Delta Live Tables pipeline. - - * **[Job permissions](:service:jobs)** — Manage which users can view, manage, trigger, cancel, or own a - job. - - * **[MLflow experiment permissions](:service:experiments)** — Manage which users can read, edit, or - manage MLflow experiments. - - * **[MLflow registered model permissions](:service:modelregistry)** — Manage which users can read, edit, - or manage MLflow registered models. - - * **[Password permissions](:service:users)** — Manage which users can use password login when SSO is - enabled. - - * **[Instance Pool permissions](:service:instancepools)** — Manage which users can manage or attach to - pools. - - * **[Repo permissions](repos)** — Manage which users can read, run, edit, or manage a repo. - - * **[Serving endpoint permissions](:service:servingendpoints)** — Manage which users can view, query, or - manage a serving endpoint. - - * **[SQL warehouse permissions](:service:warehouses)** — Manage which users can use or manage SQL - warehouses. - - * **[Token permissions](:service:tokenmanagement)** — Manage which users can create or use tokens. - - * **[Workspace object permissions](:service:workspace)** — Manage which users can read, run, edit, or - manage directories, files, and notebooks. - - For the mapping of the required permissions for specific actions or abilities and other important - information, see [Access Control]. - - [Access Control]: https://docs.databricks.com/security/auth-authz/access-control/index.html - - .. py:method:: get(request_object_type, request_object_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - obj = w.workspace.get_status(path=notebook_path) - - levels = w.permissions.get_permission_levels(request_object_type="notebooks", - request_object_id="%d" % (obj.object_id)) - - Get object permissions. - - Gets the permissions of an object. Objects can inherit permissions from their parent objects or root - object. - - :param request_object_type: str - - :param request_object_id: str - - :returns: :class:`ObjectPermissions` - - - .. py:method:: get_permission_levels(request_object_type, request_object_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - obj = w.workspace.get_status(path=notebook_path) - - levels = w.permissions.get_permission_levels(request_object_type="notebooks", - request_object_id="%d" % (obj.object_id)) - - Get object permission levels. - - Gets the permission levels that a user can have on an object. - - :param request_object_type: str - - :param request_object_id: str - - - :returns: :class:`GetPermissionLevelsResponse` - - - .. py:method:: set(request_object_type, request_object_id [, access_control_list]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - obj = w.workspace.get_status(path=notebook_path) - - _ = w.permissions.set(request_object_type="notebooks", - request_object_id="%d" % (obj.object_id), - access_control_list=[ - iam.AccessControlRequest(group_name=group.display_name, - permission_level=iam.PermissionLevel.CAN_RUN) - ]) - - # cleanup - w.groups.delete(id=group.id) - - Set object permissions. - - Sets permissions on an object. Objects can inherit permissions from their parent objects or root - object. - - :param request_object_type: str - - :param request_object_id: str - :param access_control_list: List[:class:`AccessControlRequest`] (optional) - - :returns: :class:`ObjectPermissions` - - - .. py:method:: update(request_object_type, request_object_id [, access_control_list]) - - Update object permissions. - - Updates the permissions on an object. Objects can inherit permissions from their parent objects or - root object. - - :param request_object_type: str - - :param request_object_id: str - :param access_control_list: List[:class:`AccessControlRequest`] (optional) - - :returns: :class:`ObjectPermissions` - \ No newline at end of file diff --git a/docs/workspace/pipelines.rst b/docs/workspace/pipelines.rst deleted file mode 100644 index 481a53c01..000000000 --- a/docs/workspace/pipelines.rst +++ /dev/null @@ -1,476 +0,0 @@ -Pipelines -========= -.. py:class:: PipelinesAPI - - The Delta Live Tables API allows you to create, edit, delete, start, and view details about pipelines. - - Delta Live Tables is a framework for building reliable, maintainable, and testable data processing - pipelines. You define the transformations to perform on your data, and Delta Live Tables manages task - orchestration, cluster management, monitoring, data quality, and error handling. - - Instead of defining your data pipelines using a series of separate Apache Spark tasks, Delta Live Tables - manages how your data is transformed based on a target schema you define for each processing step. You can - also enforce data quality with Delta Live Tables expectations. Expectations allow you to define expected - data quality and specify how to handle records that fail those expectations. - - .. py:method:: create( [, allow_duplicate_names, catalog, channel, clusters, configuration, continuous, development, dry_run, edition, filters, id, libraries, name, notifications, photon, serverless, storage, target, trigger]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import pipelines - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - created = w.pipelines.create( - continuous=False, - name=f'sdk-{time.time_ns()}', - libraries=[pipelines.PipelineLibrary(notebook=pipelines.NotebookLibrary(path=notebook_path))], - clusters=[ - pipelines.PipelineCluster(instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - label="default", - num_workers=1, - custom_tags={ - "cluster_type": "default", - }) - ]) - - # cleanup - w.pipelines.delete(pipeline_id=created.pipeline_id) - - Create a pipeline. - - Creates a new data processing pipeline based on the requested configuration. If successful, this - method returns the ID of the new pipeline. - - :param allow_duplicate_names: bool (optional) - If false, deployment will fail if name conflicts with that of another pipeline. - :param catalog: str (optional) - A catalog in Unity Catalog to publish data from this pipeline to. If `target` is specified, tables - in this pipeline are published to a `target` schema inside `catalog` (for example, - `catalog`.`target`.`table`). If `target` is not specified, no data is published to Unity Catalog. - :param channel: str (optional) - DLT Release Channel that specifies which version to use. - :param clusters: List[:class:`PipelineCluster`] (optional) - Cluster settings for this pipeline deployment. - :param configuration: Dict[str,str] (optional) - String-String configuration for this pipeline execution. - :param continuous: bool (optional) - Whether the pipeline is continuous or triggered. This replaces `trigger`. - :param development: bool (optional) - Whether the pipeline is in Development mode. Defaults to false. - :param dry_run: bool (optional) - :param edition: str (optional) - Pipeline product edition. - :param filters: :class:`Filters` (optional) - Filters on which Pipeline packages to include in the deployed graph. - :param id: str (optional) - Unique identifier for this pipeline. - :param libraries: List[:class:`PipelineLibrary`] (optional) - Libraries or code needed by this deployment. - :param name: str (optional) - Friendly identifier for this pipeline. - :param notifications: List[:class:`Notifications`] (optional) - List of notification settings for this pipeline. - :param photon: bool (optional) - Whether Photon is enabled for this pipeline. - :param serverless: bool (optional) - Whether serverless compute is enabled for this pipeline. - :param storage: str (optional) - DBFS root directory for storing checkpoints and tables. - :param target: str (optional) - Target schema (database) to add tables in this pipeline to. If not specified, no data is published - to the Hive metastore or Unity Catalog. To publish to Unity Catalog, also specify `catalog`. - :param trigger: :class:`PipelineTrigger` (optional) - Which pipeline trigger to use. Deprecated: Use `continuous` instead. - - :returns: :class:`CreatePipelineResponse` - - - .. py:method:: delete(pipeline_id) - - Delete a pipeline. - - Deletes a pipeline. - - :param pipeline_id: str - - - - - .. py:method:: get(pipeline_id) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import pipelines - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - created = w.pipelines.create( - continuous=False, - name=f'sdk-{time.time_ns()}', - libraries=[pipelines.PipelineLibrary(notebook=pipelines.NotebookLibrary(path=notebook_path))], - clusters=[ - pipelines.PipelineCluster(instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - label="default", - num_workers=1, - custom_tags={ - "cluster_type": "default", - }) - ]) - - by_id = w.pipelines.get(pipeline_id=created.pipeline_id) - - # cleanup - w.pipelines.delete(pipeline_id=created.pipeline_id) - - Get a pipeline. - - :param pipeline_id: str - - :returns: :class:`GetPipelineResponse` - - - .. py:method:: get_permission_levels(pipeline_id) - - Get pipeline permission levels. - - Gets the permission levels that a user can have on an object. - - :param pipeline_id: str - The pipeline for which to get or manage permissions. - - :returns: :class:`GetPipelinePermissionLevelsResponse` - - - .. py:method:: get_permissions(pipeline_id) - - Get pipeline permissions. - - Gets the permissions of a pipeline. Pipelines can inherit permissions from their root object. - - :param pipeline_id: str - The pipeline for which to get or manage permissions. - - :returns: :class:`PipelinePermissions` - - - .. py:method:: get_update(pipeline_id, update_id) - - Get a pipeline update. - - Gets an update from an active pipeline. - - :param pipeline_id: str - The ID of the pipeline. - :param update_id: str - The ID of the update. - - :returns: :class:`GetUpdateResponse` - - - .. py:method:: list_pipeline_events(pipeline_id [, filter, max_results, order_by, page_token]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import pipelines - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - created = w.pipelines.create( - continuous=False, - name=f'sdk-{time.time_ns()}', - libraries=[pipelines.PipelineLibrary(notebook=pipelines.NotebookLibrary(path=notebook_path))], - clusters=[ - pipelines.PipelineCluster(instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - label="default", - num_workers=1, - custom_tags={ - "cluster_type": "default", - }) - ]) - - events = w.pipelines.list_pipeline_events(pipeline_id=created.pipeline_id) - - # cleanup - w.pipelines.delete(pipeline_id=created.pipeline_id) - - List pipeline events. - - Retrieves events for a pipeline. - - :param pipeline_id: str - :param filter: str (optional) - Criteria to select a subset of results, expressed using a SQL-like syntax. The supported filters - are: 1. level='INFO' (or WARN or ERROR) 2. level in ('INFO', 'WARN') 3. id='[event-id]' 4. timestamp - > 'TIMESTAMP' (or >=,<,<=,=) - - Composite expressions are supported, for example: level in ('ERROR', 'WARN') AND timestamp> - '2021-07-22T06:37:33.083Z' - :param max_results: int (optional) - Max number of entries to return in a single page. The system may return fewer than max_results - events in a response, even if there are more events available. - :param order_by: List[str] (optional) - A string indicating a sort order by timestamp for the results, for example, ["timestamp asc"]. The - sort order can be ascending or descending. By default, events are returned in descending order by - timestamp. - :param page_token: str (optional) - Page token returned by previous call. This field is mutually exclusive with all fields in this - request except max_results. An error is returned if any fields other than max_results are set when - this field is set. - - :returns: Iterator over :class:`PipelineEvent` - - - .. py:method:: list_pipelines( [, filter, max_results, order_by, page_token]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import pipelines - - w = WorkspaceClient() - - all = w.pipelines.list_pipelines(pipelines.ListPipelinesRequest()) - - List pipelines. - - Lists pipelines defined in the Delta Live Tables system. - - :param filter: str (optional) - Select a subset of results based on the specified criteria. The supported filters are: - - * `notebook=''` to select pipelines that reference the provided notebook path. * `name LIKE - '[pattern]'` to select pipelines with a name that matches pattern. Wildcards are supported, for - example: `name LIKE '%shopping%'` - - Composite filters are not supported. This field is optional. - :param max_results: int (optional) - The maximum number of entries to return in a single page. The system may return fewer than - max_results events in a response, even if there are more events available. This field is optional. - The default value is 25. The maximum value is 100. An error is returned if the value of max_results - is greater than 100. - :param order_by: List[str] (optional) - A list of strings specifying the order of results. Supported order_by fields are id and name. The - default is id asc. This field is optional. - :param page_token: str (optional) - Page token returned by previous call - - :returns: Iterator over :class:`PipelineStateInfo` - - - .. py:method:: list_updates(pipeline_id [, max_results, page_token, until_update_id]) - - List pipeline updates. - - List updates for an active pipeline. - - :param pipeline_id: str - The pipeline to return updates for. - :param max_results: int (optional) - Max number of entries to return in a single page. - :param page_token: str (optional) - Page token returned by previous call - :param until_update_id: str (optional) - If present, returns updates until and including this update_id. - - :returns: :class:`ListUpdatesResponse` - - - .. py:method:: reset(pipeline_id) - - Reset a pipeline. - - Resets a pipeline. - - :param pipeline_id: str - - :returns: - Long-running operation waiter for :class:`GetPipelineResponse`. - See :method:wait_get_pipeline_running for more details. - - - .. py:method:: set_permissions(pipeline_id [, access_control_list]) - - Set pipeline permissions. - - Sets permissions on a pipeline. Pipelines can inherit permissions from their root object. - - :param pipeline_id: str - The pipeline for which to get or manage permissions. - :param access_control_list: List[:class:`PipelineAccessControlRequest`] (optional) - - :returns: :class:`PipelinePermissions` - - - .. py:method:: start_update(pipeline_id [, cause, full_refresh, full_refresh_selection, refresh_selection]) - - Start a pipeline. - - Starts a new update for the pipeline. If there is already an active update for the pipeline, the - request will fail and the active update will remain running. - - :param pipeline_id: str - :param cause: :class:`StartUpdateCause` (optional) - :param full_refresh: bool (optional) - If true, this update will reset all tables before running. - :param full_refresh_selection: List[str] (optional) - A list of tables to update with fullRefresh. If both refresh_selection and full_refresh_selection - are empty, this is a full graph update. Full Refresh on a table means that the states of the table - will be reset before the refresh. - :param refresh_selection: List[str] (optional) - A list of tables to update without fullRefresh. If both refresh_selection and full_refresh_selection - are empty, this is a full graph update. Full Refresh on a table means that the states of the table - will be reset before the refresh. - - :returns: :class:`StartUpdateResponse` - - - .. py:method:: stop(pipeline_id) - - Stop a pipeline. - - Stops the pipeline by canceling the active update. If there is no active update for the pipeline, this - request is a no-op. - - :param pipeline_id: str - - :returns: - Long-running operation waiter for :class:`GetPipelineResponse`. - See :method:wait_get_pipeline_idle for more details. - - - .. py:method:: update(pipeline_id [, allow_duplicate_names, catalog, channel, clusters, configuration, continuous, development, edition, expected_last_modified, filters, id, libraries, name, notifications, photon, serverless, storage, target, trigger]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import pipelines - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - created = w.pipelines.create( - continuous=False, - name=f'sdk-{time.time_ns()}', - libraries=[pipelines.PipelineLibrary(notebook=pipelines.NotebookLibrary(path=notebook_path))], - clusters=[ - pipelines.PipelineCluster(instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - label="default", - num_workers=1, - custom_tags={ - "cluster_type": "default", - }) - ]) - - w.pipelines.update( - pipeline_id=created.pipeline_id, - name=f'sdk-{time.time_ns()}', - libraries=[pipelines.PipelineLibrary(notebook=pipelines.NotebookLibrary(path=notebook_path))], - clusters=[ - pipelines.PipelineCluster(instance_pool_id=os.environ["TEST_INSTANCE_POOL_ID"], - label="default", - num_workers=1, - custom_tags={ - "cluster_type": "default", - }) - ]) - - # cleanup - w.pipelines.delete(pipeline_id=created.pipeline_id) - - Edit a pipeline. - - Updates a pipeline with the supplied configuration. - - :param pipeline_id: str - Unique identifier for this pipeline. - :param allow_duplicate_names: bool (optional) - If false, deployment will fail if name has changed and conflicts the name of another pipeline. - :param catalog: str (optional) - A catalog in Unity Catalog to publish data from this pipeline to. If `target` is specified, tables - in this pipeline are published to a `target` schema inside `catalog` (for example, - `catalog`.`target`.`table`). If `target` is not specified, no data is published to Unity Catalog. - :param channel: str (optional) - DLT Release Channel that specifies which version to use. - :param clusters: List[:class:`PipelineCluster`] (optional) - Cluster settings for this pipeline deployment. - :param configuration: Dict[str,str] (optional) - String-String configuration for this pipeline execution. - :param continuous: bool (optional) - Whether the pipeline is continuous or triggered. This replaces `trigger`. - :param development: bool (optional) - Whether the pipeline is in Development mode. Defaults to false. - :param edition: str (optional) - Pipeline product edition. - :param expected_last_modified: int (optional) - If present, the last-modified time of the pipeline settings before the edit. If the settings were - modified after that time, then the request will fail with a conflict. - :param filters: :class:`Filters` (optional) - Filters on which Pipeline packages to include in the deployed graph. - :param id: str (optional) - Unique identifier for this pipeline. - :param libraries: List[:class:`PipelineLibrary`] (optional) - Libraries or code needed by this deployment. - :param name: str (optional) - Friendly identifier for this pipeline. - :param notifications: List[:class:`Notifications`] (optional) - List of notification settings for this pipeline. - :param photon: bool (optional) - Whether Photon is enabled for this pipeline. - :param serverless: bool (optional) - Whether serverless compute is enabled for this pipeline. - :param storage: str (optional) - DBFS root directory for storing checkpoints and tables. - :param target: str (optional) - Target schema (database) to add tables in this pipeline to. If not specified, no data is published - to the Hive metastore or Unity Catalog. To publish to Unity Catalog, also specify `catalog`. - :param trigger: :class:`PipelineTrigger` (optional) - Which pipeline trigger to use. Deprecated: Use `continuous` instead. - - - - - .. py:method:: update_permissions(pipeline_id [, access_control_list]) - - Update pipeline permissions. - - Updates the permissions on a pipeline. Pipelines can inherit permissions from their root object. - - :param pipeline_id: str - The pipeline for which to get or manage permissions. - :param access_control_list: List[:class:`PipelineAccessControlRequest`] (optional) - - :returns: :class:`PipelinePermissions` - \ No newline at end of file diff --git a/docs/workspace/policy_families.rst b/docs/workspace/policy_families.rst deleted file mode 100644 index 326612738..000000000 --- a/docs/workspace/policy_families.rst +++ /dev/null @@ -1,62 +0,0 @@ -Policy Families -=============== -.. py:class:: PolicyFamiliesAPI - - View available policy families. A policy family contains a policy definition providing best practices for - configuring clusters for a particular use case. - - Databricks manages and provides policy families for several common cluster use cases. You cannot create, - edit, or delete policy families. - - Policy families cannot be used directly to create clusters. Instead, you create cluster policies using a - policy family. Cluster policies created using a policy family inherit the policy family's policy - definition. - - .. py:method:: get(policy_family_id) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - all = w.policy_families.list(compute.ListPolicyFamiliesRequest()) - - first_family = w.policy_families.get(policy_family_id=all[0].policy_family_id) - - Get policy family information. - - Retrieve the information for an policy family based on its identifier. - - :param policy_family_id: str - - :returns: :class:`PolicyFamily` - - - .. py:method:: list( [, max_results, page_token]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import compute - - w = WorkspaceClient() - - all = w.policy_families.list(compute.ListPolicyFamiliesRequest()) - - List policy families. - - Retrieve a list of policy families. This API is paginated. - - :param max_results: int (optional) - The max number of policy families to return. - :param page_token: str (optional) - A token that can be used to get the next page of results. - - :returns: Iterator over :class:`PolicyFamily` - \ No newline at end of file diff --git a/docs/workspace/providers.rst b/docs/workspace/providers.rst deleted file mode 100644 index 8a543c2e0..000000000 --- a/docs/workspace/providers.rst +++ /dev/null @@ -1,205 +0,0 @@ -Providers -========= -.. py:class:: ProvidersAPI - - A data provider is an object representing the organization in the real world who shares the data. A - provider contains shares which further contain the shared data. - - .. py:method:: create(name, authentication_type [, comment, recipient_profile_str]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - public_share_recipient = """{ - "shareCredentialsVersion":1, - "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz", - "endpoint":"https://sharing.delta.io/delta-sharing/" - } - """ - - created = w.providers.create(name=f'sdk-{time.time_ns()}', recipient_profile_str=public_share_recipient) - - # cleanup - w.providers.delete(name=created.name) - - Create an auth provider. - - Creates a new authentication provider minimally based on a name and authentication type. The caller - must be an admin on the metastore. - - :param name: str - The name of the Provider. - :param authentication_type: :class:`AuthenticationType` - The delta sharing authentication type. - :param comment: str (optional) - Description about the provider. - :param recipient_profile_str: str (optional) - This field is required when the __authentication_type__ is **TOKEN** or not provided. - - :returns: :class:`ProviderInfo` - - - .. py:method:: delete(name) - - Delete a provider. - - Deletes an authentication provider, if the caller is a metastore admin or is the owner of the - provider. - - :param name: str - Name of the provider. - - - - - .. py:method:: get(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - public_share_recipient = """{ - "shareCredentialsVersion":1, - "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz", - "endpoint":"https://sharing.delta.io/delta-sharing/" - } - """ - - created = w.providers.create(name=f'sdk-{time.time_ns()}', recipient_profile_str=public_share_recipient) - - _ = w.providers.get(name=created.name) - - # cleanup - w.providers.delete(name=created.name) - - Get a provider. - - Gets a specific authentication provider. The caller must supply the name of the provider, and must - either be a metastore admin or the owner of the provider. - - :param name: str - Name of the provider. - - :returns: :class:`ProviderInfo` - - - .. py:method:: list( [, data_provider_global_metastore_id]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sharing - - w = WorkspaceClient() - - all = w.providers.list(sharing.ListProvidersRequest()) - - List providers. - - Gets an array of available authentication providers. The caller must either be a metastore admin or - the owner of the providers. Providers not owned by the caller are not included in the response. There - is no guarantee of a specific ordering of the elements in the array. - - :param data_provider_global_metastore_id: str (optional) - If not provided, all providers will be returned. If no providers exist with this ID, no results will - be returned. - - :returns: Iterator over :class:`ProviderInfo` - - - .. py:method:: list_shares(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - public_share_recipient = """{ - "shareCredentialsVersion":1, - "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz", - "endpoint":"https://sharing.delta.io/delta-sharing/" - } - """ - - created = w.providers.create(name=f'sdk-{time.time_ns()}', recipient_profile_str=public_share_recipient) - - shares = w.providers.list_shares(name=created.name) - - # cleanup - w.providers.delete(name=created.name) - - List shares by Provider. - - Gets an array of a specified provider's shares within the metastore where: - - * the caller is a metastore admin, or * the caller is the owner. - - :param name: str - Name of the provider in which to list shares. - - :returns: Iterator over :class:`ProviderShare` - - - .. py:method:: update(name [, comment, owner, recipient_profile_str]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - public_share_recipient = """{ - "shareCredentialsVersion":1, - "bearerToken":"dapiabcdefghijklmonpqrstuvwxyz", - "endpoint":"https://sharing.delta.io/delta-sharing/" - } - """ - - created = w.providers.create(name=f'sdk-{time.time_ns()}', recipient_profile_str=public_share_recipient) - - _ = w.providers.update(name=created.name, comment="Comment for update") - - # cleanup - w.providers.delete(name=created.name) - - Update a provider. - - Updates the information for an authentication provider, if the caller is a metastore admin or is the - owner of the provider. If the update changes the provider name, the caller must be both a metastore - admin and the owner of the provider. - - :param name: str - The name of the Provider. - :param comment: str (optional) - Description about the provider. - :param owner: str (optional) - Username of Provider owner. - :param recipient_profile_str: str (optional) - This field is required when the __authentication_type__ is **TOKEN** or not provided. - - :returns: :class:`ProviderInfo` - \ No newline at end of file diff --git a/docs/workspace/queries.rst b/docs/workspace/queries.rst deleted file mode 100644 index a5bf46983..000000000 --- a/docs/workspace/queries.rst +++ /dev/null @@ -1,199 +0,0 @@ -Queries / Results -================= -.. py:class:: QueriesAPI - - These endpoints are used for CRUD operations on query definitions. Query definitions include the target - SQL warehouse, query text, name, description, tags, parameters, and visualizations. Queries can be - scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create. - - .. py:method:: create( [, data_source_id, description, name, options, parent, query, run_as_role]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - query = w.queries.create(name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="test query from Go SDK", - query="SHOW TABLES") - - # cleanup - w.queries.delete(query_id=query.id) - - Create a new query definition. - - Creates a new query definition. Queries created with this endpoint belong to the authenticated user - making the request. - - The `data_source_id` field specifies the ID of the SQL warehouse to run this query against. You can - use the Data Sources API to see a complete list of available SQL warehouses. Or you can copy the - `data_source_id` from an existing query. - - **Note**: You cannot add a visualization until you create the query. - - :param data_source_id: str (optional) - Data source ID. - :param description: str (optional) - General description that conveys additional information about this query such as usage notes. - :param name: str (optional) - The title of this query that appears in list views, widget headings, and on the query page. - :param options: Any (optional) - Exclusively used for storing a list parameter definitions. A parameter is an object with `title`, - `name`, `type`, and `value` properties. The `value` field here is the default value. It can be - overridden at runtime. - :param parent: str (optional) - The identifier of the workspace folder containing the object. - :param query: str (optional) - The text of the query to be run. - :param run_as_role: :class:`RunAsRole` (optional) - Run as role - - :returns: :class:`Query` - - - .. py:method:: delete(query_id) - - Delete a query. - - Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and - they cannot be used for alerts. The trash is deleted after 30 days. - - :param query_id: str - - - - - .. py:method:: get(query_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - query = w.queries.create(name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="test query from Go SDK", - query="SHOW TABLES") - - by_id = w.queries.get(query_id=query.id) - - # cleanup - w.queries.delete(query_id=query.id) - - Get a query definition. - - Retrieve a query object definition along with contextual permissions information about the currently - authenticated user. - - :param query_id: str - - :returns: :class:`Query` - - - .. py:method:: list( [, order, page, page_size, q]) - - Get a list of queries. - - Gets a list of queries. Optionally, this list can be filtered by a search term. - - :param order: str (optional) - Name of query attribute to order by. Default sort order is ascending. Append a dash (`-`) to order - descending instead. - - - `name`: The name of the query. - - - `created_at`: The timestamp the query was created. - - - `runtime`: The time it took to run this query. This is blank for parameterized queries. A blank - value is treated as the highest value for sorting. - - - `executed_at`: The timestamp when the query was last run. - - - `created_by`: The user name of the user that created the query. - :param page: int (optional) - Page number to retrieve. - :param page_size: int (optional) - Number of queries to return per page. - :param q: str (optional) - Full text search term - - :returns: Iterator over :class:`Query` - - - .. py:method:: restore(query_id) - - Restore a query. - - Restore a query that has been moved to the trash. A restored query appears in list views and searches. - You can use restored queries for alerts. - - :param query_id: str - - - - - .. py:method:: update(query_id [, data_source_id, description, name, options, query]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - srcs = w.data_sources.list() - - query = w.queries.create(name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="test query from Go SDK", - query="SHOW TABLES") - - updated = w.queries.update(query_id=query.id, - name=f'sdk-{time.time_ns()}', - data_source_id=srcs[0].id, - description="UPDATED: test query from Go SDK", - query="SELECT 2+2") - - # cleanup - w.queries.delete(query_id=query.id) - - Change a query definition. - - Modify this query definition. - - **Note**: You cannot undo this operation. - - :param query_id: str - :param data_source_id: str (optional) - Data source ID. - :param description: str (optional) - General description that conveys additional information about this query such as usage notes. - :param name: str (optional) - The title of this query that appears in list views, widget headings, and on the query page. - :param options: Any (optional) - Exclusively used for storing a list parameter definitions. A parameter is an object with `title`, - `name`, `type`, and `value` properties. The `value` field here is the default value. It can be - overridden at runtime. - :param query: str (optional) - The text of the query to be run. - - :returns: :class:`Query` - \ No newline at end of file diff --git a/docs/workspace/query_history.rst b/docs/workspace/query_history.rst deleted file mode 100644 index dd07d9a8d..000000000 --- a/docs/workspace/query_history.rst +++ /dev/null @@ -1,37 +0,0 @@ -Query History -============= -.. py:class:: QueryHistoryAPI - - Access the history of queries through SQL warehouses. - - .. py:method:: list( [, filter_by, include_metrics, max_results, page_token]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sql - - w = WorkspaceClient() - - _ = w.query_history.list(filter_by=sql.QueryFilter( - query_start_time_range=sql.TimeRange(start_time_ms=1690243200000, end_time_ms=1690329600000))) - - List Queries. - - List the history of queries through SQL warehouses. - - You can filter by user ID, warehouse ID, status, and time range. - - :param filter_by: :class:`QueryFilter` (optional) - A filter to limit query history results. This field is optional. - :param include_metrics: bool (optional) - Whether to include metrics about query. - :param max_results: int (optional) - Limit the number of results returned in one page. The default is 100. - :param page_token: str (optional) - A token that can be used to get the next page of results. - - :returns: Iterator over :class:`QueryInfo` - \ No newline at end of file diff --git a/docs/workspace/query_visualizations.rst b/docs/workspace/query_visualizations.rst deleted file mode 100644 index 240e1f63a..000000000 --- a/docs/workspace/query_visualizations.rst +++ /dev/null @@ -1,55 +0,0 @@ -Query Visualizations -==================== -.. py:class:: QueryVisualizationsAPI - - This is an evolving API that facilitates the addition and removal of vizualisations from existing queries - within the Databricks Workspace. Data structures may change over time. - - .. py:method:: create(query_id, type, options [, description, name]) - - Add visualization to a query. - - :param query_id: str - The identifier returned by :method:queries/create - :param type: str - The type of visualization: chart, table, pivot table, and so on. - :param options: Any - The options object varies widely from one visualization type to the next and is unsupported. - Databricks does not recommend modifying visualization settings in JSON. - :param description: str (optional) - A short description of this visualization. This is not displayed in the UI. - :param name: str (optional) - The name of the visualization that appears on dashboards and the query screen. - - :returns: :class:`Visualization` - - - .. py:method:: delete(id) - - Remove visualization. - - :param id: str - - - - - .. py:method:: update(id [, created_at, description, name, options, type, updated_at]) - - Edit existing visualization. - - :param id: str - The UUID for this visualization. - :param created_at: str (optional) - :param description: str (optional) - A short description of this visualization. This is not displayed in the UI. - :param name: str (optional) - The name of the visualization that appears on dashboards and the query screen. - :param options: Any (optional) - The options object varies widely from one visualization type to the next and is unsupported. - Databricks does not recommend modifying visualization settings in JSON. - :param type: str (optional) - The type of visualization: chart, table, pivot table, and so on. - :param updated_at: str (optional) - - :returns: :class:`Visualization` - \ No newline at end of file diff --git a/docs/workspace/recipient_activation.rst b/docs/workspace/recipient_activation.rst deleted file mode 100644 index b8bec317e..000000000 --- a/docs/workspace/recipient_activation.rst +++ /dev/null @@ -1,35 +0,0 @@ -Recipient Activation -==================== -.. py:class:: RecipientActivationAPI - - The Recipient Activation API is only applicable in the open sharing model where the recipient object has - the authentication type of `TOKEN`. The data recipient follows the activation link shared by the data - provider to download the credential file that includes the access token. The recipient will then use the - credential file to establish a secure connection with the provider to receive the shared data. - - Note that you can download the credential file only once. Recipients should treat the downloaded - credential as a secret and must not share it outside of their organization. - - .. py:method:: get_activation_url_info(activation_url) - - Get a share activation URL. - - Gets an activation URL for a share. - - :param activation_url: str - The one time activation url. It also accepts activation token. - - - - - .. py:method:: retrieve_token(activation_url) - - Get an access token. - - Retrieve access token with an activation url. This is a public API without any authentication. - - :param activation_url: str - The one time activation url. It also accepts activation token. - - :returns: :class:`RetrieveTokenResponse` - \ No newline at end of file diff --git a/docs/workspace/recipients.rst b/docs/workspace/recipients.rst deleted file mode 100644 index e31b927c2..000000000 --- a/docs/workspace/recipients.rst +++ /dev/null @@ -1,237 +0,0 @@ -Recipients -========== -.. py:class:: RecipientsAPI - - A recipient is an object you create using :method:recipients/create to represent an organization which you - want to allow access shares. The way how sharing works differs depending on whether or not your recipient - has access to a Databricks workspace that is enabled for Unity Catalog: - - - For recipients with access to a Databricks workspace that is enabled for Unity Catalog, you can create a - recipient object along with a unique sharing identifier you get from the recipient. The sharing identifier - is the key identifier that enables the secure connection. This sharing mode is called - **Databricks-to-Databricks sharing**. - - - For recipients without access to a Databricks workspace that is enabled for Unity Catalog, when you - create a recipient object, Databricks generates an activation link you can send to the recipient. The - recipient follows the activation link to download the credential file, and then uses the credential file - to establish a secure connection to receive the shared data. This sharing mode is called **open sharing**. - - .. py:method:: create(name, authentication_type [, comment, data_recipient_global_metastore_id, ip_access_list, owner, properties_kvpairs, sharing_code]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.recipients.create(name=f'sdk-{time.time_ns()}') - - # cleanup - w.recipients.delete(name=created.name) - - Create a share recipient. - - Creates a new recipient with the delta sharing authentication type in the metastore. The caller must - be a metastore admin or has the **CREATE_RECIPIENT** privilege on the metastore. - - :param name: str - Name of Recipient. - :param authentication_type: :class:`AuthenticationType` - The delta sharing authentication type. - :param comment: str (optional) - Description about the recipient. - :param data_recipient_global_metastore_id: str (optional) - The global Unity Catalog metastore id provided by the data recipient. This field is required when - the __authentication_type__ is **DATABRICKS**. The identifier is of format - __cloud__:__region__:__metastore-uuid__. - :param ip_access_list: :class:`IpAccessList` (optional) - IP Access List - :param owner: str (optional) - Username of the recipient owner. - :param properties_kvpairs: :class:`SecurablePropertiesKvPairs` (optional) - Recipient properties as map of string key-value pairs. - :param sharing_code: str (optional) - The one-time sharing code provided by the data recipient. This field is required when the - __authentication_type__ is **DATABRICKS**. - - :returns: :class:`RecipientInfo` - - - .. py:method:: delete(name) - - Delete a share recipient. - - Deletes the specified recipient from the metastore. The caller must be the owner of the recipient. - - :param name: str - Name of the recipient. - - - - - .. py:method:: get(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.recipients.create(name=f'sdk-{time.time_ns()}') - - _ = w.recipients.get(name=created.name) - - # cleanup - w.recipients.delete(name=created.name) - - Get a share recipient. - - Gets a share recipient from the metastore if: - - * the caller is the owner of the share recipient, or: * is a metastore admin - - :param name: str - Name of the recipient. - - :returns: :class:`RecipientInfo` - - - .. py:method:: list( [, data_recipient_global_metastore_id]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sharing - - w = WorkspaceClient() - - all = w.recipients.list(sharing.ListRecipientsRequest()) - - List share recipients. - - Gets an array of all share recipients within the current metastore where: - - * the caller is a metastore admin, or * the caller is the owner. There is no guarantee of a specific - ordering of the elements in the array. - - :param data_recipient_global_metastore_id: str (optional) - If not provided, all recipients will be returned. If no recipients exist with this ID, no results - will be returned. - - :returns: Iterator over :class:`RecipientInfo` - - - .. py:method:: rotate_token(name, existing_token_expire_in_seconds) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.recipients.create(name=f'sdk-{time.time_ns()}') - - recipient_info = w.recipients.rotate_token(name=created.name, existing_token_expire_in_seconds=0) - - # cleanup - w.recipients.delete(name=created.name) - - Rotate a token. - - Refreshes the specified recipient's delta sharing authentication token with the provided token info. - The caller must be the owner of the recipient. - - :param name: str - The name of the recipient. - :param existing_token_expire_in_seconds: int - The expiration time of the bearer token in ISO 8601 format. This will set the expiration_time of - existing token only to a smaller timestamp, it cannot extend the expiration_time. Use 0 to expire - the existing token immediately, negative number will return an error. - - :returns: :class:`RecipientInfo` - - - .. py:method:: share_permissions(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.recipients.create(name=f'sdk-{time.time_ns()}') - - share_permissions = w.recipients.share_permissions(name=created.name) - - # cleanup - w.recipients.delete(name=created.name) - - Get recipient share permissions. - - Gets the share permissions for the specified Recipient. The caller must be a metastore admin or the - owner of the Recipient. - - :param name: str - The name of the Recipient. - - :returns: :class:`GetRecipientSharePermissionsResponse` - - - .. py:method:: update(name [, comment, ip_access_list, owner, properties_kvpairs]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.recipients.create(name=f'sdk-{time.time_ns()}') - - w.recipients.update(name=created.name, comment=f'sdk-{time.time_ns()}') - - # cleanup - w.recipients.delete(name=created.name) - - Update a share recipient. - - Updates an existing recipient in the metastore. The caller must be a metastore admin or the owner of - the recipient. If the recipient name will be updated, the user must be both a metastore admin and the - owner of the recipient. - - :param name: str - Name of Recipient. - :param comment: str (optional) - Description about the recipient. - :param ip_access_list: :class:`IpAccessList` (optional) - IP Access List - :param owner: str (optional) - Username of the recipient owner. - :param properties_kvpairs: :class:`SecurablePropertiesKvPairs` (optional) - Recipient properties as map of string key-value pairs. When provided in update request, the - specified properties will override the existing properties. To add and remove properties, one would - need to perform a read-modify-write. - - - \ No newline at end of file diff --git a/docs/workspace/registered_models.rst b/docs/workspace/registered_models.rst deleted file mode 100644 index c546734fd..000000000 --- a/docs/workspace/registered_models.rst +++ /dev/null @@ -1,181 +0,0 @@ -Registered Models -================= -.. py:class:: RegisteredModelsAPI - - Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. Models in Unity Catalog - provide centralized access control, auditing, lineage, and discovery of ML models across Databricks - workspaces. - - An MLflow registered model resides in the third layer of Unity Catalog’s three-level namespace. - Registered models contain model versions, which correspond to actual ML models (MLflow models). Creating - new model versions currently requires use of the MLflow Python client. Once model versions are created, - you can load them for batch inference using MLflow Python client APIs, or deploy them for real-time - serving using Databricks Model Serving. - - All operations on registered models and model versions require USE_CATALOG permissions on the enclosing - catalog and USE_SCHEMA permissions on the enclosing schema. In addition, the following additional - privileges are required for various operations: - - * To create a registered model, users must additionally have the CREATE_MODEL permission on the target - schema. * To view registered model or model version metadata, model version data files, or invoke a model - version, users must additionally have the EXECUTE permission on the registered model * To update - registered model or model version tags, users must additionally have APPLY TAG permissions on the - registered model * To update other registered model or model version metadata (comments, aliases) create a - new model version, or update permissions on the registered model, users must be owners of the registered - model. - - Note: The securable type for models is "FUNCTION". When using REST APIs (e.g. tagging, grants) that - specify a securable type, use "FUNCTION" as the securable type. - - .. py:method:: create(catalog_name, schema_name, name [, comment, storage_location]) - - Create a Registered Model. - - Creates a new registered model in Unity Catalog. - - File storage for model versions in the registered model will be located in the default location which - is specified by the parent schema, or the parent catalog, or the Metastore. - - For registered model creation to succeed, the user must satisfy the following conditions: - The caller - must be a metastore admin, or be the owner of the parent catalog and schema, or have the - **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - The caller must have the **CREATE MODEL** or **CREATE FUNCTION** privilege on the parent schema. - - :param catalog_name: str - The name of the catalog where the schema and the registered model reside - :param schema_name: str - The name of the schema where the registered model resides - :param name: str - The name of the registered model - :param comment: str (optional) - The comment attached to the registered model - :param storage_location: str (optional) - The storage location on the cloud under which model version data files are stored - - :returns: :class:`RegisteredModelInfo` - - - .. py:method:: delete(full_name) - - Delete a Registered Model. - - Deletes a registered model and all its model versions from the specified parent catalog and schema. - - The caller must be a metastore admin or an owner of the registered model. For the latter case, the - caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - The three-level (fully qualified) name of the registered model - - - - - .. py:method:: delete_alias(full_name, alias) - - Delete a Registered Model Alias. - - Deletes a registered model alias. - - The caller must be a metastore admin or an owner of the registered model. For the latter case, the - caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - The three-level (fully qualified) name of the registered model - :param alias: str - The name of the alias - - - - - .. py:method:: get(full_name) - - Get a Registered Model. - - Get a registered model. - - The caller must be a metastore admin or an owner of (or have the **EXECUTE** privilege on) the - registered model. For the latter case, the caller must also be the owner or have the **USE_CATALOG** - privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - The three-level (fully qualified) name of the registered model - - :returns: :class:`RegisteredModelInfo` - - - .. py:method:: list( [, catalog_name, max_results, page_token, schema_name]) - - List Registered Models. - - List registered models. You can list registered models under a particular schema, or list all - registered models in the current metastore. - - The returned models are filtered based on the privileges of the calling user. For example, the - metastore admin is able to list all the registered models. A regular user needs to be the owner or - have the **EXECUTE** privilege on the registered model to recieve the registered models in the - response. For the latter case, the caller must also be the owner or have the **USE_CATALOG** privilege - on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - There is no guarantee of a specific ordering of the elements in the response. - - :param catalog_name: str (optional) - The identifier of the catalog under which to list registered models. If specified, schema_name must - be specified. - :param max_results: int (optional) - Max number of registered models to return. If catalog and schema are unspecified, max_results must - be specified. If max_results is unspecified, we return all results, starting from the page specified - by page_token. - :param page_token: str (optional) - Opaque token to send for the next page of results (pagination). - :param schema_name: str (optional) - The identifier of the schema under which to list registered models. If specified, catalog_name must - be specified. - - :returns: Iterator over :class:`RegisteredModelInfo` - - - .. py:method:: set_alias(full_name, alias, version_num) - - Set a Registered Model Alias. - - Set an alias on the specified registered model. - - The caller must be a metastore admin or an owner of the registered model. For the latter case, the - caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - Full name of the registered model - :param alias: str - The name of the alias - :param version_num: int - The version number of the model version to which the alias points - - :returns: :class:`RegisteredModelAlias` - - - .. py:method:: update(full_name [, comment, name, owner]) - - Update a Registered Model. - - Updates the specified registered model. - - The caller must be a metastore admin or an owner of the registered model. For the latter case, the - caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - Currently only the name, the owner or the comment of the registered model can be updated. - - :param full_name: str - The three-level (fully qualified) name of the registered model - :param comment: str (optional) - The comment attached to the registered model - :param name: str (optional) - The name of the registered model - :param owner: str (optional) - The identifier of the user who owns the registered model - - :returns: :class:`RegisteredModelInfo` - \ No newline at end of file diff --git a/docs/workspace/repos.rst b/docs/workspace/repos.rst deleted file mode 100644 index a64a9f23a..000000000 --- a/docs/workspace/repos.rst +++ /dev/null @@ -1,213 +0,0 @@ -Repos -===== -.. py:class:: ReposAPI - - The Repos API allows users to manage their git repos. Users can use the API to access all repos that they - have manage permissions on. - - Databricks Repos is a visual Git client in Databricks. It supports common Git operations such a cloning a - repository, committing and pushing, pulling, branch management, and visual comparison of diffs when - committing. - - Within Repos you can develop code in notebooks or other files and follow data science and engineering code - development best practices using Git for version control, collaboration, and CI/CD. - - .. py:method:: create(url, provider [, path, sparse_checkout]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - root = f'sdk-{time.time_ns()}' - - ri = w.repos.create(path=root, url="https://github.com/shreyas-goenka/empty-repo.git", provider="github") - - # cleanup - w.repos.delete(repo_id=ri.id) - - Create a repo. - - Creates a repo in the workspace and links it to the remote Git repo specified. Note that repos created - programmatically must be linked to a remote Git repo, unlike repos created in the browser. - - :param url: str - URL of the Git repository to be linked. - :param provider: str - Git provider. This field is case-insensitive. The available Git providers are gitHub, - bitbucketCloud, gitLab, azureDevOpsServices, gitHubEnterprise, bitbucketServer, - gitLabEnterpriseEdition and awsCodeCommit. - :param path: str (optional) - Desired path for the repo in the workspace. Must be in the format /Repos/{folder}/{repo-name}. - :param sparse_checkout: :class:`SparseCheckout` (optional) - If specified, the repo will be created with sparse checkout enabled. You cannot enable/disable - sparse checkout after the repo is created. - - :returns: :class:`RepoInfo` - - - .. py:method:: delete(repo_id) - - Delete a repo. - - Deletes the specified repo. - - :param repo_id: int - The ID for the corresponding repo to access. - - - - - .. py:method:: get(repo_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - root = f'sdk-{time.time_ns()}' - - ri = w.repos.create(path=root, url="https://github.com/shreyas-goenka/empty-repo.git", provider="github") - - by_id = w.repos.get(repo_id=ri.id) - - # cleanup - w.repos.delete(repo_id=ri.id) - - Get a repo. - - Returns the repo with the given repo ID. - - :param repo_id: int - The ID for the corresponding repo to access. - - :returns: :class:`RepoInfo` - - - .. py:method:: get_permission_levels(repo_id) - - Get repo permission levels. - - Gets the permission levels that a user can have on an object. - - :param repo_id: str - The repo for which to get or manage permissions. - - :returns: :class:`GetRepoPermissionLevelsResponse` - - - .. py:method:: get_permissions(repo_id) - - Get repo permissions. - - Gets the permissions of a repo. Repos can inherit permissions from their root object. - - :param repo_id: str - The repo for which to get or manage permissions. - - :returns: :class:`RepoPermissions` - - - .. py:method:: list( [, next_page_token, path_prefix]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import workspace - - w = WorkspaceClient() - - all = w.repos.list(workspace.ListReposRequest()) - - Get repos. - - Returns repos that the calling user has Manage permissions on. Results are paginated with each page - containing twenty repos. - - :param next_page_token: str (optional) - Token used to get the next page of results. If not specified, returns the first page of results as - well as a next page token if there are more results. - :param path_prefix: str (optional) - Filters repos that have paths starting with the given path prefix. - - :returns: Iterator over :class:`RepoInfo` - - - .. py:method:: set_permissions(repo_id [, access_control_list]) - - Set repo permissions. - - Sets permissions on a repo. Repos can inherit permissions from their root object. - - :param repo_id: str - The repo for which to get or manage permissions. - :param access_control_list: List[:class:`RepoAccessControlRequest`] (optional) - - :returns: :class:`RepoPermissions` - - - .. py:method:: update(repo_id [, branch, sparse_checkout, tag]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - root = f'sdk-{time.time_ns()}' - - ri = w.repos.create(path=root, url="https://github.com/shreyas-goenka/empty-repo.git", provider="github") - - w.repos.update(repo_id=ri.id, branch="foo") - - # cleanup - w.repos.delete(repo_id=ri.id) - - Update a repo. - - Updates the repo to a different branch or tag, or updates the repo to the latest commit on the same - branch. - - :param repo_id: int - The ID for the corresponding repo to access. - :param branch: str (optional) - Branch that the local version of the repo is checked out to. - :param sparse_checkout: :class:`SparseCheckoutUpdate` (optional) - If specified, update the sparse checkout settings. The update will fail if sparse checkout is not - enabled for the repo. - :param tag: str (optional) - Tag that the local version of the repo is checked out to. Updating the repo to a tag puts the repo - in a detached HEAD state. Before committing new changes, you must update the repo to a branch - instead of the detached HEAD. - - - - - .. py:method:: update_permissions(repo_id [, access_control_list]) - - Update repo permissions. - - Updates the permissions on a repo. Repos can inherit permissions from their root object. - - :param repo_id: str - The repo for which to get or manage permissions. - :param access_control_list: List[:class:`RepoAccessControlRequest`] (optional) - - :returns: :class:`RepoPermissions` - \ No newline at end of file diff --git a/docs/workspace/schemas.rst b/docs/workspace/schemas.rst deleted file mode 100644 index 940016aab..000000000 --- a/docs/workspace/schemas.rst +++ /dev/null @@ -1,170 +0,0 @@ -Schemas -======= -.. py:class:: SchemasAPI - - A schema (also called a database) is the second layer of Unity Catalog’s three-level namespace. A schema - organizes tables, views and functions. To access (or list) a table or view in a schema, users must have - the USE_SCHEMA data permission on the schema and its parent catalog, and they must have the SELECT - permission on the table or view. - - .. py:method:: create(name, catalog_name [, comment, properties, storage_root]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - # cleanup - w.catalogs.delete(name=created_catalog.name, force=True) - w.schemas.delete(full_name=created_schema.full_name) - - Create a schema. - - Creates a new schema for catalog in the Metatastore. The caller must be a metastore admin, or have the - **CREATE_SCHEMA** privilege in the parent catalog. - - :param name: str - Name of schema, relative to parent catalog. - :param catalog_name: str - Name of parent catalog. - :param comment: str (optional) - User-provided free-form text description. - :param properties: Dict[str,str] (optional) - A map of key-value properties attached to the securable. - :param storage_root: str (optional) - Storage root URL for managed tables within schema. - - :returns: :class:`SchemaInfo` - - - .. py:method:: delete(full_name) - - Delete a schema. - - Deletes the specified schema from the parent catalog. The caller must be the owner of the schema or an - owner of the parent catalog. - - :param full_name: str - Full name of the schema. - - - - - .. py:method:: get(full_name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - new_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=new_catalog.name) - - _ = w.schemas.get(full_name=created.full_name) - - # cleanup - w.catalogs.delete(name=new_catalog.name, force=True) - w.schemas.delete(full_name=created.full_name) - - Get a schema. - - Gets the specified schema within the metastore. The caller must be a metastore admin, the owner of the - schema, or a user that has the **USE_SCHEMA** privilege on the schema. - - :param full_name: str - Full name of the schema. - - :returns: :class:`SchemaInfo` - - - .. py:method:: list(catalog_name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - new_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - all = w.schemas.list(catalog_name=new_catalog.name) - - # cleanup - w.catalogs.delete(name=new_catalog.name, force=True) - - List schemas. - - Gets an array of schemas for a catalog in the metastore. If the caller is the metastore admin or the - owner of the parent catalog, all schemas for the catalog will be retrieved. Otherwise, only schemas - owned by the caller (or for which the caller has the **USE_SCHEMA** privilege) will be retrieved. - There is no guarantee of a specific ordering of the elements in the array. - - :param catalog_name: str - Parent catalog for schemas of interest. - - :returns: Iterator over :class:`SchemaInfo` - - - .. py:method:: update(full_name [, comment, enable_predictive_optimization, name, owner, properties]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - new_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=new_catalog.name) - - _ = w.schemas.update(full_name=created.full_name, comment=f'sdk-{time.time_ns()}') - - # cleanup - w.catalogs.delete(name=new_catalog.name, force=True) - w.schemas.delete(full_name=created.full_name) - - Update a schema. - - Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin. If - the caller is a metastore admin, only the __owner__ field can be changed in the update. If the - __name__ field must be updated, the caller must be a metastore admin or have the **CREATE_SCHEMA** - privilege on the parent catalog. - - :param full_name: str - Full name of the schema. - :param comment: str (optional) - User-provided free-form text description. - :param enable_predictive_optimization: :class:`EnablePredictiveOptimization` (optional) - Whether predictive optimization should be enabled for this object and objects under it. - :param name: str (optional) - Name of schema, relative to parent catalog. - :param owner: str (optional) - Username of current owner of schema. - :param properties: Dict[str,str] (optional) - A map of key-value properties attached to the securable. - - :returns: :class:`SchemaInfo` - \ No newline at end of file diff --git a/docs/workspace/secrets.rst b/docs/workspace/secrets.rst deleted file mode 100644 index 9b0c80eef..000000000 --- a/docs/workspace/secrets.rst +++ /dev/null @@ -1,359 +0,0 @@ -Secret -====== -.. py:class:: SecretsAPI - - The Secrets API allows you to manage secrets, secret scopes, and access permissions. - - Sometimes accessing data requires that you authenticate to external data sources through JDBC. Instead of - directly entering your credentials into a notebook, use Databricks secrets to store your credentials and - reference them in notebooks and jobs. - - Administrators, secret creators, and users granted permission can read Databricks secrets. While - Databricks makes an effort to redact secret values that might be displayed in notebooks, it is not - possible to prevent such users from reading secrets. - - .. py:method:: create_scope(scope [, backend_azure_keyvault, initial_manage_principal, scope_backend_type]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - key_name = f'sdk-{time.time_ns()}' - - scope_name = f'sdk-{time.time_ns()}' - - w.secrets.create_scope(scope=scope_name) - - # cleanup - w.secrets.delete_secret(scope=scope_name, key=key_name) - w.secrets.delete_scope(scope=scope_name) - - Create a new secret scope. - - The scope name must consist of alphanumeric characters, dashes, underscores, and periods, and may not - exceed 128 characters. The maximum number of scopes in a workspace is 100. - - :param scope: str - Scope name requested by the user. Scope names are unique. - :param backend_azure_keyvault: :class:`AzureKeyVaultSecretScopeMetadata` (optional) - The metadata for the secret scope if the type is `AZURE_KEYVAULT` - :param initial_manage_principal: str (optional) - The principal that is initially granted `MANAGE` permission to the created scope. - :param scope_backend_type: :class:`ScopeBackendType` (optional) - The backend type the scope will be created with. If not specified, will default to `DATABRICKS` - - - - - .. py:method:: delete_acl(scope, principal) - - Delete an ACL. - - Deletes the given ACL on the given scope. - - Users must have the `MANAGE` permission to invoke this API. Throws `RESOURCE_DOES_NOT_EXIST` if no - such secret scope, principal, or ACL exists. Throws `PERMISSION_DENIED` if the user does not have - permission to make this API call. - - :param scope: str - The name of the scope to remove permissions from. - :param principal: str - The principal to remove an existing ACL from. - - - - - .. py:method:: delete_scope(scope) - - Delete a secret scope. - - Deletes a secret scope. - - Throws `RESOURCE_DOES_NOT_EXIST` if the scope does not exist. Throws `PERMISSION_DENIED` if the user - does not have permission to make this API call. - - :param scope: str - Name of the scope to delete. - - - - - .. py:method:: delete_secret(scope, key) - - Delete a secret. - - Deletes the secret stored in this secret scope. You must have `WRITE` or `MANAGE` permission on the - secret scope. - - Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope or secret exists. Throws `PERMISSION_DENIED` - if the user does not have permission to make this API call. - - :param scope: str - The name of the scope that contains the secret to delete. - :param key: str - Name of the secret to delete. - - - - - .. py:method:: get_acl(scope, principal) - - Get secret ACL details. - - Gets the details about the given ACL, such as the group and permission. Users must have the `MANAGE` - permission to invoke this API. - - Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `PERMISSION_DENIED` if the - user does not have permission to make this API call. - - :param scope: str - The name of the scope to fetch ACL information from. - :param principal: str - The principal to fetch ACL information for. - - :returns: :class:`AclItem` - - - .. py:method:: get_secret(scope, key) - - Get a secret. - - Gets the bytes representation of a secret value for the specified scope and key. - - Users need the READ permission to make this call. - - Note that the secret value returned is in bytes. The interpretation of the bytes is determined by the - caller in DBUtils and the type the data is decoded into. - - Throws ``PERMISSION_DENIED`` if the user does not have permission to make this API call. Throws - ``RESOURCE_DOES_NOT_EXIST`` if no such secret or secret scope exists. - - :param scope: str - The name of the scope to fetch secret information from. - :param key: str - The key to fetch secret for. - - :returns: :class:`GetSecretResponse` - - - .. py:method:: list_acls(scope) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - key_name = f'sdk-{time.time_ns()}' - - scope_name = f'sdk-{time.time_ns()}' - - w.secrets.create_scope(scope=scope_name) - - acls = w.secrets.list_acls(scope=scope_name) - - # cleanup - w.secrets.delete_secret(scope=scope_name, key=key_name) - w.secrets.delete_scope(scope=scope_name) - - Lists ACLs. - - List the ACLs for a given secret scope. Users must have the `MANAGE` permission to invoke this API. - - Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `PERMISSION_DENIED` if the - user does not have permission to make this API call. - - :param scope: str - The name of the scope to fetch ACL information from. - - :returns: Iterator over :class:`AclItem` - - - .. py:method:: list_scopes() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - scopes = w.secrets.list_scopes() - - List all scopes. - - Lists all secret scopes available in the workspace. - - Throws `PERMISSION_DENIED` if the user does not have permission to make this API call. - - :returns: Iterator over :class:`SecretScope` - - - .. py:method:: list_secrets(scope) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - key_name = f'sdk-{time.time_ns()}' - - scope_name = f'sdk-{time.time_ns()}' - - w.secrets.create_scope(scope=scope_name) - - scrts = w.secrets.list_secrets(scope=scope_name) - - # cleanup - w.secrets.delete_secret(scope=scope_name, key=key_name) - w.secrets.delete_scope(scope=scope_name) - - List secret keys. - - Lists the secret keys that are stored at this scope. This is a metadata-only operation; secret data - cannot be retrieved using this API. Users need the READ permission to make this call. - - The lastUpdatedTimestamp returned is in milliseconds since epoch. Throws `RESOURCE_DOES_NOT_EXIST` if - no such secret scope exists. Throws `PERMISSION_DENIED` if the user does not have permission to make - this API call. - - :param scope: str - The name of the scope to list secrets within. - - :returns: Iterator over :class:`SecretMetadata` - - - .. py:method:: put_acl(scope, principal, permission) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import workspace - - w = WorkspaceClient() - - key_name = f'sdk-{time.time_ns()}' - - group = w.groups.create(display_name=f'sdk-{time.time_ns()}') - - scope_name = f'sdk-{time.time_ns()}' - - w.secrets.create_scope(scope=scope_name) - - w.secrets.put_acl(scope=scope_name, permission=workspace.AclPermission.MANAGE, principal=group.display_name) - - # cleanup - w.groups.delete(id=group.id) - w.secrets.delete_secret(scope=scope_name, key=key_name) - w.secrets.delete_scope(scope=scope_name) - - Create/update an ACL. - - Creates or overwrites the Access Control List (ACL) associated with the given principal (user or - group) on the specified scope point. - - In general, a user or group will use the most powerful permission available to them, and permissions - are ordered as follows: - - * `MANAGE` - Allowed to change ACLs, and read and write to this secret scope. * `WRITE` - Allowed to - read and write to this secret scope. * `READ` - Allowed to read this secret scope and list what - secrets are available. - - Note that in general, secret values can only be read from within a command on a cluster (for example, - through a notebook). There is no API to read the actual secret value material outside of a cluster. - However, the user's permission will be applied based on who is executing the command, and they must - have at least READ permission. - - Users must have the `MANAGE` permission to invoke this API. - - The principal is a user or group name corresponding to an existing Databricks principal to be granted - or revoked access. - - Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `RESOURCE_ALREADY_EXISTS` if a - permission for the principal already exists. Throws `INVALID_PARAMETER_VALUE` if the permission or - principal is invalid. Throws `PERMISSION_DENIED` if the user does not have permission to make this API - call. - - :param scope: str - The name of the scope to apply permissions to. - :param principal: str - The principal in which the permission is applied. - :param permission: :class:`AclPermission` - The permission level applied to the principal. - - - - - .. py:method:: put_secret(scope, key [, bytes_value, string_value]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - key_name = f'sdk-{time.time_ns()}' - - scope_name = f'sdk-{time.time_ns()}' - - w.secrets.create_scope(scope=scope_name) - - w.secrets.put_secret(scope=scope_name, key=key_name, string_value=f'sdk-{time.time_ns()}') - - # cleanup - w.secrets.delete_secret(scope=scope_name, key=key_name) - w.secrets.delete_scope(scope=scope_name) - - Add a secret. - - Inserts a secret under the provided scope with the given name. If a secret already exists with the - same name, this command overwrites the existing secret's value. The server encrypts the secret using - the secret scope's encryption settings before storing it. - - You must have `WRITE` or `MANAGE` permission on the secret scope. The secret key must consist of - alphanumeric characters, dashes, underscores, and periods, and cannot exceed 128 characters. The - maximum allowed secret value size is 128 KB. The maximum number of secrets in a given scope is 1000. - - The input fields "string_value" or "bytes_value" specify the type of the secret, which will determine - the value returned when the secret value is requested. Exactly one must be specified. - - Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `RESOURCE_LIMIT_EXCEEDED` if - maximum number of secrets in scope is exceeded. Throws `INVALID_PARAMETER_VALUE` if the key name or - value length is invalid. Throws `PERMISSION_DENIED` if the user does not have permission to make this - API call. - - :param scope: str - The name of the scope to which the secret will be associated with. - :param key: str - A unique name to identify the secret. - :param bytes_value: str (optional) - If specified, value will be stored as bytes. - :param string_value: str (optional) - If specified, note that the value will be stored in UTF-8 (MB4) form. - - - \ No newline at end of file diff --git a/docs/workspace/securable_tags.rst b/docs/workspace/securable_tags.rst deleted file mode 100644 index 5e798e0e4..000000000 --- a/docs/workspace/securable_tags.rst +++ /dev/null @@ -1,39 +0,0 @@ -Securable Tags -============== -.. py:class:: SecurableTagsAPI - - Tags are attributes containing keys and values that can be applied to different entities in Unity Catalog. - Tags are useful for organizing and categorizing different entities within a metastore. SecurableTags are - attached to Unity Catalog securable entities. - - .. py:method:: list(securable_type, full_name) - - Get tags for a securable. - - Gets tag assignments for an entity. The caller must be either the owner of the securable, or a - metastore admin, or have at least USE / SELECT privilege on the associated securable. - - :param securable_type: :class:`ListSecurableType` - The type of the unity catalog securable entity. - :param full_name: str - The fully qualified name of the unity catalog securable entity. - - :returns: Iterator over :class:`TagSecurableAssignment` - - - .. py:method:: update(changes, securable_type, full_name) - - Update tags for a securable. - - Update tag assignments for an entity The caller must be either the owner of the securable, or a - metastore admin, or have at least USE / SELECT and APPLY_TAG privilege on the associated securable. - - :param changes: :class:`TagChanges` - Desired changes to be made to the tag assignments on the entity - :param securable_type: :class:`UpdateSecurableType` - The type of the unity catalog securable entity. - :param full_name: str - The fully qualified name of the unity catalog securable entity. - - :returns: :class:`TagSecurableAssignmentsList` - \ No newline at end of file diff --git a/docs/workspace/service_principals.rst b/docs/workspace/service_principals.rst deleted file mode 100644 index 9622dad37..000000000 --- a/docs/workspace/service_principals.rst +++ /dev/null @@ -1,234 +0,0 @@ -Service Principals -================== -.. py:class:: ServicePrincipalsAPI - - Identities for use with jobs, automated tools, and systems such as scripts, apps, and CI/CD platforms. - Databricks recommends creating service principals to run production jobs or modify production data. If all - processes that act on production data run with service principals, interactive users do not need any - write, delete, or modify privileges in production. This eliminates the risk of a user overwriting - production data by accident. - - .. py:method:: create( [, active, application_id, display_name, entitlements, external_id, groups, id, roles, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - groups = w.groups.group_display_name_to_id_map(iam.ListGroupsRequest()) - - spn = w.service_principals.create(display_name=f'sdk-{time.time_ns()}', - groups=[iam.ComplexValue(value=groups["admins"])]) - - # cleanup - w.service_principals.delete(id=spn.id) - - Create a service principal. - - Creates a new service principal in the Databricks workspace. - - :param active: bool (optional) - If this user is active - :param application_id: str (optional) - UUID relating to the service principal - :param display_name: str (optional) - String that represents a concatenation of given and family names. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the service principal. See [assigning entitlements] for a full list of - supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param id: str (optional) - Databricks service principal ID. - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`ServicePrincipalSchema`] (optional) - The schema of the List response. - - :returns: :class:`ServicePrincipal` - - - .. py:method:: delete(id) - - Delete a service principal. - - Delete a single service principal in the Databricks workspace. - - :param id: str - Unique ID for a service principal in the Databricks workspace. - - - - - .. py:method:: get(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.service_principals.create(display_name=f'sdk-{time.time_ns()}') - - by_id = w.service_principals.get(id=created.id) - - # cleanup - w.service_principals.delete(id=created.id) - - Get service principal details. - - Gets the details for a single service principal define in the Databricks workspace. - - :param id: str - Unique ID for a service principal in the Databricks workspace. - - :returns: :class:`ServicePrincipal` - - - .. py:method:: list( [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - sp_create = a.service_principals.create(active=True, display_name=f'sdk-{time.time_ns()}') - - sp = a.service_principals.get(id=sp_create.id) - - sp_list = a.service_principals.list(filter="displayName eq %v" % (sp.display_name)) - - # cleanup - a.service_principals.delete(id=sp_create.id) - - List service principals. - - Gets the set of service principals associated with a Databricks workspace. - - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. - :param sort_order: :class:`ListSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: Iterator over :class:`ServicePrincipal` - - - .. py:method:: patch(id [, operations, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - from databricks.sdk.service import iam - - a = AccountClient() - - sp_create = a.service_principals.create(active=True, display_name=f'sdk-{time.time_ns()}') - - sp = a.service_principals.get(id=sp_create.id) - - a.service_principals.patch(id=sp.id, - operations=[iam.Patch(op=iam.PatchOp.REPLACE, path="active", value="false")], - schemas=[iam.PatchSchema.URN_IETF_PARAMS_SCIM_API_MESSAGES_2_0_PATCH_OP]) - - # cleanup - a.service_principals.delete(id=sp_create.id) - - Update service principal details. - - Partially updates the details of a single service principal in the Databricks workspace. - - :param id: str - Unique ID for a service principal in the Databricks workspace. - :param operations: List[:class:`Patch`] (optional) - :param schemas: List[:class:`PatchSchema`] (optional) - The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - - - - - .. py:method:: update(id [, active, application_id, display_name, entitlements, external_id, groups, roles, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - created = w.service_principals.create(display_name=f'sdk-{time.time_ns()}') - - w.service_principals.update(id=created.id, - display_name=f'sdk-{time.time_ns()}', - roles=[iam.ComplexValue(value="xyz")]) - - # cleanup - w.service_principals.delete(id=created.id) - - Replace service principal. - - Updates the details of a single service principal. - - This action replaces the existing service principal with the same name. - - :param id: str - Databricks service principal ID. - :param active: bool (optional) - If this user is active - :param application_id: str (optional) - UUID relating to the service principal - :param display_name: str (optional) - String that represents a concatenation of given and family names. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the service principal. See [assigning entitlements] for a full list of - supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - :param groups: List[:class:`ComplexValue`] (optional) - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`ServicePrincipalSchema`] (optional) - The schema of the List response. - - - \ No newline at end of file diff --git a/docs/workspace/serving_endpoints.rst b/docs/workspace/serving_endpoints.rst deleted file mode 100644 index ee80f3aea..000000000 --- a/docs/workspace/serving_endpoints.rst +++ /dev/null @@ -1,209 +0,0 @@ -Serving endpoints -================= -.. py:class:: ServingEndpointsAPI - - The Serving Endpoints API allows you to create, update, and delete model serving endpoints. - - You can use a serving endpoint to serve models from the Databricks Model Registry or from Unity Catalog. - Endpoints expose the underlying models as scalable REST API endpoints using serverless compute. This means - the endpoints and associated compute resources are fully managed by Databricks and will not appear in your - cloud account. A serving endpoint can consist of one or more MLflow models from the Databricks Model - Registry, called served models. A serving endpoint can have at most ten served models. You can configure - traffic settings to define how requests should be routed to your served models behind an endpoint. - Additionally, you can configure the scale of resources that should be applied to each served model. - - .. py:method:: build_logs(name, served_model_name) - - Retrieve the logs associated with building the model's environment for a given serving endpoint's - served model. - - Retrieves the build logs associated with the provided served model. - - :param name: str - The name of the serving endpoint that the served model belongs to. This field is required. - :param served_model_name: str - The name of the served model that build logs will be retrieved for. This field is required. - - :returns: :class:`BuildLogsResponse` - - - .. py:method:: create(name, config [, tags]) - - Create a new serving endpoint. - - :param name: str - The name of the serving endpoint. This field is required and must be unique across a Databricks - workspace. An endpoint name can consist of alphanumeric characters, dashes, and underscores. - :param config: :class:`EndpointCoreConfigInput` - The core config of the serving endpoint. - :param tags: List[:class:`EndpointTag`] (optional) - Tags to be attached to the serving endpoint and automatically propagated to billing logs. - - :returns: - Long-running operation waiter for :class:`ServingEndpointDetailed`. - See :method:wait_get_serving_endpoint_not_updating for more details. - - - .. py:method:: delete(name) - - Delete a serving endpoint. - - :param name: str - The name of the serving endpoint. This field is required. - - - - - .. py:method:: export_metrics(name) - - Retrieve the metrics associated with a serving endpoint. - - Retrieves the metrics associated with the provided serving endpoint in either Prometheus or - OpenMetrics exposition format. - - :param name: str - The name of the serving endpoint to retrieve metrics for. This field is required. - - - - - .. py:method:: get(name) - - Get a single serving endpoint. - - Retrieves the details for a single serving endpoint. - - :param name: str - The name of the serving endpoint. This field is required. - - :returns: :class:`ServingEndpointDetailed` - - - .. py:method:: get_permission_levels(serving_endpoint_id) - - Get serving endpoint permission levels. - - Gets the permission levels that a user can have on an object. - - :param serving_endpoint_id: str - The serving endpoint for which to get or manage permissions. - - :returns: :class:`GetServingEndpointPermissionLevelsResponse` - - - .. py:method:: get_permissions(serving_endpoint_id) - - Get serving endpoint permissions. - - Gets the permissions of a serving endpoint. Serving endpoints can inherit permissions from their root - object. - - :param serving_endpoint_id: str - The serving endpoint for which to get or manage permissions. - - :returns: :class:`ServingEndpointPermissions` - - - .. py:method:: list() - - Retrieve all serving endpoints. - - :returns: Iterator over :class:`ServingEndpoint` - - - .. py:method:: logs(name, served_model_name) - - Retrieve the most recent log lines associated with a given serving endpoint's served model. - - Retrieves the service logs associated with the provided served model. - - :param name: str - The name of the serving endpoint that the served model belongs to. This field is required. - :param served_model_name: str - The name of the served model that logs will be retrieved for. This field is required. - - :returns: :class:`ServerLogsResponse` - - - .. py:method:: patch(name [, add_tags, delete_tags]) - - Patch the tags of a serving endpoint. - - Used to batch add and delete tags from a serving endpoint with a single API call. - - :param name: str - The name of the serving endpoint who's tags to patch. This field is required. - :param add_tags: List[:class:`EndpointTag`] (optional) - List of endpoint tags to add - :param delete_tags: List[str] (optional) - List of tag keys to delete - - :returns: Iterator over :class:`EndpointTag` - - - .. py:method:: query(name [, dataframe_records, dataframe_split, inputs, instances]) - - Query a serving endpoint with provided model input. - - :param name: str - The name of the serving endpoint. This field is required. - :param dataframe_records: List[Any] (optional) - Pandas Dataframe input in the records orientation. - :param dataframe_split: :class:`DataframeSplitInput` (optional) - Pandas Dataframe input in the split orientation. - :param inputs: Any (optional) - Tensor-based input in columnar format. - :param instances: List[Any] (optional) - Tensor-based input in row format. - - :returns: :class:`QueryEndpointResponse` - - - .. py:method:: set_permissions(serving_endpoint_id [, access_control_list]) - - Set serving endpoint permissions. - - Sets permissions on a serving endpoint. Serving endpoints can inherit permissions from their root - object. - - :param serving_endpoint_id: str - The serving endpoint for which to get or manage permissions. - :param access_control_list: List[:class:`ServingEndpointAccessControlRequest`] (optional) - - :returns: :class:`ServingEndpointPermissions` - - - .. py:method:: update_config(name, served_models [, traffic_config]) - - Update a serving endpoint with a new config. - - Updates any combination of the serving endpoint's served models, the compute configuration of those - served models, and the endpoint's traffic config. An endpoint that already has an update in progress - can not be updated until the current update completes or fails. - - :param name: str - The name of the serving endpoint to update. This field is required. - :param served_models: List[:class:`ServedModelInput`] - A list of served models for the endpoint to serve. A serving endpoint can have up to 10 served - models. - :param traffic_config: :class:`TrafficConfig` (optional) - The traffic config defining how invocations to the serving endpoint should be routed. - - :returns: - Long-running operation waiter for :class:`ServingEndpointDetailed`. - See :method:wait_get_serving_endpoint_not_updating for more details. - - - .. py:method:: update_permissions(serving_endpoint_id [, access_control_list]) - - Update serving endpoint permissions. - - Updates the permissions on a serving endpoint. Serving endpoints can inherit permissions from their - root object. - - :param serving_endpoint_id: str - The serving endpoint for which to get or manage permissions. - :param access_control_list: List[:class:`ServingEndpointAccessControlRequest`] (optional) - - :returns: :class:`ServingEndpointPermissions` - \ No newline at end of file diff --git a/docs/workspace/settings.rst b/docs/workspace/settings.rst deleted file mode 100644 index 0ed62bc50..000000000 --- a/docs/workspace/settings.rst +++ /dev/null @@ -1,81 +0,0 @@ -Default Namespace -================= -.. py:class:: SettingsAPI - - The default namespace setting API allows users to configure the default namespace for a Databricks - workspace. - - Through this API, users can retrieve, set, or modify the default namespace used when queries do not - reference a fully qualified three-level name. For example, if you use the API to set 'retail_prod' as the - default catalog, then a query 'SELECT * FROM myTable' would reference the object - 'retail_prod.default.myTable' (the schema 'default' is always assumed). - - This setting requires a restart of clusters and SQL warehouses to take effect. Additionally, the default - namespace only applies when using Unity Catalog-enabled compute. - - .. py:method:: delete_default_workspace_namespace(etag) - - Delete the default namespace setting. - - Deletes the default namespace setting for the workspace. A fresh etag needs to be provided in DELETE - requests (as a query parameter). The etag can be retrieved by making a GET request before the DELETE - request. If the setting is updated/deleted concurrently, DELETE will fail with 409 and the request - will need to be retried by using the fresh etag in the 409 response. - - :param etag: str - etag used for versioning. The response is at least as fresh as the eTag provided. This is used for - optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting - each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern - to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET - request, and pass it with the DELETE request to identify the rule set version you are deleting. - - :returns: :class:`DeleteDefaultWorkspaceNamespaceResponse` - - - .. py:method:: read_default_workspace_namespace(etag) - - Get the default namespace setting. - - Gets the default namespace setting. - - :param etag: str - etag used for versioning. The response is at least as fresh as the eTag provided. This is used for - optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting - each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern - to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET - request, and pass it with the DELETE request to identify the rule set version you are deleting. - - :returns: :class:`DefaultNamespaceSetting` - - - .. py:method:: update_default_workspace_namespace( [, allow_missing, field_mask, setting]) - - Update the default namespace setting. - - Updates the default namespace setting for the workspace. A fresh etag needs to be provided in PATCH - requests (as part of the setting field). The etag can be retrieved by making a GET request before the - PATCH request. Note that if the setting does not exist, GET will return a NOT_FOUND error and the etag - will be present in the error response, which should be set in the PATCH request. If the setting is - updated concurrently, PATCH will fail with 409 and the request will need to be retried by using the - fresh etag in the 409 response. - - :param allow_missing: bool (optional) - This should always be set to true for Settings API. Added for AIP compliance. - :param field_mask: str (optional) - Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the - setting payload will be updated. For example, for Default Namespace setting, the field mask is - supposed to contain fields from the DefaultNamespaceSetting.namespace schema. - - The field mask needs to be supplied as single string. To specify multiple fields in the field mask, - use comma as the seperator (no space). - :param setting: :class:`DefaultNamespaceSetting` (optional) - This represents the setting configuration for the default namespace in the Databricks workspace. - Setting the default catalog for the workspace determines the catalog that is used when queries do - not reference a fully qualified 3 level name. For example, if the default catalog is set to - 'retail_prod' then a query 'SELECT * FROM myTable' would reference the object - 'retail_prod.default.myTable' (the schema 'default' is always assumed). This setting requires a - restart of clusters and SQL warehouses to take effect. Additionally, the default namespace only - applies when using Unity Catalog-enabled compute. - - :returns: :class:`DefaultNamespaceSetting` - \ No newline at end of file diff --git a/docs/workspace/shares.rst b/docs/workspace/shares.rst deleted file mode 100644 index b961e6897..000000000 --- a/docs/workspace/shares.rst +++ /dev/null @@ -1,203 +0,0 @@ -Shares -====== -.. py:class:: SharesAPI - - A share is a container instantiated with :method:shares/create. Once created you can iteratively register - a collection of existing data assets defined within the metastore using :method:shares/update. You can - register data assets under their original name, qualified by their original schema, or provide alternate - exposed names. - - .. py:method:: create(name [, comment]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created_share = w.shares.create(name=f'sdk-{time.time_ns()}') - - # cleanup - w.shares.delete(name=created_share.name) - - Create a share. - - Creates a new share for data objects. Data objects can be added after creation with **update**. The - caller must be a metastore admin or have the **CREATE_SHARE** privilege on the metastore. - - :param name: str - Name of the share. - :param comment: str (optional) - User-provided free-form text description. - - :returns: :class:`ShareInfo` - - - .. py:method:: delete(name) - - Delete a share. - - Deletes a data object share from the metastore. The caller must be an owner of the share. - - :param name: str - The name of the share. - - - - - .. py:method:: get(name [, include_shared_data]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created_share = w.shares.create(name=f'sdk-{time.time_ns()}') - - _ = w.shares.get(name=created_share.name) - - # cleanup - w.shares.delete(name=created_share.name) - - Get a share. - - Gets a data object share from the metastore. The caller must be a metastore admin or the owner of the - share. - - :param name: str - The name of the share. - :param include_shared_data: bool (optional) - Query for data to include in the share. - - :returns: :class:`ShareInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.shares.list() - - List shares. - - Gets an array of data object shares from the metastore. The caller must be a metastore admin or the - owner of the share. There is no guarantee of a specific ordering of the elements in the array. - - :returns: Iterator over :class:`ShareInfo` - - - .. py:method:: share_permissions(name) - - Get permissions. - - Gets the permissions for a data share from the metastore. The caller must be a metastore admin or the - owner of the share. - - :param name: str - The name of the share. - - :returns: :class:`PermissionsList` - - - .. py:method:: update(name [, comment, owner, updates]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sharing - - w = WorkspaceClient() - - table_name = f'sdk-{time.time_ns()}' - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - _ = w.statement_execution.execute(warehouse_id=os.environ["TEST_DEFAULT_WAREHOUSE_ID"], - catalog=created_catalog.name, - schema=created_schema.name, - statement="CREATE TABLE %s AS SELECT 2+2 as four" % (table_name)).result() - - table_full_name = "%s.%s.%s" % (created_catalog.name, created_schema.name, table_name) - - created_share = w.shares.create(name=f'sdk-{time.time_ns()}') - - _ = w.shares.update(name=created_share.name, - updates=[ - sharing.SharedDataObjectUpdate(action=sharing.SharedDataObjectUpdateAction.ADD, - data_object=sharing.SharedDataObject( - name=table_full_name, data_object_type="TABLE")) - ]) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.tables.delete(full_name=table_full_name) - w.shares.delete(name=created_share.name) - - Update a share. - - Updates the share with the changes and data objects in the request. The caller must be the owner of - the share or a metastore admin. - - When the caller is a metastore admin, only the __owner__ field can be updated. - - In the case that the share name is changed, **updateShare** requires that the caller is both the share - owner and a metastore admin. - - For each table that is added through this method, the share owner must also have **SELECT** privilege - on the table. This privilege must be maintained indefinitely for recipients to be able to access the - table. Typically, you should use a group as the share owner. - - Table removals through **update** do not require additional privileges. - - :param name: str - Name of the share. - :param comment: str (optional) - User-provided free-form text description. - :param owner: str (optional) - Username of current owner of share. - :param updates: List[:class:`SharedDataObjectUpdate`] (optional) - Array of shared data object updates. - - :returns: :class:`ShareInfo` - - - .. py:method:: update_permissions(name [, changes]) - - Update permissions. - - Updates the permissions for a data share in the metastore. The caller must be a metastore admin or an - owner of the share. - - For new recipient grants, the user must also be the owner of the recipients. recipient revocations do - not require additional privileges. - - :param name: str - The name of the share. - :param changes: List[:class:`PermissionsChange`] (optional) - Array of permission changes. - - - \ No newline at end of file diff --git a/docs/workspace/statement_execution.rst b/docs/workspace/statement_execution.rst deleted file mode 100644 index 19b63200b..000000000 --- a/docs/workspace/statement_execution.rst +++ /dev/null @@ -1,262 +0,0 @@ -Statement Execution -=================== -.. py:class:: StatementExecutionAPI - - The Databricks SQL Statement Execution API can be used to execute SQL statements on a SQL warehouse and - fetch the result. - - **Getting started** - - We suggest beginning with the [Databricks SQL Statement Execution API tutorial]. - - **Overview of statement execution and result fetching** - - Statement execution begins by issuing a :method:statementexecution/executeStatement request with a valid - SQL statement and warehouse ID, along with optional parameters such as the data catalog and output format. - If no other parameters are specified, the server will wait for up to 10s before returning a response. If - the statement has completed within this timespan, the response will include the result data as a JSON - array and metadata. Otherwise, if no result is available after the 10s timeout expired, the response will - provide the statement ID that can be used to poll for results by using a - :method:statementexecution/getStatement request. - - You can specify whether the call should behave synchronously, asynchronously or start synchronously with a - fallback to asynchronous execution. This is controlled with the `wait_timeout` and `on_wait_timeout` - settings. If `wait_timeout` is set between 5-50 seconds (default: 10s), the call waits for results up to - the specified timeout; when set to `0s`, the call is asynchronous and responds immediately with a - statement ID. The `on_wait_timeout` setting specifies what should happen when the timeout is reached while - the statement execution has not yet finished. This can be set to either `CONTINUE`, to fallback to - asynchronous mode, or it can be set to `CANCEL`, which cancels the statement. - - In summary: - Synchronous mode - `wait_timeout=30s` and `on_wait_timeout=CANCEL` - The call waits up to 30 - seconds; if the statement execution finishes within this time, the result data is returned directly in the - response. If the execution takes longer than 30 seconds, the execution is canceled and the call returns - with a `CANCELED` state. - Asynchronous mode - `wait_timeout=0s` (`on_wait_timeout` is ignored) - The call - doesn't wait for the statement to finish but returns directly with a statement ID. The status of the - statement execution can be polled by issuing :method:statementexecution/getStatement with the statement - ID. Once the execution has succeeded, this call also returns the result and metadata in the response. - - Hybrid mode (default) - `wait_timeout=10s` and `on_wait_timeout=CONTINUE` - The call waits for up to 10 - seconds; if the statement execution finishes within this time, the result data is returned directly in the - response. If the execution takes longer than 10 seconds, a statement ID is returned. The statement ID can - be used to fetch status and results in the same way as in the asynchronous mode. - - Depending on the size, the result can be split into multiple chunks. If the statement execution is - successful, the statement response contains a manifest and the first chunk of the result. The manifest - contains schema information and provides metadata for each chunk in the result. Result chunks can be - retrieved by index with :method:statementexecution/getStatementResultChunkN which may be called in any - order and in parallel. For sequential fetching, each chunk, apart from the last, also contains a - `next_chunk_index` and `next_chunk_internal_link` that point to the next chunk. - - A statement can be canceled with :method:statementexecution/cancelExecution. - - **Fetching result data: format and disposition** - - To specify the format of the result data, use the `format` field, which can be set to one of the following - options: `JSON_ARRAY` (JSON), `ARROW_STREAM` ([Apache Arrow Columnar]), or `CSV`. - - There are two ways to receive statement results, controlled by the `disposition` setting, which can be - either `INLINE` or `EXTERNAL_LINKS`: - - - `INLINE`: In this mode, the result data is directly included in the response. It's best suited for - smaller results. This mode can only be used with the `JSON_ARRAY` format. - - - `EXTERNAL_LINKS`: In this mode, the response provides links that can be used to download the result data - in chunks separately. This approach is ideal for larger results and offers higher throughput. This mode - can be used with all the formats: `JSON_ARRAY`, `ARROW_STREAM`, and `CSV`. - - By default, the API uses `format=JSON_ARRAY` and `disposition=INLINE`. - - **Limits and limitations** - - Note: The byte limit for INLINE disposition is based on internal storage metrics and will not exactly - match the byte count of the actual payload. - - - Statements with `disposition=INLINE` are limited to 25 MiB and will fail when this limit is exceeded. - - Statements with `disposition=EXTERNAL_LINKS` are limited to 100 GiB. Result sets larger than this limit - will be truncated. Truncation is indicated by the `truncated` field in the result manifest. - The maximum - query text size is 16 MiB. - Cancelation might silently fail. A successful response from a cancel request - indicates that the cancel request was successfully received and sent to the processing engine. However, an - outstanding statement might have already completed execution when the cancel request arrives. Polling for - status until a terminal state is reached is a reliable way to determine the final state. - Wait timeouts - are approximate, occur server-side, and cannot account for things such as caller delays and network - latency from caller to service. - The system will auto-close a statement after one hour if the client - stops polling and thus you must poll at least once an hour. - The results are only available for one hour - after success; polling does not extend this. - - [Apache Arrow Columnar]: https://arrow.apache.org/overview/ - [Databricks SQL Statement Execution API tutorial]: https://docs.databricks.com/sql/api/sql-execution-tutorial.html - - .. py:method:: cancel_execution(statement_id) - - Cancel statement execution. - - Requests that an executing statement be canceled. Callers must poll for status to see the terminal - state. - - :param statement_id: str - - - - - .. py:method:: execute_statement(statement, warehouse_id [, byte_limit, catalog, disposition, format, on_wait_timeout, parameters, row_limit, schema, wait_timeout]) - - Execute a SQL statement. - - :param statement: str - The SQL statement to execute. The statement can optionally be parameterized, see `parameters`. - :param warehouse_id: str - Warehouse upon which to execute a statement. See also [What are SQL - warehouses?](/sql/admin/warehouse-type.html) - :param byte_limit: int (optional) - Applies the given byte limit to the statement's result size. Byte counts are based on internal data - representations and might not match the final size in the requested `format`. If the result was - truncated due to the byte limit, then `truncated` in the response is set to `true`. When using - `EXTERNAL_LINKS` disposition, a default `byte_limit` of 100 GiB is applied if `byte_limit` is not - explcitly set. - :param catalog: str (optional) - Sets default catalog for statement execution, similar to [`USE CATALOG`] in SQL. - - [`USE CATALOG`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-catalog.html - :param disposition: :class:`Disposition` (optional) - The fetch disposition provides two modes of fetching results: `INLINE` and `EXTERNAL_LINKS`. - - Statements executed with `INLINE` disposition will return result data inline, in `JSON_ARRAY` - format, in a series of chunks. If a given statement produces a result set with a size larger than 25 - MiB, that statement execution is aborted, and no result set will be available. - - **NOTE** Byte limits are computed based upon internal representations of the result set data, and - might not match the sizes visible in JSON responses. - - Statements executed with `EXTERNAL_LINKS` disposition will return result data as external links: - URLs that point to cloud storage internal to the workspace. Using `EXTERNAL_LINKS` disposition - allows statements to generate arbitrarily sized result sets for fetching up to 100 GiB. The - resulting links have two important properties: - - 1. They point to resources _external_ to the Databricks compute; therefore any associated - authentication information (typically a personal access token, OAuth token, or similar) _must be - removed_ when fetching from these links. - - 2. These are presigned URLs with a specific expiration, indicated in the response. The behavior when - attempting to use an expired link is cloud specific. - :param format: :class:`Format` (optional) - Statement execution supports three result formats: `JSON_ARRAY` (default), `ARROW_STREAM`, and - `CSV`. - - Important: The formats `ARROW_STREAM` and `CSV` are supported only with `EXTERNAL_LINKS` - disposition. `JSON_ARRAY` is supported in `INLINE` and `EXTERNAL_LINKS` disposition. - - When specifying `format=JSON_ARRAY`, result data will be formatted as an array of arrays of values, - where each value is either the *string representation* of a value, or `null`. For example, the - output of `SELECT concat('id-', id) AS strCol, id AS intCol, null AS nullCol FROM range(3)` would - look like this: - - ``` [ [ "id-1", "1", null ], [ "id-2", "2", null ], [ "id-3", "3", null ], ] ``` - - When specifying `format=JSON_ARRAY` and `disposition=EXTERNAL_LINKS`, each chunk in the result - contains compact JSON with no indentation or extra whitespace. - - When specifying `format=ARROW_STREAM` and `disposition=EXTERNAL_LINKS`, each chunk in the result - will be formatted as Apache Arrow Stream. See the [Apache Arrow streaming format]. - - When specifying `format=CSV` and `disposition=EXTERNAL_LINKS`, each chunk in the result will be a - CSV according to [RFC 4180] standard. All the columns values will have *string representation* - similar to the `JSON_ARRAY` format, and `null` values will be encoded as “null”. Only the first - chunk in the result would contain a header row with column names. For example, the output of `SELECT - concat('id-', id) AS strCol, id AS intCol, null as nullCol FROM range(3)` would look like this: - - ``` strCol,intCol,nullCol id-1,1,null id-2,2,null id-3,3,null ``` - - [Apache Arrow streaming format]: https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format - [RFC 4180]: https://www.rfc-editor.org/rfc/rfc4180 - :param on_wait_timeout: :class:`ExecuteStatementRequestOnWaitTimeout` (optional) - When `wait_timeout > 0s`, the call will block up to the specified time. If the statement execution - doesn't finish within this time, `on_wait_timeout` determines whether the execution should continue - or be canceled. When set to `CONTINUE`, the statement execution continues asynchronously and the - call returns a statement ID which can be used for polling with - :method:statementexecution/getStatement. When set to `CANCEL`, the statement execution is canceled - and the call returns with a `CANCELED` state. - :param parameters: List[:class:`StatementParameterListItem`] (optional) - A list of parameters to pass into a SQL statement containing parameter markers. A parameter consists - of a name, a value, and optionally a type. To represent a NULL value, the `value` field may be - omitted or set to `null` explicitly. If the `type` field is omitted, the value is interpreted as a - string. - - If the type is given, parameters will be checked for type correctness according to the given type. A - value is correct if the provided string can be converted to the requested type using the `cast` - function. The exact semantics are described in the section [`cast` function] of the SQL language - reference. - - For example, the following statement contains two parameters, `my_name` and `my_date`: - - SELECT * FROM my_table WHERE name = :my_name AND date = :my_date - - The parameters can be passed in the request body as follows: - - { ..., "statement": "SELECT * FROM my_table WHERE name = :my_name AND date = :my_date", - "parameters": [ { "name": "my_name", "value": "the name" }, { "name": "my_date", "value": - "2020-01-01", "type": "DATE" } ] } - - Currently, positional parameters denoted by a `?` marker are not supported by the Databricks SQL - Statement Execution API. - - Also see the section [Parameter markers] of the SQL language reference. - - [Parameter markers]: https://docs.databricks.com/sql/language-manual/sql-ref-parameter-marker.html - [`cast` function]: https://docs.databricks.com/sql/language-manual/functions/cast.html - :param row_limit: int (optional) - Applies the given row limit to the statement's result set, but unlike the `LIMIT` clause in SQL, it - also sets the `truncated` field in the response to indicate whether the result was trimmed due to - the limit or not. - :param schema: str (optional) - Sets default schema for statement execution, similar to [`USE SCHEMA`] in SQL. - - [`USE SCHEMA`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-schema.html - :param wait_timeout: str (optional) - The time in seconds the call will wait for the statement's result set as `Ns`, where `N` can be set - to 0 or to a value between 5 and 50. - - When set to `0s`, the statement will execute in asynchronous mode and the call will not wait for the - execution to finish. In this case, the call returns directly with `PENDING` state and a statement ID - which can be used for polling with :method:statementexecution/getStatement. - - When set between 5 and 50 seconds, the call will behave synchronously up to this timeout and wait - for the statement execution to finish. If the execution finishes within this time, the call returns - immediately with a manifest and result data (or a `FAILED` state in case of an execution error). If - the statement takes longer to execute, `on_wait_timeout` determines what should happen after the - timeout is reached. - - :returns: :class:`ExecuteStatementResponse` - - - .. py:method:: get_statement(statement_id) - - Get status, manifest, and result first chunk. - - This request can be used to poll for the statement's status. When the `status.state` field is - `SUCCEEDED` it will also return the result manifest and the first chunk of the result data. When the - statement is in the terminal states `CANCELED`, `CLOSED` or `FAILED`, it returns HTTP 200 with the - state set. After at least 12 hours in terminal state, the statement is removed from the warehouse and - further calls will receive an HTTP 404 response. - - **NOTE** This call currently might take up to 5 seconds to get the latest status and result. - - :param statement_id: str - - :returns: :class:`GetStatementResponse` - - - .. py:method:: get_statement_result_chunk_n(statement_id, chunk_index) - - Get result chunk by index. - - After the statement execution has `SUCCEEDED`, this request can be used to fetch any chunk by index. - Whereas the first chunk with `chunk_index=0` is typically fetched with - :method:statementexecution/executeStatement or :method:statementexecution/getStatement, this request - can be used to fetch subsequent chunks. The response structure is identical to the nested `result` - element described in the :method:statementexecution/getStatement request, and similarly includes the - `next_chunk_index` and `next_chunk_internal_link` fields for simple iteration through the result set. - - :param statement_id: str - :param chunk_index: int - - :returns: :class:`ResultData` - \ No newline at end of file diff --git a/docs/workspace/storage_credentials.rst b/docs/workspace/storage_credentials.rst deleted file mode 100644 index 46fd8cc71..000000000 --- a/docs/workspace/storage_credentials.rst +++ /dev/null @@ -1,218 +0,0 @@ -Storage Credentials -=================== -.. py:class:: StorageCredentialsAPI - - A storage credential represents an authentication and authorization mechanism for accessing data stored on - your cloud tenant. Each storage credential is subject to Unity Catalog access-control policies that - control which users and groups can access the credential. If a user does not have access to a storage - credential in Unity Catalog, the request fails and Unity Catalog does not attempt to authenticate to your - cloud tenant on the user’s behalf. - - Databricks recommends using external locations rather than using storage credentials directly. - - To create storage credentials, you must be a Databricks account admin. The account admin who creates the - storage credential can delegate ownership to another user or group to manage permissions on it. - - .. py:method:: create(name [, aws_iam_role, azure_managed_identity, azure_service_principal, comment, databricks_gcp_service_account, read_only, skip_validation]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - # cleanup - w.storage_credentials.delete(delete=created.name) - - Create a storage credential. - - Creates a new storage credential. - - :param name: str - The credential name. The name must be unique within the metastore. - :param aws_iam_role: :class:`AwsIamRole` (optional) - The AWS IAM role configuration. - :param azure_managed_identity: :class:`AzureManagedIdentity` (optional) - The Azure managed identity configuration. - :param azure_service_principal: :class:`AzureServicePrincipal` (optional) - The Azure service principal configuration. - :param comment: str (optional) - Comment associated with the credential. - :param databricks_gcp_service_account: Any (optional) - The managed GCP service account configuration. - :param read_only: bool (optional) - Whether the storage credential is only usable for read operations. - :param skip_validation: bool (optional) - Supplying true to this argument skips validation of the created credential. - - :returns: :class:`StorageCredentialInfo` - - - .. py:method:: delete(name [, force]) - - Delete a credential. - - Deletes a storage credential from the metastore. The caller must be an owner of the storage - credential. - - :param name: str - Name of the storage credential. - :param force: bool (optional) - Force deletion even if there are dependent external locations or external tables. - - - - - .. py:method:: get(name) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - by_name = w.storage_credentials.get(name=created.name) - - # cleanup - w.storage_credentials.delete(name=created.name) - - Get a credential. - - Gets a storage credential from the metastore. The caller must be a metastore admin, the owner of the - storage credential, or have some permission on the storage credential. - - :param name: str - Name of the storage credential. - - :returns: :class:`StorageCredentialInfo` - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.storage_credentials.list() - - List credentials. - - Gets an array of storage credentials (as __StorageCredentialInfo__ objects). The array is limited to - only those storage credentials the caller has permission to access. If the caller is a metastore - admin, all storage credentials will be retrieved. There is no guarantee of a specific ordering of the - elements in the array. - - :returns: Iterator over :class:`StorageCredentialInfo` - - - .. py:method:: update(name [, aws_iam_role, azure_managed_identity, azure_service_principal, comment, databricks_gcp_service_account, force, owner, read_only, skip_validation]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - created = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - _ = w.storage_credentials.update( - name=created.name, - comment=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"])) - - # cleanup - w.storage_credentials.delete(delete=created.name) - - Update a credential. - - Updates a storage credential on the metastore. - - :param name: str - The credential name. The name must be unique within the metastore. - :param aws_iam_role: :class:`AwsIamRole` (optional) - The AWS IAM role configuration. - :param azure_managed_identity: :class:`AzureManagedIdentity` (optional) - The Azure managed identity configuration. - :param azure_service_principal: :class:`AzureServicePrincipal` (optional) - The Azure service principal configuration. - :param comment: str (optional) - Comment associated with the credential. - :param databricks_gcp_service_account: Any (optional) - The managed GCP service account configuration. - :param force: bool (optional) - Force update even if there are dependent external locations or external tables. - :param owner: str (optional) - Username of current owner of credential. - :param read_only: bool (optional) - Whether the storage credential is only usable for read operations. - :param skip_validation: bool (optional) - Supplying true to this argument skips validation of the updated credential. - - :returns: :class:`StorageCredentialInfo` - - - .. py:method:: validate( [, aws_iam_role, azure_managed_identity, azure_service_principal, databricks_gcp_service_account, external_location_name, read_only, storage_credential_name, url]) - - Validate a storage credential. - - Validates a storage credential. At least one of __external_location_name__ and __url__ need to be - provided. If only one of them is provided, it will be used for validation. And if both are provided, - the __url__ will be used for validation, and __external_location_name__ will be ignored when checking - overlapping urls. - - Either the __storage_credential_name__ or the cloud-specific credential must be provided. - - The caller must be a metastore admin or the storage credential owner or have the - **CREATE_EXTERNAL_LOCATION** privilege on the metastore and the storage credential. - - :param aws_iam_role: :class:`AwsIamRole` (optional) - The AWS IAM role configuration. - :param azure_managed_identity: :class:`AzureManagedIdentity` (optional) - The Azure managed identity configuration. - :param azure_service_principal: :class:`AzureServicePrincipal` (optional) - The Azure service principal configuration. - :param databricks_gcp_service_account: Any (optional) - The Databricks created GCP service account configuration. - :param external_location_name: str (optional) - The name of an existing external location to validate. - :param read_only: bool (optional) - Whether the storage credential is only usable for read operations. - :param storage_credential_name: Any (optional) - The name of the storage credential to validate. - :param url: str (optional) - The external location url to validate. - - :returns: :class:`ValidateStorageCredentialResponse` - \ No newline at end of file diff --git a/docs/workspace/subentity_tags.rst b/docs/workspace/subentity_tags.rst deleted file mode 100644 index 5616419be..000000000 --- a/docs/workspace/subentity_tags.rst +++ /dev/null @@ -1,45 +0,0 @@ -Subentity Tags -============== -.. py:class:: SubentityTagsAPI - - Tags are attributes containing keys and values that can be applied to different entities in Unity Catalog. - Tags are useful for organizing and categorizing different entities within a metastore. SubentityTags are - attached to Unity Catalog subentities. - - .. py:method:: list(securable_type, full_name, subentity_name) - - Get tags for a subentity. - - Gets tag assignments for a subentity associated with a securable entity. Eg. column of a table The - caller must be either the owner of the securable, or a metastore admin, or have at least USE / SELECT - privilege on the associated securable. - - :param securable_type: :class:`ListSecurableType` - The type of the unity catalog securable entity. - :param full_name: str - The fully qualified name of the unity catalog securable entity. - :param subentity_name: str - The name of subentity associated with the securable entity - - :returns: Iterator over :class:`TagsSubentityAssignment` - - - .. py:method:: update(changes, securable_type, full_name, subentity_name) - - Update tags for a subentity. - - Update tag assignments for a subentity associated with a securable entity. The caller must be either - the owner of the securable, or a metastore admin, or have at least USE / SELECT and APPLY_TAG - privilege on the associated securable. - - :param changes: :class:`TagChanges` - Desired changes to be made to the tag assignments on the entity - :param securable_type: :class:`UpdateSecurableType` - The type of the unity catalog securable entity. - :param full_name: str - The fully qualified name of the unity catalog securable entity. - :param subentity_name: str - The name of subentity associated with the securable entity - - :returns: :class:`TagSubentityAssignmentsList` - \ No newline at end of file diff --git a/docs/workspace/system_schemas.rst b/docs/workspace/system_schemas.rst deleted file mode 100644 index ef7569a2a..000000000 --- a/docs/workspace/system_schemas.rst +++ /dev/null @@ -1,49 +0,0 @@ -SystemSchemas -============= -.. py:class:: SystemSchemasAPI - - A system schema is a schema that lives within the system catalog. A system schema may contain information - about customer usage of Unity Catalog such as audit-logs, billing-logs, lineage information, etc. - - .. py:method:: disable(metastore_id, schema_name) - - Disable a system schema. - - Disables the system schema and removes it from the system catalog. The caller must be an account admin - or a metastore admin. - - :param metastore_id: str - The metastore ID under which the system schema lives. - :param schema_name: :class:`DisableSchemaName` - Full name of the system schema. - - - - - .. py:method:: enable(metastore_id, schema_name) - - Enable a system schema. - - Enables the system schema and adds it to the system catalog. The caller must be an account admin or a - metastore admin. - - :param metastore_id: str - The metastore ID under which the system schema lives. - :param schema_name: :class:`EnableSchemaName` - Full name of the system schema. - - - - - .. py:method:: list(metastore_id) - - List system schemas. - - Gets an array of system schemas for a metastore. The caller must be an account admin or a metastore - admin. - - :param metastore_id: str - The ID for the metastore in which the system schema resides. - - :returns: Iterator over :class:`SystemSchemaInfo` - \ No newline at end of file diff --git a/docs/workspace/table_constraints.rst b/docs/workspace/table_constraints.rst deleted file mode 100644 index 9880c209c..000000000 --- a/docs/workspace/table_constraints.rst +++ /dev/null @@ -1,60 +0,0 @@ -Table Constraints -================= -.. py:class:: TableConstraintsAPI - - Primary key and foreign key constraints encode relationships between fields in tables. - - Primary and foreign keys are informational only and are not enforced. Foreign keys must reference a - primary key in another table. This primary key is the parent constraint of the foreign key and the table - this primary key is on is the parent table of the foreign key. Similarly, the foreign key is the child - constraint of its referenced primary key; the table of the foreign key is the child table of the primary - key. - - You can declare primary keys and foreign keys as part of the table specification during table creation. - You can also add or drop constraints on existing tables. - - .. py:method:: create(full_name_arg, constraint) - - Create a table constraint. - - Creates a new table constraint. - - For the table constraint creation to succeed, the user must satisfy both of these conditions: - the - user must have the **USE_CATALOG** privilege on the table's parent catalog, the **USE_SCHEMA** - privilege on the table's parent schema, and be the owner of the table. - if the new constraint is a - __ForeignKeyConstraint__, the user must have the **USE_CATALOG** privilege on the referenced parent - table's catalog, the **USE_SCHEMA** privilege on the referenced parent table's schema, and be the - owner of the referenced parent table. - - :param full_name_arg: str - The full name of the table referenced by the constraint. - :param constraint: :class:`TableConstraint` - A table constraint, as defined by *one* of the following fields being set: - __primary_key_constraint__, __foreign_key_constraint__, __named_table_constraint__. - - :returns: :class:`TableConstraint` - - - .. py:method:: delete(full_name, constraint_name, cascade) - - Delete a table constraint. - - Deletes a table constraint. - - For the table constraint deletion to succeed, the user must satisfy both of these conditions: - the - user must have the **USE_CATALOG** privilege on the table's parent catalog, the **USE_SCHEMA** - privilege on the table's parent schema, and be the owner of the table. - if __cascade__ argument is - **true**, the user must have the following permissions on all of the child tables: the **USE_CATALOG** - privilege on the table's catalog, the **USE_SCHEMA** privilege on the table's schema, and be the owner - of the table. - - :param full_name: str - Full name of the table referenced by the constraint. - :param constraint_name: str - The name of the constraint to delete. - :param cascade: bool - If true, try deleting all child constraints of the current constraint. If false, reject this - operation if the current constraint has any child constraints. - - - \ No newline at end of file diff --git a/docs/workspace/tables.rst b/docs/workspace/tables.rst deleted file mode 100644 index d323ba0f6..000000000 --- a/docs/workspace/tables.rst +++ /dev/null @@ -1,189 +0,0 @@ -Tables -====== -.. py:class:: TablesAPI - - A table resides in the third layer of Unity Catalog’s three-level namespace. It contains rows of data. - To create a table, users must have CREATE_TABLE and USE_SCHEMA permissions on the schema, and they must - have the USE_CATALOG permission on its parent catalog. To query a table, users must have the SELECT - permission on the table, and they must have the USE_CATALOG permission on its parent catalog and the - USE_SCHEMA permission on its parent schema. - - A table can be managed or external. From an API perspective, a __VIEW__ is a particular kind of table - (rather than a managed or external table). - - .. py:method:: delete(full_name) - - Delete a table. - - Deletes a table from the specified parent catalog and schema. The caller must be the owner of the - parent catalog, have the **USE_CATALOG** privilege on the parent catalog and be the owner of the - parent schema, or be the owner of the table and have the **USE_CATALOG** privilege on the parent - catalog and the **USE_SCHEMA** privilege on the parent schema. - - :param full_name: str - Full name of the table. - - - - - .. py:method:: get(full_name [, include_delta_metadata]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - table_name = f'sdk-{time.time_ns()}' - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - _ = w.statement_execution.execute(warehouse_id=os.environ["TEST_DEFAULT_WAREHOUSE_ID"], - catalog=created_catalog.name, - schema=created_schema.name, - statement="CREATE TABLE %s AS SELECT 2+2 as four" % (table_name)).result() - - table_full_name = "%s.%s.%s" % (created_catalog.name, created_schema.name, table_name) - - created_table = w.tables.get(full_name=table_full_name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.tables.delete(full_name=table_full_name) - - Get a table. - - Gets a table from the metastore for a specific catalog and schema. The caller must be a metastore - admin, be the owner of the table and have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema, or be the owner of the table and have the **SELECT** - privilege on it as well. - - :param full_name: str - Full name of the table. - :param include_delta_metadata: bool (optional) - Whether delta metadata should be included in the response. - - :returns: :class:`TableInfo` - - - .. py:method:: list(catalog_name, schema_name [, include_delta_metadata, max_results, page_token]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - all_tables = w.tables.list(catalog_name=created_catalog.name, schema_name=created_schema.name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - - List tables. - - Gets an array of all tables for the current metastore under the parent catalog and schema. The caller - must be a metastore admin or an owner of (or have the **SELECT** privilege on) the table. For the - latter case, the caller must also be the owner or have the **USE_CATALOG** privilege on the parent - catalog and the **USE_SCHEMA** privilege on the parent schema. There is no guarantee of a specific - ordering of the elements in the array. - - :param catalog_name: str - Name of parent catalog for tables of interest. - :param schema_name: str - Parent schema of tables. - :param include_delta_metadata: bool (optional) - Whether delta metadata should be included in the response. - :param max_results: int (optional) - Maximum number of tables to return (page length). If not set, all accessible tables in the schema - are returned. If set to: - - * greater than 0, page length is the minimum of this value and a server configured value. * equal to - 0, page length is set to a server configured value. * lesser than 0, invalid parameter error. - :param page_token: str (optional) - Opaque token to send for the next page of results (pagination). - - :returns: Iterator over :class:`TableInfo` - - - .. py:method:: list_summaries(catalog_name [, max_results, page_token, schema_name_pattern, table_name_pattern]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - summaries = w.tables.list_summaries(catalog_name=created_catalog.name, - schema_name_pattern=created_schema.name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - - List table summaries. - - Gets an array of summaries for tables for a schema and catalog within the metastore. The table - summaries returned are either: - - * summaries for all tables (within the current metastore and parent catalog and schema), when the user - is a metastore admin, or: * summaries for all tables and schemas (within the current metastore and - parent catalog) for which the user has ownership or the **SELECT** privilege on the table and - ownership or **USE_SCHEMA** privilege on the schema, provided that the user also has ownership or the - **USE_CATALOG** privilege on the parent catalog. - - There is no guarantee of a specific ordering of the elements in the array. - - :param catalog_name: str - Name of parent catalog for tables of interest. - :param max_results: int (optional) - Maximum number of tables to return (page length). Defaults to 10000. - :param page_token: str (optional) - Opaque token to send for the next page of results (pagination). - :param schema_name_pattern: str (optional) - A sql LIKE pattern (% and _) for schema names. All schemas will be returned if not set or empty. - :param table_name_pattern: str (optional) - A sql LIKE pattern (% and _) for table names. All tables will be returned if not set or empty. - - :returns: Iterator over :class:`TableSummary` - - - .. py:method:: update(full_name [, owner]) - - Update a table owner. - - Change the owner of the table. The caller must be the owner of the parent catalog, have the - **USE_CATALOG** privilege on the parent catalog and be the owner of the parent schema, or be the owner - of the table and have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - privilege on the parent schema. - - :param full_name: str - Full name of the table. - :param owner: str (optional) - - - \ No newline at end of file diff --git a/docs/workspace/token_management.rst b/docs/workspace/token_management.rst deleted file mode 100644 index 38880328f..000000000 --- a/docs/workspace/token_management.rst +++ /dev/null @@ -1,157 +0,0 @@ -Token management -================ -.. py:class:: TokenManagementAPI - - Enables administrators to get all tokens and delete tokens for other users. Admins can either get every - token, get a specific token by ID, or get all tokens for a particular user. - - .. py:method:: create_obo_token(application_id, lifetime_seconds [, comment]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - groups = w.groups.group_display_name_to_id_map(iam.ListGroupsRequest()) - - spn = w.service_principals.create(display_name=f'sdk-{time.time_ns()}', - groups=[iam.ComplexValue(value=groups["admins"])]) - - obo = w.token_management.create_obo_token(application_id=spn.application_id, lifetime_seconds=60) - - # cleanup - w.service_principals.delete(id=spn.id) - w.token_management.delete(token_id=obo.token_info.token_id) - - Create on-behalf token. - - Creates a token on behalf of a service principal. - - :param application_id: str - Application ID of the service principal. - :param lifetime_seconds: int - The number of seconds before the token expires. - :param comment: str (optional) - Comment that describes the purpose of the token. - - :returns: :class:`CreateOboTokenResponse` - - - .. py:method:: delete(token_id) - - Delete a token. - - Deletes a token, specified by its ID. - - :param token_id: str - The ID of the token to get. - - - - - .. py:method:: get(token_id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - groups = w.groups.group_display_name_to_id_map(iam.ListGroupsRequest()) - - spn = w.service_principals.create(display_name=f'sdk-{time.time_ns()}', - groups=[iam.ComplexValue(value=groups["admins"])]) - - obo = w.token_management.create_obo_token(application_id=spn.application_id, lifetime_seconds=60) - - by_id = w.token_management.get(token_id=obo.token_info.token_id) - - # cleanup - w.service_principals.delete(id=spn.id) - w.token_management.delete(token_id=obo.token_info.token_id) - - Get token info. - - Gets information about a token, specified by its ID. - - :param token_id: str - The ID of the token to get. - - :returns: :class:`TokenInfo` - - - .. py:method:: get_permission_levels() - - Get token permission levels. - - Gets the permission levels that a user can have on an object. - - :returns: :class:`GetTokenPermissionLevelsResponse` - - - .. py:method:: get_permissions() - - Get token permissions. - - Gets the permissions of all tokens. Tokens can inherit permissions from their root object. - - :returns: :class:`TokenPermissions` - - - .. py:method:: list( [, created_by_id, created_by_username]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import settings - - w = WorkspaceClient() - - all = w.token_management.list(settings.ListTokenManagementRequest()) - - List all tokens. - - Lists all tokens associated with the specified workspace or user. - - :param created_by_id: str (optional) - User ID of the user that created the token. - :param created_by_username: str (optional) - Username of the user that created the token. - - :returns: Iterator over :class:`TokenInfo` - - - .. py:method:: set_permissions( [, access_control_list]) - - Set token permissions. - - Sets permissions on all tokens. Tokens can inherit permissions from their root object. - - :param access_control_list: List[:class:`TokenAccessControlRequest`] (optional) - - :returns: :class:`TokenPermissions` - - - .. py:method:: update_permissions( [, access_control_list]) - - Update token permissions. - - Updates the permissions on all tokens. Tokens can inherit permissions from their root object. - - :param access_control_list: List[:class:`TokenAccessControlRequest`] (optional) - - :returns: :class:`TokenPermissions` - \ No newline at end of file diff --git a/docs/workspace/tokens.rst b/docs/workspace/tokens.rst deleted file mode 100644 index e70ab8d41..000000000 --- a/docs/workspace/tokens.rst +++ /dev/null @@ -1,72 +0,0 @@ -Token -===== -.. py:class:: TokensAPI - - The Token API allows you to create, list, and revoke tokens that can be used to authenticate and access - Databricks REST APIs. - - .. py:method:: create( [, comment, lifetime_seconds]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - token = w.tokens.create(comment=f'sdk-{time.time_ns()}', lifetime_seconds=300) - - # cleanup - w.tokens.delete(token_id=token.token_info.token_id) - - Create a user token. - - Creates and returns a token for a user. If this call is made through token authentication, it creates - a token with the same client ID as the authenticated token. If the user's token quota is exceeded, - this call returns an error **QUOTA_EXCEEDED**. - - :param comment: str (optional) - Optional description to attach to the token. - :param lifetime_seconds: int (optional) - The lifetime of the token, in seconds. - - If the ifetime is not specified, this token remains valid indefinitely. - - :returns: :class:`CreateTokenResponse` - - - .. py:method:: delete(token_id) - - Revoke token. - - Revokes an access token. - - If a token with the specified ID is not valid, this call returns an error **RESOURCE_DOES_NOT_EXIST**. - - :param token_id: str - The ID of the token to be revoked. - - - - - .. py:method:: list() - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - all = w.tokens.list() - - List tokens. - - Lists all the valid tokens for a user-workspace pair. - - :returns: Iterator over :class:`TokenInfo` - \ No newline at end of file diff --git a/docs/workspace/users.rst b/docs/workspace/users.rst deleted file mode 100644 index 16eb27018..000000000 --- a/docs/workspace/users.rst +++ /dev/null @@ -1,308 +0,0 @@ -Users -===== -.. py:class:: UsersAPI - - User identities recognized by Databricks and represented by email addresses. - - Databricks recommends using SCIM provisioning to sync users and groups automatically from your identity - provider to your Databricks workspace. SCIM streamlines onboarding a new employee or team by using your - identity provider to create users and groups in Databricks workspace and give them the proper level of - access. When a user leaves your organization or no longer needs access to Databricks workspace, admins can - terminate the user in your identity provider and that user’s account will also be removed from - Databricks workspace. This ensures a consistent offboarding process and prevents unauthorized users from - accessing sensitive data. - - .. py:method:: create( [, active, display_name, emails, entitlements, external_id, groups, id, name, roles, schemas, user_name]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - user = a.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - # cleanup - a.users.delete(id=user.id) - - Create a new user. - - Creates a new user in the Databricks workspace. This new user will also be added to the Databricks - account. - - :param active: bool (optional) - If this user is active - :param display_name: str (optional) - String that represents a concatenation of given and family names. For example `John Smith`. This - field cannot be updated through the Workspace SCIM APIs when [identity federation is enabled]. Use - Account SCIM APIs to update `displayName`. - - [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation - :param emails: List[:class:`ComplexValue`] (optional) - All the emails associated with the Databricks user. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the user. See [assigning entitlements] for a full list of supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - External ID is not currently supported. It is reserved for future use. - :param groups: List[:class:`ComplexValue`] (optional) - :param id: str (optional) - Databricks user ID. This is automatically set by Databricks. Any value provided by the client will - be ignored. - :param name: :class:`Name` (optional) - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`UserSchema`] (optional) - The schema of the user. - :param user_name: str (optional) - Email address of the Databricks user. - - :returns: :class:`User` - - - .. py:method:: delete(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - other_owner = w.users.create(user_name=f'sdk-{time.time_ns()}@example.com') - - w.users.delete(id=other_owner.id) - - Delete a user. - - Deletes a user. Deleting a user from a Databricks workspace also removes objects associated with the - user. - - :param id: str - Unique ID for a user in the Databricks workspace. - - - - - .. py:method:: get(id [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import AccountClient - - a = AccountClient() - - user = a.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - by_id = a.users.get(id=user.id) - - # cleanup - a.users.delete(id=user.id) - - Get user details. - - Gets information for a specific user in Databricks workspace. - - :param id: str - Unique ID for a user in the Databricks workspace. - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. Multi-part paths are supported. For example, `userName`, - `name.givenName`, and `emails`. - :param sort_order: :class:`GetSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: :class:`User` - - - .. py:method:: get_permission_levels() - - Get password permission levels. - - Gets the permission levels that a user can have on an object. - - :returns: :class:`GetPasswordPermissionLevelsResponse` - - - .. py:method:: get_permissions() - - Get password permissions. - - Gets the permissions of all passwords. Passwords can inherit permissions from their root object. - - :returns: :class:`PasswordPermissions` - - - .. py:method:: list( [, attributes, count, excluded_attributes, filter, sort_by, sort_order, start_index]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - all_users = w.users.list(attributes="id,userName", - sort_by="userName", - sort_order=iam.ListSortOrder.DESCENDING) - - List users. - - Gets details for all the users associated with a Databricks workspace. - - :param attributes: str (optional) - Comma-separated list of attributes to return in response. - :param count: int (optional) - Desired number of results per page. - :param excluded_attributes: str (optional) - Comma-separated list of attributes to exclude in response. - :param filter: str (optional) - Query by which the results have to be filtered. Supported operators are equals(`eq`), - contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be - formed using logical operators - `and` and `or`. The [SCIM RFC] has more details but we currently - only support simple expressions. - - [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - :param sort_by: str (optional) - Attribute to sort the results. Multi-part paths are supported. For example, `userName`, - `name.givenName`, and `emails`. - :param sort_order: :class:`ListSortOrder` (optional) - The order to sort the results. - :param start_index: int (optional) - Specifies the index of the first result. First item is number 1. - - :returns: Iterator over :class:`User` - - - .. py:method:: patch(id [, operations, schemas]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import iam - - w = WorkspaceClient() - - user = w.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - w.users.patch(id=user.id, - operations=[iam.Patch(op=iam.PatchOp.REPLACE, path="active", value="false")], - schemas=[iam.PatchSchema.URN_IETF_PARAMS_SCIM_API_MESSAGES_2_0_PATCH_OP]) - - Update user details. - - Partially updates a user resource by applying the supplied operations on specific user attributes. - - :param id: str - Unique ID for a user in the Databricks workspace. - :param operations: List[:class:`Patch`] (optional) - :param schemas: List[:class:`PatchSchema`] (optional) - The schema of the patch request. Must be ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - - - - - .. py:method:: set_permissions( [, access_control_list]) - - Set password permissions. - - Sets permissions on all passwords. Passwords can inherit permissions from their root object. - - :param access_control_list: List[:class:`PasswordAccessControlRequest`] (optional) - - :returns: :class:`PasswordPermissions` - - - .. py:method:: update(id [, active, display_name, emails, entitlements, external_id, groups, name, roles, schemas, user_name]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - user = w.users.create(display_name=f'sdk-{time.time_ns()}', user_name=f'sdk-{time.time_ns()}@example.com') - - w.users.update(id=user.id, user_name=user.user_name, active=True) - - Replace a user. - - Replaces a user's information with the data supplied in request. - - :param id: str - Databricks user ID. This is automatically set by Databricks. Any value provided by the client will - be ignored. - :param active: bool (optional) - If this user is active - :param display_name: str (optional) - String that represents a concatenation of given and family names. For example `John Smith`. This - field cannot be updated through the Workspace SCIM APIs when [identity federation is enabled]. Use - Account SCIM APIs to update `displayName`. - - [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation - :param emails: List[:class:`ComplexValue`] (optional) - All the emails associated with the Databricks user. - :param entitlements: List[:class:`ComplexValue`] (optional) - Entitlements assigned to the user. See [assigning entitlements] for a full list of supported values. - - [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - :param external_id: str (optional) - External ID is not currently supported. It is reserved for future use. - :param groups: List[:class:`ComplexValue`] (optional) - :param name: :class:`Name` (optional) - :param roles: List[:class:`ComplexValue`] (optional) - Corresponds to AWS instance profile/arn role. - :param schemas: List[:class:`UserSchema`] (optional) - The schema of the user. - :param user_name: str (optional) - Email address of the Databricks user. - - - - - .. py:method:: update_permissions( [, access_control_list]) - - Update password permissions. - - Updates the permissions on all passwords. Passwords can inherit permissions from their root object. - - :param access_control_list: List[:class:`PasswordAccessControlRequest`] (optional) - - :returns: :class:`PasswordPermissions` - \ No newline at end of file diff --git a/docs/workspace/volumes.rst b/docs/workspace/volumes.rst deleted file mode 100644 index 2c3e40539..000000000 --- a/docs/workspace/volumes.rst +++ /dev/null @@ -1,263 +0,0 @@ -Volumes -======= -.. py:class:: VolumesAPI - - Volumes are a Unity Catalog (UC) capability for accessing, storing, governing, organizing and processing - files. Use cases include running machine learning on unstructured data such as image, audio, video, or PDF - files, organizing data sets during the data exploration stages in data science, working with libraries - that require access to the local file system on cluster machines, storing library and config files of - arbitrary formats such as .whl or .txt centrally and providing secure access across workspaces to it, or - transforming and querying non-tabular data files in ETL. - - .. py:method:: create(catalog_name, schema_name, name, volume_type [, comment, storage_location]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - storage_credential = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]), - comment="created via SDK") - - external_location = w.external_locations.create(name=f'sdk-{time.time_ns()}', - credential_name=storage_credential.name, - comment="created via SDK", - url="s3://" + os.environ["TEST_BUCKET"] + "/" + - f'sdk-{time.time_ns()}') - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - created_volume = w.volumes.create(catalog_name=created_catalog.name, - schema_name=created_schema.name, - name=f'sdk-{time.time_ns()}', - storage_location=external_location.url, - volume_type=catalog.VolumeType.EXTERNAL) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.volumes.delete(full_name_arg=created_volume.full_name) - - Create a Volume. - - Creates a new volume. - - The user could create either an external volume or a managed volume. An external volume will be - created in the specified external location, while a managed volume will be located in the default - location which is specified by the parent schema, or the parent catalog, or the Metastore. - - For the volume creation to succeed, the user must satisfy following conditions: - The caller must be a - metastore admin, or be the owner of the parent catalog and schema, or have the **USE_CATALOG** - privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - The caller - must have **CREATE VOLUME** privilege on the parent schema. - - For an external volume, following conditions also need to satisfy - The caller must have **CREATE - EXTERNAL VOLUME** privilege on the external location. - There are no other tables, nor volumes - existing in the specified storage location. - The specified storage location is not under the location - of other tables, nor volumes, or catalogs or schemas. - - :param catalog_name: str - The name of the catalog where the schema and the volume are - :param schema_name: str - The name of the schema where the volume is - :param name: str - The name of the volume - :param volume_type: :class:`VolumeType` - :param comment: str (optional) - The comment attached to the volume - :param storage_location: str (optional) - The storage location on the cloud - - :returns: :class:`VolumeInfo` - - - .. py:method:: delete(full_name_arg) - - Delete a Volume. - - Deletes a volume from the specified parent catalog and schema. - - The caller must be a metastore admin or an owner of the volume. For the latter case, the caller must - also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - privilege on the parent schema. - - :param full_name_arg: str - The three-level (fully qualified) name of the volume - - - - - .. py:method:: list(catalog_name, schema_name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - all_volumes = w.volumes.list(catalog_name=created_catalog.name, schema_name=created_schema.name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - - List Volumes. - - Gets an array of all volumes for the current metastore under the parent catalog and schema. - - The returned volumes are filtered based on the privileges of the calling user. For example, the - metastore admin is able to list all the volumes. A regular user needs to be the owner or have the - **READ VOLUME** privilege on the volume to recieve the volumes in the response. For the latter case, - the caller must also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the - **USE_SCHEMA** privilege on the parent schema. - - There is no guarantee of a specific ordering of the elements in the array. - - :param catalog_name: str - The identifier of the catalog - :param schema_name: str - The identifier of the schema - - :returns: Iterator over :class:`VolumeInfo` - - - .. py:method:: read(full_name_arg) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - storage_credential = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]), - comment="created via SDK") - - external_location = w.external_locations.create(name=f'sdk-{time.time_ns()}', - credential_name=storage_credential.name, - comment="created via SDK", - url="s3://" + os.environ["TEST_BUCKET"] + "/" + - f'sdk-{time.time_ns()}') - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - created_volume = w.volumes.create(catalog_name=created_catalog.name, - schema_name=created_schema.name, - name=f'sdk-{time.time_ns()}', - storage_location=external_location.url, - volume_type=catalog.VolumeType.EXTERNAL) - - loaded_volume = w.volumes.read(full_name_arg=created_volume.full_name) - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.volumes.delete(full_name_arg=created_volume.full_name) - - Get a Volume. - - Gets a volume from the metastore for a specific catalog and schema. - - The caller must be a metastore admin or an owner of (or have the **READ VOLUME** privilege on) the - volume. For the latter case, the caller must also be the owner or have the **USE_CATALOG** privilege - on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - - :param full_name_arg: str - The three-level (fully qualified) name of the volume - - :returns: :class:`VolumeInfo` - - - .. py:method:: update(full_name_arg [, comment, name, owner]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import catalog - - w = WorkspaceClient() - - storage_credential = w.storage_credentials.create( - name=f'sdk-{time.time_ns()}', - aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]), - comment="created via SDK") - - external_location = w.external_locations.create(name=f'sdk-{time.time_ns()}', - credential_name=storage_credential.name, - comment="created via SDK", - url="s3://" + os.environ["TEST_BUCKET"] + "/" + - f'sdk-{time.time_ns()}') - - created_catalog = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - created_schema = w.schemas.create(name=f'sdk-{time.time_ns()}', catalog_name=created_catalog.name) - - created_volume = w.volumes.create(catalog_name=created_catalog.name, - schema_name=created_schema.name, - name=f'sdk-{time.time_ns()}', - storage_location=external_location.url, - volume_type=catalog.VolumeType.EXTERNAL) - - loaded_volume = w.volumes.read(full_name_arg=created_volume.full_name) - - _ = w.volumes.update(full_name_arg=loaded_volume.full_name, comment="Updated volume comment") - - # cleanup - w.schemas.delete(full_name=created_schema.full_name) - w.catalogs.delete(name=created_catalog.name, force=True) - w.volumes.delete(full_name_arg=created_volume.full_name) - - Update a Volume. - - Updates the specified volume under the specified parent catalog and schema. - - The caller must be a metastore admin or an owner of the volume. For the latter case, the caller must - also be the owner or have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** - privilege on the parent schema. - - Currently only the name, the owner or the comment of the volume could be updated. - - :param full_name_arg: str - The three-level (fully qualified) name of the volume - :param comment: str (optional) - The comment attached to the volume - :param name: str (optional) - The name of the volume - :param owner: str (optional) - The identifier of the user who owns the volume - - :returns: :class:`VolumeInfo` - \ No newline at end of file diff --git a/docs/workspace/warehouses.rst b/docs/workspace/warehouses.rst deleted file mode 100644 index b47412e72..000000000 --- a/docs/workspace/warehouses.rst +++ /dev/null @@ -1,371 +0,0 @@ -SQL Warehouses -============== -.. py:class:: WarehousesAPI - - A SQL warehouse is a compute resource that lets you run SQL commands on data objects within Databricks - SQL. Compute resources are infrastructure resources that provide processing capabilities in the cloud. - - .. py:method:: create( [, auto_stop_mins, channel, cluster_size, creator_name, enable_photon, enable_serverless_compute, instance_profile_arn, max_num_clusters, min_num_clusters, name, spot_instance_policy, tags, warehouse_type]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.warehouses.create(name=f'sdk-{time.time_ns()}', - cluster_size="2X-Small", - max_num_clusters=1, - auto_stop_mins=10).result() - - # cleanup - w.warehouses.delete(id=created.id) - - Create a warehouse. - - Creates a new SQL warehouse. - - :param auto_stop_mins: int (optional) - The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) before it - is automatically stopped. - - Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. - - Defaults to 120 mins - :param channel: :class:`Channel` (optional) - Channel Details - :param cluster_size: str (optional) - Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows you - to run larger queries on it. If you want to increase the number of concurrent queries, please tune - max_num_clusters. - - Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large - - 4X-Large - :param creator_name: str (optional) - warehouse creator name - :param enable_photon: bool (optional) - Configures whether the warehouse should use Photon optimized clusters. - - Defaults to false. - :param enable_serverless_compute: bool (optional) - Configures whether the warehouse should use serverless compute - :param instance_profile_arn: str (optional) - Deprecated. Instance profile used to pass IAM role to the cluster - :param max_num_clusters: int (optional) - Maximum number of clusters that the autoscaler will create to handle concurrent queries. - - Supported values: - Must be >= min_num_clusters - Must be <= 30. - - Defaults to min_clusters if unset. - :param min_num_clusters: int (optional) - Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing this - will ensure that a larger number of clusters are always running and therefore may reduce the cold - start time for new queries. This is similar to reserved vs. revocable cores in a resource manager. - - Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) - - Defaults to 1 - :param name: str (optional) - Logical name for the cluster. - - Supported values: - Must be unique within an org. - Must be less than 100 characters. - :param spot_instance_policy: :class:`SpotInstancePolicy` (optional) - Configurations whether the warehouse should use spot instances. - :param tags: :class:`EndpointTags` (optional) - A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) - associated with this SQL warehouse. - - Supported values: - Number of tags < 45. - :param warehouse_type: :class:`CreateWarehouseRequestWarehouseType` (optional) - Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` and - also set the field `enable_serverless_compute` to `true`. - - :returns: - Long-running operation waiter for :class:`GetWarehouseResponse`. - See :method:wait_get_warehouse_running for more details. - - - .. py:method:: delete(id) - - Delete a warehouse. - - Deletes a SQL warehouse. - - :param id: str - Required. Id of the SQL warehouse. - - - - - .. py:method:: edit(id [, auto_stop_mins, channel, cluster_size, creator_name, enable_photon, enable_serverless_compute, instance_profile_arn, max_num_clusters, min_num_clusters, name, spot_instance_policy, tags, warehouse_type]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.warehouses.create(name=f'sdk-{time.time_ns()}', - cluster_size="2X-Small", - max_num_clusters=1, - auto_stop_mins=10).result() - - _ = w.warehouses.edit(id=created.id, - name=f'sdk-{time.time_ns()}', - cluster_size="2X-Small", - max_num_clusters=1, - auto_stop_mins=10) - - # cleanup - w.warehouses.delete(id=created.id) - - Update a warehouse. - - Updates the configuration for a SQL warehouse. - - :param id: str - Required. Id of the warehouse to configure. - :param auto_stop_mins: int (optional) - The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) before it - is automatically stopped. - - Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. - - Defaults to 120 mins - :param channel: :class:`Channel` (optional) - Channel Details - :param cluster_size: str (optional) - Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows you - to run larger queries on it. If you want to increase the number of concurrent queries, please tune - max_num_clusters. - - Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large - - 4X-Large - :param creator_name: str (optional) - warehouse creator name - :param enable_photon: bool (optional) - Configures whether the warehouse should use Photon optimized clusters. - - Defaults to false. - :param enable_serverless_compute: bool (optional) - Configures whether the warehouse should use serverless compute. - :param instance_profile_arn: str (optional) - Deprecated. Instance profile used to pass IAM role to the cluster - :param max_num_clusters: int (optional) - Maximum number of clusters that the autoscaler will create to handle concurrent queries. - - Supported values: - Must be >= min_num_clusters - Must be <= 30. - - Defaults to min_clusters if unset. - :param min_num_clusters: int (optional) - Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing this - will ensure that a larger number of clusters are always running and therefore may reduce the cold - start time for new queries. This is similar to reserved vs. revocable cores in a resource manager. - - Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) - - Defaults to 1 - :param name: str (optional) - Logical name for the cluster. - - Supported values: - Must be unique within an org. - Must be less than 100 characters. - :param spot_instance_policy: :class:`SpotInstancePolicy` (optional) - Configurations whether the warehouse should use spot instances. - :param tags: :class:`EndpointTags` (optional) - A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) - associated with this SQL warehouse. - - Supported values: - Number of tags < 45. - :param warehouse_type: :class:`EditWarehouseRequestWarehouseType` (optional) - Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` and - also set the field `enable_serverless_compute` to `true`. - - :returns: - Long-running operation waiter for :class:`GetWarehouseResponse`. - See :method:wait_get_warehouse_running for more details. - - - .. py:method:: get(id) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.warehouses.create(name=f'sdk-{time.time_ns()}', - cluster_size="2X-Small", - max_num_clusters=1, - auto_stop_mins=10).result() - - wh = w.warehouses.get(id=created.id) - - # cleanup - w.warehouses.delete(id=created.id) - - Get warehouse info. - - Gets the information for a single SQL warehouse. - - :param id: str - Required. Id of the SQL warehouse. - - :returns: :class:`GetWarehouseResponse` - - - .. py:method:: get_permission_levels(warehouse_id) - - Get SQL warehouse permission levels. - - Gets the permission levels that a user can have on an object. - - :param warehouse_id: str - The SQL warehouse for which to get or manage permissions. - - :returns: :class:`GetWarehousePermissionLevelsResponse` - - - .. py:method:: get_permissions(warehouse_id) - - Get SQL warehouse permissions. - - Gets the permissions of a SQL warehouse. SQL warehouses can inherit permissions from their root - object. - - :param warehouse_id: str - The SQL warehouse for which to get or manage permissions. - - :returns: :class:`WarehousePermissions` - - - .. py:method:: get_workspace_warehouse_config() - - Get the workspace configuration. - - Gets the workspace level configuration that is shared by all SQL warehouses in a workspace. - - :returns: :class:`GetWorkspaceWarehouseConfigResponse` - - - .. py:method:: list( [, run_as_user_id]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import sql - - w = WorkspaceClient() - - all = w.warehouses.list(sql.ListWarehousesRequest()) - - List warehouses. - - Lists all SQL warehouses that a user has manager permissions on. - - :param run_as_user_id: int (optional) - Service Principal which will be used to fetch the list of warehouses. If not specified, the user - from the session header is used. - - :returns: Iterator over :class:`EndpointInfo` - - - .. py:method:: set_permissions(warehouse_id [, access_control_list]) - - Set SQL warehouse permissions. - - Sets permissions on a SQL warehouse. SQL warehouses can inherit permissions from their root object. - - :param warehouse_id: str - The SQL warehouse for which to get or manage permissions. - :param access_control_list: List[:class:`WarehouseAccessControlRequest`] (optional) - - :returns: :class:`WarehousePermissions` - - - .. py:method:: set_workspace_warehouse_config( [, channel, config_param, data_access_config, enabled_warehouse_types, global_param, google_service_account, instance_profile_arn, security_policy, sql_configuration_parameters]) - - Set the workspace configuration. - - Sets the workspace level configuration that is shared by all SQL warehouses in a workspace. - - :param channel: :class:`Channel` (optional) - Optional: Channel selection details - :param config_param: :class:`RepeatedEndpointConfPairs` (optional) - Deprecated: Use sql_configuration_parameters - :param data_access_config: List[:class:`EndpointConfPair`] (optional) - Spark confs for external hive metastore configuration JSON serialized size must be less than <= 512K - :param enabled_warehouse_types: List[:class:`WarehouseTypePair`] (optional) - List of Warehouse Types allowed in this workspace (limits allowed value of the type field in - CreateWarehouse and EditWarehouse). Note: Some types cannot be disabled, they don't need to be - specified in SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing warehouses to be - converted to another type. Used by frontend to save specific type availability in the warehouse - create and edit form UI. - :param global_param: :class:`RepeatedEndpointConfPairs` (optional) - Deprecated: Use sql_configuration_parameters - :param google_service_account: str (optional) - GCP only: Google Service Account used to pass to cluster to access Google Cloud Storage - :param instance_profile_arn: str (optional) - AWS Only: Instance profile used to pass IAM role to the cluster - :param security_policy: :class:`SetWorkspaceWarehouseConfigRequestSecurityPolicy` (optional) - Security policy for warehouses - :param sql_configuration_parameters: :class:`RepeatedEndpointConfPairs` (optional) - SQL configuration parameters - - - - - .. py:method:: start(id) - - Start a warehouse. - - Starts a SQL warehouse. - - :param id: str - Required. Id of the SQL warehouse. - - :returns: - Long-running operation waiter for :class:`GetWarehouseResponse`. - See :method:wait_get_warehouse_running for more details. - - - .. py:method:: stop(id) - - Stop a warehouse. - - Stops a SQL warehouse. - - :param id: str - Required. Id of the SQL warehouse. - - :returns: - Long-running operation waiter for :class:`GetWarehouseResponse`. - See :method:wait_get_warehouse_stopped for more details. - - - .. py:method:: update_permissions(warehouse_id [, access_control_list]) - - Update SQL warehouse permissions. - - Updates the permissions on a SQL warehouse. SQL warehouses can inherit permissions from their root - object. - - :param warehouse_id: str - The SQL warehouse for which to get or manage permissions. - :param access_control_list: List[:class:`WarehouseAccessControlRequest`] (optional) - - :returns: :class:`WarehousePermissions` - \ No newline at end of file diff --git a/docs/workspace/workspace-catalog.rst b/docs/workspace/workspace-catalog.rst deleted file mode 100644 index 9a0342e31..000000000 --- a/docs/workspace/workspace-catalog.rst +++ /dev/null @@ -1,25 +0,0 @@ - -Unity Catalog -============= - -Configure data governance with Unity Catalog for metastores, catalogs, schemas, tables, external locations, and storage credentials - -.. toctree:: - :maxdepth: 1 - - artifact_allowlists - catalogs - connections - external_locations - functions - grants - metastores - model_versions - registered_models - schemas - storage_credentials - system_schemas - table_constraints - tables - volumes - workspace_bindings \ No newline at end of file diff --git a/docs/workspace/workspace-compute.rst b/docs/workspace/workspace-compute.rst deleted file mode 100644 index cbb4bb833..000000000 --- a/docs/workspace/workspace-compute.rst +++ /dev/null @@ -1,17 +0,0 @@ - -Compute -======= - -Use and configure compute for Databricks - -.. toctree:: - :maxdepth: 1 - - cluster_policies - clusters - command_execution - global_init_scripts - instance_pools - instance_profiles - libraries - policy_families \ No newline at end of file diff --git a/docs/workspace/workspace-files.rst b/docs/workspace/workspace-files.rst deleted file mode 100644 index 88530a6b8..000000000 --- a/docs/workspace/workspace-files.rst +++ /dev/null @@ -1,10 +0,0 @@ - -File Management -=============== - -Manage files on Databricks in a filesystem-like interface - -.. toctree:: - :maxdepth: 1 - - dbfs \ No newline at end of file diff --git a/docs/workspace/workspace-iam.rst b/docs/workspace/workspace-iam.rst deleted file mode 100644 index 021ff539d..000000000 --- a/docs/workspace/workspace-iam.rst +++ /dev/null @@ -1,15 +0,0 @@ - -Identity and Access Management -============================== - -Manage users, service principals, groups and their permissions in Accounts and Workspaces - -.. toctree:: - :maxdepth: 1 - - account_access_control_proxy - current_user - groups - permissions - service_principals - users \ No newline at end of file diff --git a/docs/workspace/workspace-jobs.rst b/docs/workspace/workspace-jobs.rst deleted file mode 100644 index a1a53a955..000000000 --- a/docs/workspace/workspace-jobs.rst +++ /dev/null @@ -1,10 +0,0 @@ - -Jobs -==== - -Schedule automated jobs on Databricks Workspaces - -.. toctree:: - :maxdepth: 1 - - jobs \ No newline at end of file diff --git a/docs/workspace/workspace-ml.rst b/docs/workspace/workspace-ml.rst deleted file mode 100644 index e701cfd1d..000000000 --- a/docs/workspace/workspace-ml.rst +++ /dev/null @@ -1,11 +0,0 @@ - -Machine Learning -================ - -Create and manage experiments, features, and other machine learning artifacts - -.. toctree:: - :maxdepth: 1 - - experiments - model_registry \ No newline at end of file diff --git a/docs/workspace/workspace-pipelines.rst b/docs/workspace/workspace-pipelines.rst deleted file mode 100644 index 8213f87ef..000000000 --- a/docs/workspace/workspace-pipelines.rst +++ /dev/null @@ -1,10 +0,0 @@ - -Delta Live Tables -================= - -Manage pipelines, runs, and other Delta Live Table resources - -.. toctree:: - :maxdepth: 1 - - pipelines \ No newline at end of file diff --git a/docs/workspace/workspace-serving.rst b/docs/workspace/workspace-serving.rst deleted file mode 100644 index 754822d18..000000000 --- a/docs/workspace/workspace-serving.rst +++ /dev/null @@ -1,11 +0,0 @@ - -Real-time Serving -================= - -Use real-time inference for machine learning - -.. toctree:: - :maxdepth: 1 - - apps - serving_endpoints \ No newline at end of file diff --git a/docs/workspace/workspace-settings.rst b/docs/workspace/workspace-settings.rst deleted file mode 100644 index ffe66b24a..000000000 --- a/docs/workspace/workspace-settings.rst +++ /dev/null @@ -1,15 +0,0 @@ - -Settings -======== - -Manage security settings for Accounts and Workspaces - -.. toctree:: - :maxdepth: 1 - - credentials_manager - ip_access_lists - settings - token_management - tokens - workspace_conf \ No newline at end of file diff --git a/docs/workspace/workspace-sharing.rst b/docs/workspace/workspace-sharing.rst deleted file mode 100644 index 5ba08d21b..000000000 --- a/docs/workspace/workspace-sharing.rst +++ /dev/null @@ -1,14 +0,0 @@ - -Delta Sharing -============= - -Configure data sharing with Unity Catalog for providers, recipients, and shares - -.. toctree:: - :maxdepth: 1 - - clean_rooms - providers - recipient_activation - recipients - shares \ No newline at end of file diff --git a/docs/workspace/workspace-sql.rst b/docs/workspace/workspace-sql.rst deleted file mode 100644 index 3d1053f4a..000000000 --- a/docs/workspace/workspace-sql.rst +++ /dev/null @@ -1,19 +0,0 @@ - -Databricks SQL -============== - -Manage Databricks SQL assets, including warehouses, dashboards, queries and query history, and alerts - -.. toctree:: - :maxdepth: 1 - - alerts - dashboard_widgets - dashboards - data_sources - dbsql_permissions - queries - query_history - query_visualizations - statement_execution - warehouses \ No newline at end of file diff --git a/docs/workspace/workspace-workspace.rst b/docs/workspace/workspace-workspace.rst deleted file mode 100644 index 7845b7784..000000000 --- a/docs/workspace/workspace-workspace.rst +++ /dev/null @@ -1,13 +0,0 @@ - -Databricks Workspace -==================== - -Manage workspace-level entities that include notebooks, Git checkouts, and secrets - -.. toctree:: - :maxdepth: 1 - - git_credentials - repos - secrets - workspace \ No newline at end of file diff --git a/docs/workspace/workspace.rst b/docs/workspace/workspace.rst deleted file mode 100644 index fde30dda5..000000000 --- a/docs/workspace/workspace.rst +++ /dev/null @@ -1,334 +0,0 @@ -Workspace -========= -.. py:class:: WorkspaceExt - - The Workspace API allows you to list, import, export, and delete notebooks and folders. - - A notebook is a web-based interface to a document that contains runnable code, visualizations, and - explanatory text. - - .. py:method:: delete(path [, recursive]) - - Delete a workspace object. - - Deletes an object or a directory (and optionally recursively deletes all objects in the directory). * - If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`. * If `path` is a - non-empty directory and `recursive` is set to `false`, this call returns an error - `DIRECTORY_NOT_EMPTY`. - - Object deletion cannot be undone and deleting a directory recursively is not atomic. - - :param path: str - The absolute path of the notebook or directory. - :param recursive: bool (optional) - The flag that specifies whether to delete the object recursively. It is `false` by default. Please - note this deleting directory is not atomic. If it fails in the middle, some of objects under this - directory may be deleted and cannot be undone. - - - - - .. py:method:: download(path [, format]) - - Usage: - - .. code-block:: - - import io - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service.workspace import ImportFormat - - w = WorkspaceClient() - - py_file = f'/Users/{w.current_user.me().user_name}/file-{time.time_ns()}.py' - - w.workspace.upload(py_file, io.BytesIO(b'print(1)'), format=ImportFormat.AUTO) - with w.workspace.download(py_file) as f: - content = f.read() - assert content == b'print(1)' - - w.workspace.delete(py_file) - - - Downloads notebook or file from the workspace - - :param path: location of the file or notebook on workspace. - :param format: By default, `ExportFormat.SOURCE`. If using `ExportFormat.AUTO` the `path` - is imported or exported as either a workspace file or a notebook, depending - on an analysis of the `item`’s extension and the header content provided in - the request. - :return: file-like `io.BinaryIO` of the `path` contents. - - - .. py:method:: export(path [, format]) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import workspace - - w = WorkspaceClient() - - notebook = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - export_response = w.workspace.export(format=workspace.ExportFormat.SOURCE, path=notebook) - - Export a workspace object. - - Exports an object or the contents of an entire directory. - - If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`. - - If the exported data would exceed size limit, this call returns `MAX_NOTEBOOK_SIZE_EXCEEDED`. - Currently, this API does not support exporting a library. - - :param path: str - The absolute path of the object or directory. Exporting a directory is only supported for the `DBC`, - `SOURCE`, and `AUTO` format. - :param format: :class:`ExportFormat` (optional) - This specifies the format of the exported file. By default, this is `SOURCE`. - - The value is case sensitive. - - - `SOURCE`: The notebook is exported as source code. Directory exports will not include non-notebook - entries. - `HTML`: The notebook is exported as an HTML file. - `JUPYTER`: The notebook is exported - as a Jupyter/IPython Notebook file. - `DBC`: The notebook is exported in Databricks archive format. - Directory exports will not include non-notebook entries. - `R_MARKDOWN`: The notebook is exported to - R Markdown format. - `AUTO`: The object or directory is exported depending on the objects type. - Directory exports will include notebooks and workspace files. - - :returns: :class:`ExportResponse` - - - .. py:method:: get_permission_levels(workspace_object_type, workspace_object_id) - - Get workspace object permission levels. - - Gets the permission levels that a user can have on an object. - - :param workspace_object_type: str - The workspace object type for which to get or manage permissions. - :param workspace_object_id: str - The workspace object for which to get or manage permissions. - - :returns: :class:`GetWorkspaceObjectPermissionLevelsResponse` - - - .. py:method:: get_permissions(workspace_object_type, workspace_object_id) - - Get workspace object permissions. - - Gets the permissions of a workspace object. Workspace objects can inherit permissions from their - parent objects or root object. - - :param workspace_object_type: str - The workspace object type for which to get or manage permissions. - :param workspace_object_id: str - The workspace object for which to get or manage permissions. - - :returns: :class:`WorkspaceObjectPermissions` - - - .. py:method:: get_status(path) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - obj = w.workspace.get_status(path=notebook_path) - - Get status. - - Gets the status of an object or a directory. If `path` does not exist, this call returns an error - `RESOURCE_DOES_NOT_EXIST`. - - :param path: str - The absolute path of the notebook or directory. - - :returns: :class:`ObjectInfo` - - - .. py:method:: import_(path [, content, format, language, overwrite]) - - Usage: - - .. code-block:: - - import base64 - import time - - from databricks.sdk import WorkspaceClient - from databricks.sdk.service import workspace - - w = WorkspaceClient() - - notebook_path = f'/Users/{w.current_user.me().user_name}/sdk-{time.time_ns()}' - - w.workspace.import_(content=base64.b64encode(("CREATE LIVE TABLE dlt_sample AS SELECT 1").encode()).decode(), - format=workspace.ImportFormat.SOURCE, - language=workspace.Language.SQL, - overwrite=True, - path=notebook_path) - - Import a workspace object. - - Imports a workspace object (for example, a notebook or file) or the contents of an entire directory. - If `path` already exists and `overwrite` is set to `false`, this call returns an error - `RESOURCE_ALREADY_EXISTS`. To import a directory, you can use either the `DBC` format or the `SOURCE` - format with the `language` field unset. To import a single file as `SOURCE`, you must set the - `language` field. - - :param path: str - The absolute path of the object or directory. Importing a directory is only supported for the `DBC` - and `SOURCE` formats. - :param content: str (optional) - The base64-encoded content. This has a limit of 10 MB. - - If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown. - This parameter might be absent, and instead a posted file is used. - :param format: :class:`ImportFormat` (optional) - This specifies the format of the file to be imported. - - The value is case sensitive. - - - `AUTO`: The item is imported depending on an analysis of the item's extension and the header - content provided in the request. If the item is imported as a notebook, then the item's extension is - automatically removed. - `SOURCE`: The notebook or directory is imported as source code. - `HTML`: - The notebook is imported as an HTML file. - `JUPYTER`: The notebook is imported as a Jupyter/IPython - Notebook file. - `DBC`: The notebook is imported in Databricks archive format. Required for - directories. - `R_MARKDOWN`: The notebook is imported from R Markdown format. - :param language: :class:`Language` (optional) - The language of the object. This value is set only if the object type is `NOTEBOOK`. - :param overwrite: bool (optional) - The flag that specifies whether to overwrite existing object. It is `false` by default. For `DBC` - format, `overwrite` is not supported since it may contain a directory. - - - - - .. py:method:: list(path [, notebooks_modified_after, recursive]) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - names = [] - for i in w.workspace.list(f'/Users/{w.current_user.me().user_name}', recursive=True): - names.append(i.path) - assert len(names) > 0 - - List workspace objects - - :param recursive: bool - Optionally invoke recursive traversal - - :returns: Iterator of workspaceObjectInfo - - - .. py:method:: mkdirs(path) - - Create a directory. - - Creates the specified directory (and necessary parent directories if they do not exist). If there is - an object (not a directory) at any prefix of the input path, this call returns an error - `RESOURCE_ALREADY_EXISTS`. - - Note that if this operation fails it may have succeeded in creating some of the necessary parent - directories. - - :param path: str - The absolute path of the directory. If the parent directories do not exist, it will also create - them. If the directory already exists, this command will do nothing and succeed. - - - - - .. py:method:: set_permissions(workspace_object_type, workspace_object_id [, access_control_list]) - - Set workspace object permissions. - - Sets permissions on a workspace object. Workspace objects can inherit permissions from their parent - objects or root object. - - :param workspace_object_type: str - The workspace object type for which to get or manage permissions. - :param workspace_object_id: str - The workspace object for which to get or manage permissions. - :param access_control_list: List[:class:`WorkspaceObjectAccessControlRequest`] (optional) - - :returns: :class:`WorkspaceObjectPermissions` - - - .. py:method:: update_permissions(workspace_object_type, workspace_object_id [, access_control_list]) - - Update workspace object permissions. - - Updates the permissions on a workspace object. Workspace objects can inherit permissions from their - parent objects or root object. - - :param workspace_object_type: str - The workspace object type for which to get or manage permissions. - :param workspace_object_id: str - The workspace object for which to get or manage permissions. - :param access_control_list: List[:class:`WorkspaceObjectAccessControlRequest`] (optional) - - :returns: :class:`WorkspaceObjectPermissions` - - - .. py:method:: upload(path, content [, format, language, overwrite]) - - Usage: - - .. code-block:: - - import io - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - notebook = f'/Users/{w.current_user.me().user_name}/notebook-{time.time_ns()}.py' - - w.workspace.upload(notebook, io.BytesIO(b'print(1)')) - with w.workspace.download(notebook) as f: - content = f.read() - assert content == b'# Databricks notebook source\nprint(1)' - - w.workspace.delete(notebook) - - - Uploads a workspace object (for example, a notebook or file) or the contents of an entire - directory (`DBC` format). - - Errors: - * `RESOURCE_ALREADY_EXISTS`: if `path` already exists no `overwrite=True`. - * `INVALID_PARAMETER_VALUE`: if `format` and `content` values are not compatible. - - :param path: target location of the file on workspace. - :param content: file-like `io.BinaryIO` of the `path` contents. - :param format: By default, `ImportFormat.SOURCE`. If using `ImportFormat.AUTO` the `path` - is imported or exported as either a workspace file or a notebook, depending - on an analysis of the `item`’s extension and the header content provided in - the request. In addition, if the `path` is imported as a notebook, then - the `item`’s extension is automatically removed. - :param language: Only required if using `ExportFormat.SOURCE`. - \ No newline at end of file diff --git a/docs/workspace/workspace_bindings.rst b/docs/workspace/workspace_bindings.rst deleted file mode 100644 index 82c901e06..000000000 --- a/docs/workspace/workspace_bindings.rst +++ /dev/null @@ -1,119 +0,0 @@ -Workspace Bindings -================== -.. py:class:: WorkspaceBindingsAPI - - A securable in Databricks can be configured as __OPEN__ or __ISOLATED__. An __OPEN__ securable can be - accessed from any workspace, while an __ISOLATED__ securable can only be accessed from a configured list - of workspaces. This API allows you to configure (bind) securables to workspaces. - - NOTE: The __isolation_mode__ is configured for the securable itself (using its Update method) and the - workspace bindings are only consulted when the securable's __isolation_mode__ is set to __ISOLATED__. - - A securable's workspace bindings can be configured by a metastore admin or the owner of the securable. - - The original path (/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}) is deprecated. Please use - the new path (/api/2.1/unity-catalog/bindings/{securable_type}/{securable_name}) which introduces the - ability to bind a securable in READ_ONLY mode (catalogs only). - - Securables that support binding: - catalog - - .. py:method:: get(name) - - Usage: - - .. code-block:: - - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - created = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - bindings = w.workspace_bindings.get(name=created.name) - - # cleanup - w.catalogs.delete(name=created.name, force=True) - - Get catalog workspace bindings. - - Gets workspace bindings of the catalog. The caller must be a metastore admin or an owner of the - catalog. - - :param name: str - The name of the catalog. - - :returns: :class:`CurrentWorkspaceBindings` - - - .. py:method:: get_bindings(securable_type, securable_name) - - Get securable workspace bindings. - - Gets workspace bindings of the securable. The caller must be a metastore admin or an owner of the - securable. - - :param securable_type: str - The type of the securable. - :param securable_name: str - The name of the securable. - - :returns: :class:`WorkspaceBindingsResponse` - - - .. py:method:: update(name [, assign_workspaces, unassign_workspaces]) - - Usage: - - .. code-block:: - - import os - import time - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - this_workspace_id = os.environ["THIS_WORKSPACE_ID"] - - created = w.catalogs.create(name=f'sdk-{time.time_ns()}') - - _ = w.workspace_bindings.update(name=created.name, assign_workspaces=[this_workspace_id]) - - # cleanup - w.catalogs.delete(name=created.name, force=True) - - Update catalog workspace bindings. - - Updates workspace bindings of the catalog. The caller must be a metastore admin or an owner of the - catalog. - - :param name: str - The name of the catalog. - :param assign_workspaces: List[int] (optional) - A list of workspace IDs. - :param unassign_workspaces: List[int] (optional) - A list of workspace IDs. - - :returns: :class:`CurrentWorkspaceBindings` - - - .. py:method:: update_bindings(securable_type, securable_name [, add, remove]) - - Update securable workspace bindings. - - Updates workspace bindings of the securable. The caller must be a metastore admin or an owner of the - securable. - - :param securable_type: str - The type of the securable. - :param securable_name: str - The name of the securable. - :param add: List[:class:`WorkspaceBinding`] (optional) - List of workspace bindings - :param remove: List[:class:`WorkspaceBinding`] (optional) - List of workspace bindings - - :returns: :class:`WorkspaceBindingsResponse` - \ No newline at end of file diff --git a/docs/workspace/workspace_conf.rst b/docs/workspace/workspace_conf.rst deleted file mode 100644 index d00ce3529..000000000 --- a/docs/workspace/workspace_conf.rst +++ /dev/null @@ -1,36 +0,0 @@ -Workspace Conf -============== -.. py:class:: WorkspaceConfAPI - - This API allows updating known workspace settings for advanced users. - - .. py:method:: get_status(keys) - - Usage: - - .. code-block:: - - from databricks.sdk import WorkspaceClient - - w = WorkspaceClient() - - conf = w.workspace_conf.get_status(keys="enableWorkspaceFilesystem") - - Check configuration status. - - Gets the configuration status for a workspace. - - :param keys: str - - :returns: Dict[str,str] - - - .. py:method:: set_status() - - Enable/disable features. - - Sets the configuration status for a workspace, including enabling or disabling it. - - - - \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..87ef0a477 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,13 @@ +# Examples of using the SDK + +The Databricks SDK for Python comes with a number of examples demonstrating how to use the library for various common use-cases, including + +* [Using the SDK with OAuth from a webserver](https://github.com/databricks/databricks-sdk-py/blob/main/examples/flask_app_with_oauth.py) +* [Using long-running operations](https://github.com/databricks/databricks-sdk-py/blob/main/examples/starting_job_and_waiting.py) +* [Authenticating a client app using OAuth](https://github.com/databricks/databricks-sdk-py/blob/main/examples/local_browser_oauth.py) + +The examples are organized by the Databricks API that they use. Hand-written examples are present in the `examples/` directory. Generated examples are available in subdirectories, each corresponding to a Databricks service. + +We welcome contributions of new examples or corrections to existing ones. Before contributing, be aware of the following caveats: +* Examples in service-specific subdirectories are autogenerated. Do not edit these directly; changes will be overwritten the next time SDK code is generated. +* Examples are not automatically tested as part of the CI pipeline. If you add a new example, please test it manually before submitting a PR. diff --git a/examples/catalogs/update_catalogs.py b/examples/catalogs/update_catalogs.py index dc9cd6417..6f8e257cd 100755 --- a/examples/catalogs/update_catalogs.py +++ b/examples/catalogs/update_catalogs.py @@ -1,15 +1,12 @@ import time from databricks.sdk import WorkspaceClient -from databricks.sdk.service import catalog w = WorkspaceClient() created = w.catalogs.create(name=f'sdk-{time.time_ns()}') -_ = w.catalogs.update(name=created.name, - comment="updated", - enable_predictive_optimization=catalog.EnablePredictiveOptimization.ENABLE) +_ = w.catalogs.update(name=created.name, comment="updated") # cleanup w.catalogs.delete(name=created.name, force=True) diff --git a/examples/external_locations/create_volumes.py b/examples/external_locations/create_volumes.py index 6e0027e3c..4455afa7f 100755 --- a/examples/external_locations/create_volumes.py +++ b/examples/external_locations/create_volumes.py @@ -16,3 +16,7 @@ comment="created via SDK", url="s3://" + os.environ["TEST_BUCKET"] + "/" + f'sdk-{time.time_ns()}') + +# cleanup +w.storage_credentials.delete(name=storage_credential.name) +w.external_locations.delete(name=external_location.name) diff --git a/examples/storage_credentials/create_volumes.py b/examples/storage_credentials/create_volumes.py index 4c9383bbf..d0d9a6eda 100755 --- a/examples/storage_credentials/create_volumes.py +++ b/examples/storage_credentials/create_volumes.py @@ -10,3 +10,6 @@ name=f'sdk-{time.time_ns()}', aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]), comment="created via SDK") + +# cleanup +w.storage_credentials.delete(name=storage_credential.name) diff --git a/examples/volumes/create_volumes.py b/examples/volumes/create_volumes.py index 660451bf4..e951798d9 100755 --- a/examples/volumes/create_volumes.py +++ b/examples/volumes/create_volumes.py @@ -28,6 +28,8 @@ volume_type=catalog.VolumeType.EXTERNAL) # cleanup +w.storage_credentials.delete(name=storage_credential.name) +w.external_locations.delete(name=external_location.name) w.schemas.delete(full_name=created_schema.full_name) w.catalogs.delete(name=created_catalog.name, force=True) w.volumes.delete(full_name_arg=created_volume.full_name) diff --git a/examples/volumes/read_volumes.py b/examples/volumes/read_volumes.py index 3051ddd6f..88077c06e 100755 --- a/examples/volumes/read_volumes.py +++ b/examples/volumes/read_volumes.py @@ -30,6 +30,8 @@ loaded_volume = w.volumes.read(full_name_arg=created_volume.full_name) # cleanup +w.storage_credentials.delete(name=storage_credential.name) +w.external_locations.delete(name=external_location.name) w.schemas.delete(full_name=created_schema.full_name) w.catalogs.delete(name=created_catalog.name, force=True) w.volumes.delete(full_name_arg=created_volume.full_name) diff --git a/examples/volumes/update_volumes.py b/examples/volumes/update_volumes.py index 6becccb10..497ccf421 100755 --- a/examples/volumes/update_volumes.py +++ b/examples/volumes/update_volumes.py @@ -32,6 +32,8 @@ _ = w.volumes.update(full_name_arg=loaded_volume.full_name, comment="Updated volume comment") # cleanup +w.storage_credentials.delete(name=storage_credential.name) +w.external_locations.delete(name=external_location.name) w.schemas.delete(full_name=created_schema.full_name) w.catalogs.delete(name=created_catalog.name, force=True) w.volumes.delete(full_name_arg=created_volume.full_name)