databricks-sdk 0.17.0__py3-none-any.whl → 0.19.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of databricks-sdk might be problematic. Click here for more details.

Files changed (36) hide show
  1. databricks/sdk/__init__.py +41 -5
  2. databricks/sdk/azure.py +17 -7
  3. databricks/sdk/clock.py +49 -0
  4. databricks/sdk/config.py +459 -0
  5. databricks/sdk/core.py +7 -1026
  6. databricks/sdk/credentials_provider.py +628 -0
  7. databricks/sdk/environments.py +72 -0
  8. databricks/sdk/errors/__init__.py +1 -1
  9. databricks/sdk/errors/mapper.py +5 -5
  10. databricks/sdk/mixins/workspace.py +3 -3
  11. databricks/sdk/oauth.py +2 -1
  12. databricks/sdk/retries.py +9 -5
  13. databricks/sdk/service/_internal.py +1 -1
  14. databricks/sdk/service/catalog.py +946 -82
  15. databricks/sdk/service/compute.py +106 -41
  16. databricks/sdk/service/files.py +145 -31
  17. databricks/sdk/service/iam.py +44 -40
  18. databricks/sdk/service/jobs.py +199 -20
  19. databricks/sdk/service/ml.py +33 -42
  20. databricks/sdk/service/oauth2.py +3 -4
  21. databricks/sdk/service/pipelines.py +51 -31
  22. databricks/sdk/service/serving.py +1 -2
  23. databricks/sdk/service/settings.py +377 -72
  24. databricks/sdk/service/sharing.py +3 -4
  25. databricks/sdk/service/sql.py +27 -19
  26. databricks/sdk/service/vectorsearch.py +13 -17
  27. databricks/sdk/service/workspace.py +20 -11
  28. databricks/sdk/version.py +1 -1
  29. {databricks_sdk-0.17.0.dist-info → databricks_sdk-0.19.0.dist-info}/METADATA +4 -4
  30. databricks_sdk-0.19.0.dist-info/RECORD +53 -0
  31. databricks_sdk-0.17.0.dist-info/RECORD +0 -49
  32. /databricks/sdk/errors/{mapping.py → platform.py} +0 -0
  33. {databricks_sdk-0.17.0.dist-info → databricks_sdk-0.19.0.dist-info}/LICENSE +0 -0
  34. {databricks_sdk-0.17.0.dist-info → databricks_sdk-0.19.0.dist-info}/NOTICE +0 -0
  35. {databricks_sdk-0.17.0.dist-info → databricks_sdk-0.19.0.dist-info}/WHEEL +0 -0
  36. {databricks_sdk-0.17.0.dist-info → databricks_sdk-0.19.0.dist-info}/top_level.txt +0 -0
@@ -882,8 +882,7 @@ class ExperimentAccessControlRequest:
882
882
  """Permission level"""
883
883
 
884
884
  service_principal_name: Optional[str] = None
885
- """Application ID of an active service principal. Setting this field requires the
886
- `servicePrincipal/user` role."""
885
+ """application ID of a service principal"""
887
886
 
888
887
  user_name: Optional[str] = None
889
888
  """name of the user"""
@@ -2085,8 +2084,7 @@ class RegisteredModelAccessControlRequest:
2085
2084
  """Permission level"""
2086
2085
 
2087
2086
  service_principal_name: Optional[str] = None
2088
- """Application ID of an active service principal. Setting this field requires the
2089
- `servicePrincipal/user` role."""
2087
+ """application ID of a service principal"""
2090
2088
 
2091
2089
  user_name: Optional[str] = None
2092
2090
  """name of the user"""
@@ -3594,7 +3592,8 @@ class ExperimentsAPI:
3594
3592
  """Delete runs by creation time.
3595
3593
 
3596
3594
  Bulk delete runs in an experiment that were created prior to or at the specified timestamp. Deletes at
3597
- most max_runs per request.
3595
+ most max_runs per request. To call this API from a Databricks Notebook in Python, you can use the
3596
+ client code snippet on https://learn.microsoft.com/en-us/azure/databricks/mlflow/runs#bulk-delete.
3598
3597
 
3599
3598
  :param experiment_id: str
3600
3599
  The ID of the experiment containing the runs to delete.
@@ -3711,10 +3710,9 @@ class ExperimentsAPI:
3711
3710
 
3712
3711
  while True:
3713
3712
  json = self._api.do('GET', '/api/2.0/mlflow/metrics/get-history', query=query, headers=headers)
3714
- if 'metrics' not in json or not json['metrics']:
3715
- return
3716
- for v in json['metrics']:
3717
- yield Metric.from_dict(v)
3713
+ if 'metrics' in json:
3714
+ for v in json['metrics']:
3715
+ yield Metric.from_dict(v)
3718
3716
  if 'next_page_token' not in json or not json['next_page_token']:
3719
3717
  return
3720
3718
  query['page_token'] = json['next_page_token']
@@ -3808,10 +3806,9 @@ class ExperimentsAPI:
3808
3806
 
3809
3807
  while True:
3810
3808
  json = self._api.do('GET', '/api/2.0/mlflow/artifacts/list', query=query, headers=headers)
3811
- if 'files' not in json or not json['files']:
3812
- return
3813
- for v in json['files']:
3814
- yield FileInfo.from_dict(v)
3809
+ if 'files' in json:
3810
+ for v in json['files']:
3811
+ yield FileInfo.from_dict(v)
3815
3812
  if 'next_page_token' not in json or not json['next_page_token']:
3816
3813
  return
3817
3814
  query['page_token'] = json['next_page_token']
@@ -3845,10 +3842,9 @@ class ExperimentsAPI:
3845
3842
 
3846
3843
  while True:
3847
3844
  json = self._api.do('GET', '/api/2.0/mlflow/experiments/list', query=query, headers=headers)
3848
- if 'experiments' not in json or not json['experiments']:
3849
- return
3850
- for v in json['experiments']:
3851
- yield Experiment.from_dict(v)
3845
+ if 'experiments' in json:
3846
+ for v in json['experiments']:
3847
+ yield Experiment.from_dict(v)
3852
3848
  if 'next_page_token' not in json or not json['next_page_token']:
3853
3849
  return
3854
3850
  query['page_token'] = json['next_page_token']
@@ -4068,7 +4064,8 @@ class ExperimentsAPI:
4068
4064
  """Restore runs by deletion time.
4069
4065
 
4070
4066
  Bulk restore runs in an experiment that were deleted no earlier than the specified timestamp. Restores
4071
- at most max_runs per request.
4067
+ at most max_runs per request. To call this API from a Databricks Notebook in Python, you can use the
4068
+ client code snippet on https://learn.microsoft.com/en-us/azure/databricks/mlflow/runs#bulk-restore.
4072
4069
 
4073
4070
  :param experiment_id: str
4074
4071
  The ID of the experiment containing the runs to restore.
@@ -4125,10 +4122,9 @@ class ExperimentsAPI:
4125
4122
 
4126
4123
  while True:
4127
4124
  json = self._api.do('POST', '/api/2.0/mlflow/experiments/search', body=body, headers=headers)
4128
- if 'experiments' not in json or not json['experiments']:
4129
- return
4130
- for v in json['experiments']:
4131
- yield Experiment.from_dict(v)
4125
+ if 'experiments' in json:
4126
+ for v in json['experiments']:
4127
+ yield Experiment.from_dict(v)
4132
4128
  if 'next_page_token' not in json or not json['next_page_token']:
4133
4129
  return
4134
4130
  body['page_token'] = json['next_page_token']
@@ -4186,10 +4182,9 @@ class ExperimentsAPI:
4186
4182
 
4187
4183
  while True:
4188
4184
  json = self._api.do('POST', '/api/2.0/mlflow/runs/search', body=body, headers=headers)
4189
- if 'runs' not in json or not json['runs']:
4190
- return
4191
- for v in json['runs']:
4192
- yield Run.from_dict(v)
4185
+ if 'runs' in json:
4186
+ for v in json['runs']:
4187
+ yield Run.from_dict(v)
4193
4188
  if 'next_page_token' not in json or not json['next_page_token']:
4194
4189
  return
4195
4190
  body['page_token'] = json['next_page_token']
@@ -4903,10 +4898,9 @@ class ModelRegistryAPI:
4903
4898
 
4904
4899
  while True:
4905
4900
  json = self._api.do('GET', '/api/2.0/mlflow/registered-models/list', query=query, headers=headers)
4906
- if 'registered_models' not in json or not json['registered_models']:
4907
- return
4908
- for v in json['registered_models']:
4909
- yield Model.from_dict(v)
4901
+ if 'registered_models' in json:
4902
+ for v in json['registered_models']:
4903
+ yield Model.from_dict(v)
4910
4904
  if 'next_page_token' not in json or not json['next_page_token']:
4911
4905
  return
4912
4906
  query['page_token'] = json['next_page_token']
@@ -4963,10 +4957,9 @@ class ModelRegistryAPI:
4963
4957
 
4964
4958
  while True:
4965
4959
  json = self._api.do('GET', '/api/2.0/mlflow/registry-webhooks/list', query=query, headers=headers)
4966
- if 'webhooks' not in json or not json['webhooks']:
4967
- return
4968
- for v in json['webhooks']:
4969
- yield RegistryWebhook.from_dict(v)
4960
+ if 'webhooks' in json:
4961
+ for v in json['webhooks']:
4962
+ yield RegistryWebhook.from_dict(v)
4970
4963
  if 'next_page_token' not in json or not json['next_page_token']:
4971
4964
  return
4972
4965
  query['page_token'] = json['next_page_token']
@@ -5062,10 +5055,9 @@ class ModelRegistryAPI:
5062
5055
 
5063
5056
  while True:
5064
5057
  json = self._api.do('GET', '/api/2.0/mlflow/model-versions/search', query=query, headers=headers)
5065
- if 'model_versions' not in json or not json['model_versions']:
5066
- return
5067
- for v in json['model_versions']:
5068
- yield ModelVersion.from_dict(v)
5058
+ if 'model_versions' in json:
5059
+ for v in json['model_versions']:
5060
+ yield ModelVersion.from_dict(v)
5069
5061
  if 'next_page_token' not in json or not json['next_page_token']:
5070
5062
  return
5071
5063
  query['page_token'] = json['next_page_token']
@@ -5108,10 +5100,9 @@ class ModelRegistryAPI:
5108
5100
  '/api/2.0/mlflow/registered-models/search',
5109
5101
  query=query,
5110
5102
  headers=headers)
5111
- if 'registered_models' not in json or not json['registered_models']:
5112
- return
5113
- for v in json['registered_models']:
5114
- yield Model.from_dict(v)
5103
+ if 'registered_models' in json:
5104
+ for v in json['registered_models']:
5105
+ yield Model.from_dict(v)
5115
5106
  if 'next_page_token' not in json or not json['next_page_token']:
5116
5107
  return
5117
5108
  query['page_token'] = json['next_page_token']
@@ -629,10 +629,9 @@ class OAuthPublishedAppsAPI:
629
629
  f'/api/2.0/accounts/{self._api.account_id}/oauth2/published-apps/',
630
630
  query=query,
631
631
  headers=headers)
632
- if 'apps' not in json or not json['apps']:
633
- return
634
- for v in json['apps']:
635
- yield PublishedAppOutput.from_dict(v)
632
+ if 'apps' in json:
633
+ for v in json['apps']:
634
+ yield PublishedAppOutput.from_dict(v)
636
635
  if 'next_page_token' not in json or not json['next_page_token']:
637
636
  return
638
637
  query['page_token'] = json['next_page_token']
@@ -724,8 +724,7 @@ class PipelineAccessControlRequest:
724
724
  """Permission level"""
725
725
 
726
726
  service_principal_name: Optional[str] = None
727
- """Application ID of an active service principal. Setting this field requires the
728
- `servicePrincipal/user` role."""
727
+ """application ID of a service principal"""
729
728
 
730
729
  user_name: Optional[str] = None
731
730
  """name of the user"""
@@ -792,7 +791,7 @@ class PipelineCluster:
792
791
  apply_policy_default_values: Optional[bool] = None
793
792
  """Note: This field won't be persisted. Only API users will check this field."""
794
793
 
795
- autoscale: Optional[compute.AutoScale] = None
794
+ autoscale: Optional[PipelineClusterAutoscale] = None
796
795
  """Parameters needed in order to automatically scale clusters up and down based on load. Note:
797
796
  autoscaling works best with DB runtime versions 3.0 or later."""
798
797
 
@@ -915,7 +914,7 @@ class PipelineCluster:
915
914
  def from_dict(cls, d: Dict[str, any]) -> PipelineCluster:
916
915
  """Deserializes the PipelineCluster from a dictionary."""
917
916
  return cls(apply_policy_default_values=d.get('apply_policy_default_values', None),
918
- autoscale=_from_dict(d, 'autoscale', compute.AutoScale),
917
+ autoscale=_from_dict(d, 'autoscale', PipelineClusterAutoscale),
919
918
  aws_attributes=_from_dict(d, 'aws_attributes', compute.AwsAttributes),
920
919
  azure_attributes=_from_dict(d, 'azure_attributes', compute.AzureAttributes),
921
920
  cluster_log_conf=_from_dict(d, 'cluster_log_conf', compute.ClusterLogConf),
@@ -934,6 +933,48 @@ class PipelineCluster:
934
933
  ssh_public_keys=d.get('ssh_public_keys', None))
935
934
 
936
935
 
936
+ @dataclass
937
+ class PipelineClusterAutoscale:
938
+ min_workers: int
939
+ """The minimum number of workers the cluster can scale down to when underutilized. It is also the
940
+ initial number of workers the cluster will have after creation."""
941
+
942
+ max_workers: int
943
+ """The maximum number of workers to which the cluster can scale up when overloaded. `max_workers`
944
+ must be strictly greater than `min_workers`."""
945
+
946
+ mode: Optional[PipelineClusterAutoscaleMode] = None
947
+ """Databricks Enhanced Autoscaling optimizes cluster utilization by automatically allocating
948
+ cluster resources based on workload volume, with minimal impact to the data processing latency
949
+ of your pipelines. Enhanced Autoscaling is available for `updates` clusters only. The legacy
950
+ autoscaling feature is used for `maintenance` clusters."""
951
+
952
+ def as_dict(self) -> dict:
953
+ """Serializes the PipelineClusterAutoscale into a dictionary suitable for use as a JSON request body."""
954
+ body = {}
955
+ if self.max_workers is not None: body['max_workers'] = self.max_workers
956
+ if self.min_workers is not None: body['min_workers'] = self.min_workers
957
+ if self.mode is not None: body['mode'] = self.mode.value
958
+ return body
959
+
960
+ @classmethod
961
+ def from_dict(cls, d: Dict[str, any]) -> PipelineClusterAutoscale:
962
+ """Deserializes the PipelineClusterAutoscale from a dictionary."""
963
+ return cls(max_workers=d.get('max_workers', None),
964
+ min_workers=d.get('min_workers', None),
965
+ mode=_enum(d, 'mode', PipelineClusterAutoscaleMode))
966
+
967
+
968
+ class PipelineClusterAutoscaleMode(Enum):
969
+ """Databricks Enhanced Autoscaling optimizes cluster utilization by automatically allocating
970
+ cluster resources based on workload volume, with minimal impact to the data processing latency
971
+ of your pipelines. Enhanced Autoscaling is available for `updates` clusters only. The legacy
972
+ autoscaling feature is used for `maintenance` clusters."""
973
+
974
+ ENHANCED = 'ENHANCED'
975
+ LEGACY = 'LEGACY'
976
+
977
+
937
978
  @dataclass
938
979
  class PipelineEvent:
939
980
  error: Optional[ErrorDetail] = None
@@ -1892,10 +1933,9 @@ class PipelinesAPI:
1892
1933
  f'/api/2.0/pipelines/{pipeline_id}/events',
1893
1934
  query=query,
1894
1935
  headers=headers)
1895
- if 'events' not in json or not json['events']:
1896
- return
1897
- for v in json['events']:
1898
- yield PipelineEvent.from_dict(v)
1936
+ if 'events' in json:
1937
+ for v in json['events']:
1938
+ yield PipelineEvent.from_dict(v)
1899
1939
  if 'next_page_token' not in json or not json['next_page_token']:
1900
1940
  return
1901
1941
  query['page_token'] = json['next_page_token']
@@ -1941,10 +1981,9 @@ class PipelinesAPI:
1941
1981
 
1942
1982
  while True:
1943
1983
  json = self._api.do('GET', '/api/2.0/pipelines', query=query, headers=headers)
1944
- if 'statuses' not in json or not json['statuses']:
1945
- return
1946
- for v in json['statuses']:
1947
- yield PipelineStateInfo.from_dict(v)
1984
+ if 'statuses' in json:
1985
+ for v in json['statuses']:
1986
+ yield PipelineStateInfo.from_dict(v)
1948
1987
  if 'next_page_token' not in json or not json['next_page_token']:
1949
1988
  return
1950
1989
  query['page_token'] = json['next_page_token']
@@ -1979,25 +2018,6 @@ class PipelinesAPI:
1979
2018
  res = self._api.do('GET', f'/api/2.0/pipelines/{pipeline_id}/updates', query=query, headers=headers)
1980
2019
  return ListUpdatesResponse.from_dict(res)
1981
2020
 
1982
- def reset(self, pipeline_id: str) -> Wait[GetPipelineResponse]:
1983
- """Reset a pipeline.
1984
-
1985
- Resets a pipeline.
1986
-
1987
- :param pipeline_id: str
1988
-
1989
- :returns:
1990
- Long-running operation waiter for :class:`GetPipelineResponse`.
1991
- See :method:wait_get_pipeline_running for more details.
1992
- """
1993
-
1994
- headers = {'Accept': 'application/json', }
1995
- self._api.do('POST', f'/api/2.0/pipelines/{pipeline_id}/reset', headers=headers)
1996
- return Wait(self.wait_get_pipeline_running, pipeline_id=pipeline_id)
1997
-
1998
- def reset_and_wait(self, pipeline_id: str, timeout=timedelta(minutes=20)) -> GetPipelineResponse:
1999
- return self.reset(pipeline_id=pipeline_id).result(timeout=timeout)
2000
-
2001
2021
  def set_permissions(
2002
2022
  self,
2003
2023
  pipeline_id: str,
@@ -1939,8 +1939,7 @@ class ServingEndpointAccessControlRequest:
1939
1939
  """Permission level"""
1940
1940
 
1941
1941
  service_principal_name: Optional[str] = None
1942
- """Application ID of an active service principal. Setting this field requires the
1943
- `servicePrincipal/user` role."""
1942
+ """application ID of a service principal"""
1944
1943
 
1945
1944
  user_name: Optional[str] = None
1946
1945
  """name of the user"""