databricks-sdk 0.29.0__py3-none-any.whl → 0.30.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.

@@ -2418,6 +2418,13 @@ class FunctionParameterType(Enum):
2418
2418
  PARAM = 'PARAM'
2419
2419
 
2420
2420
 
2421
+ class GetBindingsSecurableType(Enum):
2422
+
2423
+ CATALOG = 'catalog'
2424
+ EXTERNAL_LOCATION = 'external_location'
2425
+ STORAGE_CREDENTIAL = 'storage_credential'
2426
+
2427
+
2421
2428
  @dataclass
2422
2429
  class GetMetastoreSummaryResponse:
2423
2430
  cloud: Optional[str] = None
@@ -2782,19 +2789,25 @@ class ListStorageCredentialsResponse:
2782
2789
 
2783
2790
  @dataclass
2784
2791
  class ListSystemSchemasResponse:
2792
+ next_page_token: Optional[str] = None
2793
+ """Opaque token to retrieve the next page of results. Absent if there are no more pages.
2794
+ __page_token__ should be set to this value for the next request (for the next page of results)."""
2795
+
2785
2796
  schemas: Optional[List[SystemSchemaInfo]] = None
2786
2797
  """An array of system schema information objects."""
2787
2798
 
2788
2799
  def as_dict(self) -> dict:
2789
2800
  """Serializes the ListSystemSchemasResponse into a dictionary suitable for use as a JSON request body."""
2790
2801
  body = {}
2802
+ if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
2791
2803
  if self.schemas: body['schemas'] = [v.as_dict() for v in self.schemas]
2792
2804
  return body
2793
2805
 
2794
2806
  @classmethod
2795
2807
  def from_dict(cls, d: Dict[str, any]) -> ListSystemSchemasResponse:
2796
2808
  """Deserializes the ListSystemSchemasResponse from a dictionary."""
2797
- return cls(schemas=_repeated_dict(d, 'schemas', SystemSchemaInfo))
2809
+ return cls(next_page_token=d.get('next_page_token', None),
2810
+ schemas=_repeated_dict(d, 'schemas', SystemSchemaInfo))
2798
2811
 
2799
2812
 
2800
2813
  @dataclass
@@ -3019,6 +3032,9 @@ class MetastoreInfoDeltaSharingScope(Enum):
3019
3032
 
3020
3033
  @dataclass
3021
3034
  class ModelVersionInfo:
3035
+ aliases: Optional[List[RegisteredModelAlias]] = None
3036
+ """List of aliases associated with the model version"""
3037
+
3022
3038
  browse_only: Optional[bool] = None
3023
3039
  """Indicates whether the principal is limited to retrieving metadata for the associated object
3024
3040
  through the BROWSE privilege when include_browse is enabled in the request."""
@@ -3079,6 +3095,7 @@ class ModelVersionInfo:
3079
3095
  def as_dict(self) -> dict:
3080
3096
  """Serializes the ModelVersionInfo into a dictionary suitable for use as a JSON request body."""
3081
3097
  body = {}
3098
+ if self.aliases: body['aliases'] = [v.as_dict() for v in self.aliases]
3082
3099
  if self.browse_only is not None: body['browse_only'] = self.browse_only
3083
3100
  if self.catalog_name is not None: body['catalog_name'] = self.catalog_name
3084
3101
  if self.comment is not None: body['comment'] = self.comment
@@ -3103,7 +3120,8 @@ class ModelVersionInfo:
3103
3120
  @classmethod
3104
3121
  def from_dict(cls, d: Dict[str, any]) -> ModelVersionInfo:
3105
3122
  """Deserializes the ModelVersionInfo from a dictionary."""
3106
- return cls(browse_only=d.get('browse_only', None),
3123
+ return cls(aliases=_repeated_dict(d, 'aliases', RegisteredModelAlias),
3124
+ browse_only=d.get('browse_only', None),
3107
3125
  catalog_name=d.get('catalog_name', None),
3108
3126
  comment=d.get('comment', None),
3109
3127
  created_at=d.get('created_at', None),
@@ -3742,7 +3760,6 @@ class OnlineTableState(Enum):
3742
3760
  ONLINE_CONTINUOUS_UPDATE = 'ONLINE_CONTINUOUS_UPDATE'
3743
3761
  ONLINE_NO_PENDING_UPDATE = 'ONLINE_NO_PENDING_UPDATE'
3744
3762
  ONLINE_PIPELINE_FAILED = 'ONLINE_PIPELINE_FAILED'
3745
- ONLINE_TABLE_STATE_UNSPECIFIED = 'ONLINE_TABLE_STATE_UNSPECIFIED'
3746
3763
  ONLINE_TRIGGERED_UPDATE = 'ONLINE_TRIGGERED_UPDATE'
3747
3764
  ONLINE_UPDATING_PIPELINE_RESOURCES = 'ONLINE_UPDATING_PIPELINE_RESOURCES'
3748
3765
  PROVISIONING = 'PROVISIONING'
@@ -3935,6 +3952,7 @@ class Privilege(Enum):
3935
3952
  CREATE_VIEW = 'CREATE_VIEW'
3936
3953
  CREATE_VOLUME = 'CREATE_VOLUME'
3937
3954
  EXECUTE = 'EXECUTE'
3955
+ MANAGE = 'MANAGE'
3938
3956
  MANAGE_ALLOWLIST = 'MANAGE_ALLOWLIST'
3939
3957
  MODIFY = 'MODIFY'
3940
3958
  READ_FILES = 'READ_FILES'
@@ -4849,6 +4867,13 @@ class UpdateAssignmentResponse:
4849
4867
  return cls()
4850
4868
 
4851
4869
 
4870
+ class UpdateBindingsSecurableType(Enum):
4871
+
4872
+ CATALOG = 'catalog'
4873
+ EXTERNAL_LOCATION = 'external_location'
4874
+ STORAGE_CREDENTIAL = 'storage_credential'
4875
+
4876
+
4852
4877
  @dataclass
4853
4878
  class UpdateCatalog:
4854
4879
  comment: Optional[str] = None
@@ -5492,8 +5517,8 @@ class UpdateWorkspaceBindingsParameters:
5492
5517
  securable_name: Optional[str] = None
5493
5518
  """The name of the securable."""
5494
5519
 
5495
- securable_type: Optional[str] = None
5496
- """The type of the securable."""
5520
+ securable_type: Optional[UpdateBindingsSecurableType] = None
5521
+ """The type of the securable to bind to a workspace."""
5497
5522
 
5498
5523
  def as_dict(self) -> dict:
5499
5524
  """Serializes the UpdateWorkspaceBindingsParameters into a dictionary suitable for use as a JSON request body."""
@@ -5501,7 +5526,7 @@ class UpdateWorkspaceBindingsParameters:
5501
5526
  if self.add: body['add'] = [v.as_dict() for v in self.add]
5502
5527
  if self.remove: body['remove'] = [v.as_dict() for v in self.remove]
5503
5528
  if self.securable_name is not None: body['securable_name'] = self.securable_name
5504
- if self.securable_type is not None: body['securable_type'] = self.securable_type
5529
+ if self.securable_type is not None: body['securable_type'] = self.securable_type.value
5505
5530
  return body
5506
5531
 
5507
5532
  @classmethod
@@ -5510,7 +5535,7 @@ class UpdateWorkspaceBindingsParameters:
5510
5535
  return cls(add=_repeated_dict(d, 'add', WorkspaceBinding),
5511
5536
  remove=_repeated_dict(d, 'remove', WorkspaceBinding),
5512
5537
  securable_name=d.get('securable_name', None),
5513
- securable_type=d.get('securable_type', None))
5538
+ securable_type=_enum(d, 'securable_type', UpdateBindingsSecurableType))
5514
5539
 
5515
5540
 
5516
5541
  @dataclass
@@ -5776,16 +5801,22 @@ class WorkspaceBindingsResponse:
5776
5801
  bindings: Optional[List[WorkspaceBinding]] = None
5777
5802
  """List of workspace bindings"""
5778
5803
 
5804
+ next_page_token: Optional[str] = None
5805
+ """Opaque token to retrieve the next page of results. Absent if there are no more pages.
5806
+ __page_token__ should be set to this value for the next request (for the next page of results)."""
5807
+
5779
5808
  def as_dict(self) -> dict:
5780
5809
  """Serializes the WorkspaceBindingsResponse into a dictionary suitable for use as a JSON request body."""
5781
5810
  body = {}
5782
5811
  if self.bindings: body['bindings'] = [v.as_dict() for v in self.bindings]
5812
+ if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
5783
5813
  return body
5784
5814
 
5785
5815
  @classmethod
5786
5816
  def from_dict(cls, d: Dict[str, any]) -> WorkspaceBindingsResponse:
5787
5817
  """Deserializes the WorkspaceBindingsResponse from a dictionary."""
5788
- return cls(bindings=_repeated_dict(d, 'bindings', WorkspaceBinding))
5818
+ return cls(bindings=_repeated_dict(d, 'bindings', WorkspaceBinding),
5819
+ next_page_token=d.get('next_page_token', None))
5789
5820
 
5790
5821
 
5791
5822
  class AccountMetastoreAssignmentsAPI:
@@ -7325,7 +7356,8 @@ class ModelVersionsAPI:
7325
7356
  full_name: str,
7326
7357
  version: int,
7327
7358
  *,
7328
- include_browse: Optional[bool] = None) -> RegisteredModelInfo:
7359
+ include_aliases: Optional[bool] = None,
7360
+ include_browse: Optional[bool] = None) -> ModelVersionInfo:
7329
7361
  """Get a Model Version.
7330
7362
 
7331
7363
  Get a model version.
@@ -7338,14 +7370,17 @@ class ModelVersionsAPI:
7338
7370
  The three-level (fully qualified) name of the model version
7339
7371
  :param version: int
7340
7372
  The integer version number of the model version
7373
+ :param include_aliases: bool (optional)
7374
+ Whether to include aliases associated with the model version in the response
7341
7375
  :param include_browse: bool (optional)
7342
7376
  Whether to include model versions in the response for which the principal can only access selective
7343
7377
  metadata for
7344
7378
 
7345
- :returns: :class:`RegisteredModelInfo`
7379
+ :returns: :class:`ModelVersionInfo`
7346
7380
  """
7347
7381
 
7348
7382
  query = {}
7383
+ if include_aliases is not None: query['include_aliases'] = include_aliases
7349
7384
  if include_browse is not None: query['include_browse'] = include_browse
7350
7385
  headers = {'Accept': 'application/json', }
7351
7386
 
@@ -7353,9 +7388,13 @@ class ModelVersionsAPI:
7353
7388
  f'/api/2.1/unity-catalog/models/{full_name}/versions/{version}',
7354
7389
  query=query,
7355
7390
  headers=headers)
7356
- return RegisteredModelInfo.from_dict(res)
7391
+ return ModelVersionInfo.from_dict(res)
7357
7392
 
7358
- def get_by_alias(self, full_name: str, alias: str) -> ModelVersionInfo:
7393
+ def get_by_alias(self,
7394
+ full_name: str,
7395
+ alias: str,
7396
+ *,
7397
+ include_aliases: Optional[bool] = None) -> ModelVersionInfo:
7359
7398
  """Get Model Version By Alias.
7360
7399
 
7361
7400
  Get a model version by alias.
@@ -7368,14 +7407,19 @@ class ModelVersionsAPI:
7368
7407
  The three-level (fully qualified) name of the registered model
7369
7408
  :param alias: str
7370
7409
  The name of the alias
7410
+ :param include_aliases: bool (optional)
7411
+ Whether to include aliases associated with the model version in the response
7371
7412
 
7372
7413
  :returns: :class:`ModelVersionInfo`
7373
7414
  """
7374
7415
 
7416
+ query = {}
7417
+ if include_aliases is not None: query['include_aliases'] = include_aliases
7375
7418
  headers = {'Accept': 'application/json', }
7376
7419
 
7377
7420
  res = self._api.do('GET',
7378
7421
  f'/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}',
7422
+ query=query,
7379
7423
  headers=headers)
7380
7424
  return ModelVersionInfo.from_dict(res)
7381
7425
 
@@ -7971,7 +8015,11 @@ class RegisteredModelsAPI:
7971
8015
 
7972
8016
  self._api.do('DELETE', f'/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}', headers=headers)
7973
8017
 
7974
- def get(self, full_name: str, *, include_browse: Optional[bool] = None) -> RegisteredModelInfo:
8018
+ def get(self,
8019
+ full_name: str,
8020
+ *,
8021
+ include_aliases: Optional[bool] = None,
8022
+ include_browse: Optional[bool] = None) -> RegisteredModelInfo:
7975
8023
  """Get a Registered Model.
7976
8024
 
7977
8025
  Get a registered model.
@@ -7982,6 +8030,8 @@ class RegisteredModelsAPI:
7982
8030
 
7983
8031
  :param full_name: str
7984
8032
  The three-level (fully qualified) name of the registered model
8033
+ :param include_aliases: bool (optional)
8034
+ Whether to include registered model aliases in the response
7985
8035
  :param include_browse: bool (optional)
7986
8036
  Whether to include registered models in the response for which the principal can only access
7987
8037
  selective metadata for
@@ -7990,6 +8040,7 @@ class RegisteredModelsAPI:
7990
8040
  """
7991
8041
 
7992
8042
  query = {}
8043
+ if include_aliases is not None: query['include_aliases'] = include_aliases
7993
8044
  if include_browse is not None: query['include_browse'] = include_browse
7994
8045
  headers = {'Accept': 'application/json', }
7995
8046
 
@@ -8172,7 +8223,7 @@ class SchemasAPI:
8172
8223
  res = self._api.do('POST', '/api/2.1/unity-catalog/schemas', body=body, headers=headers)
8173
8224
  return SchemaInfo.from_dict(res)
8174
8225
 
8175
- def delete(self, full_name: str):
8226
+ def delete(self, full_name: str, *, force: Optional[bool] = None):
8176
8227
  """Delete a schema.
8177
8228
 
8178
8229
  Deletes the specified schema from the parent catalog. The caller must be the owner of the schema or an
@@ -8180,13 +8231,17 @@ class SchemasAPI:
8180
8231
 
8181
8232
  :param full_name: str
8182
8233
  Full name of the schema.
8234
+ :param force: bool (optional)
8235
+ Force deletion even if the schema is not empty.
8183
8236
 
8184
8237
 
8185
8238
  """
8186
8239
 
8240
+ query = {}
8241
+ if force is not None: query['force'] = force
8187
8242
  headers = {'Accept': 'application/json', }
8188
8243
 
8189
- self._api.do('DELETE', f'/api/2.1/unity-catalog/schemas/{full_name}', headers=headers)
8244
+ self._api.do('DELETE', f'/api/2.1/unity-catalog/schemas/{full_name}', query=query, headers=headers)
8190
8245
 
8191
8246
  def get(self, full_name: str, *, include_browse: Optional[bool] = None) -> SchemaInfo:
8192
8247
  """Get a schema.
@@ -8632,7 +8687,11 @@ class SystemSchemasAPI:
8632
8687
  f'/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas/{schema_name}',
8633
8688
  headers=headers)
8634
8689
 
8635
- def list(self, metastore_id: str) -> Iterator[SystemSchemaInfo]:
8690
+ def list(self,
8691
+ metastore_id: str,
8692
+ *,
8693
+ max_results: Optional[int] = None,
8694
+ page_token: Optional[str] = None) -> Iterator[SystemSchemaInfo]:
8636
8695
  """List system schemas.
8637
8696
 
8638
8697
  Gets an array of system schemas for a metastore. The caller must be an account admin or a metastore
@@ -8640,17 +8699,33 @@ class SystemSchemasAPI:
8640
8699
 
8641
8700
  :param metastore_id: str
8642
8701
  The ID for the metastore in which the system schema resides.
8702
+ :param max_results: int (optional)
8703
+ Maximum number of schemas to return. - When set to 0, the page length is set to a server configured
8704
+ value (recommended); - When set to a value greater than 0, the page length is the minimum of this
8705
+ value and a server configured value; - When set to a value less than 0, an invalid parameter error
8706
+ is returned; - If not set, all the schemas are returned (not recommended).
8707
+ :param page_token: str (optional)
8708
+ Opaque pagination token to go to next page based on previous query.
8643
8709
 
8644
8710
  :returns: Iterator over :class:`SystemSchemaInfo`
8645
8711
  """
8646
8712
 
8713
+ query = {}
8714
+ if max_results is not None: query['max_results'] = max_results
8715
+ if page_token is not None: query['page_token'] = page_token
8647
8716
  headers = {'Accept': 'application/json', }
8648
8717
 
8649
- json = self._api.do('GET',
8650
- f'/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas',
8651
- headers=headers)
8652
- parsed = ListSystemSchemasResponse.from_dict(json).schemas
8653
- return parsed if parsed is not None else []
8718
+ while True:
8719
+ json = self._api.do('GET',
8720
+ f'/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas',
8721
+ query=query,
8722
+ headers=headers)
8723
+ if 'schemas' in json:
8724
+ for v in json['schemas']:
8725
+ yield SystemSchemaInfo.from_dict(v)
8726
+ if 'next_page_token' not in json or not json['next_page_token']:
8727
+ return
8728
+ query['page_token'] = json['next_page_token']
8654
8729
 
8655
8730
 
8656
8731
  class TableConstraintsAPI:
@@ -9172,7 +9247,7 @@ class WorkspaceBindingsAPI:
9172
9247
  the new path (/api/2.1/unity-catalog/bindings/{securable_type}/{securable_name}) which introduces the
9173
9248
  ability to bind a securable in READ_ONLY mode (catalogs only).
9174
9249
 
9175
- Securables that support binding: - catalog"""
9250
+ Securable types that support binding: - catalog - storage_credential - external_location"""
9176
9251
 
9177
9252
  def __init__(self, api_client):
9178
9253
  self._api = api_client
@@ -9196,26 +9271,48 @@ class WorkspaceBindingsAPI:
9196
9271
  headers=headers)
9197
9272
  return CurrentWorkspaceBindings.from_dict(res)
9198
9273
 
9199
- def get_bindings(self, securable_type: str, securable_name: str) -> WorkspaceBindingsResponse:
9274
+ def get_bindings(self,
9275
+ securable_type: GetBindingsSecurableType,
9276
+ securable_name: str,
9277
+ *,
9278
+ max_results: Optional[int] = None,
9279
+ page_token: Optional[str] = None) -> Iterator[WorkspaceBinding]:
9200
9280
  """Get securable workspace bindings.
9201
9281
 
9202
9282
  Gets workspace bindings of the securable. The caller must be a metastore admin or an owner of the
9203
9283
  securable.
9204
9284
 
9205
- :param securable_type: str
9206
- The type of the securable.
9285
+ :param securable_type: :class:`GetBindingsSecurableType`
9286
+ The type of the securable to bind to a workspace.
9207
9287
  :param securable_name: str
9208
9288
  The name of the securable.
9289
+ :param max_results: int (optional)
9290
+ Maximum number of workspace bindings to return. - When set to 0, the page length is set to a server
9291
+ configured value (recommended); - When set to a value greater than 0, the page length is the minimum
9292
+ of this value and a server configured value; - When set to a value less than 0, an invalid parameter
9293
+ error is returned; - If not set, all the workspace bindings are returned (not recommended).
9294
+ :param page_token: str (optional)
9295
+ Opaque pagination token to go to next page based on previous query.
9209
9296
 
9210
- :returns: :class:`WorkspaceBindingsResponse`
9297
+ :returns: Iterator over :class:`WorkspaceBinding`
9211
9298
  """
9212
9299
 
9300
+ query = {}
9301
+ if max_results is not None: query['max_results'] = max_results
9302
+ if page_token is not None: query['page_token'] = page_token
9213
9303
  headers = {'Accept': 'application/json', }
9214
9304
 
9215
- res = self._api.do('GET',
9216
- f'/api/2.1/unity-catalog/bindings/{securable_type}/{securable_name}',
9217
- headers=headers)
9218
- return WorkspaceBindingsResponse.from_dict(res)
9305
+ while True:
9306
+ json = self._api.do('GET',
9307
+ f'/api/2.1/unity-catalog/bindings/{securable_type.value}/{securable_name}',
9308
+ query=query,
9309
+ headers=headers)
9310
+ if 'bindings' in json:
9311
+ for v in json['bindings']:
9312
+ yield WorkspaceBinding.from_dict(v)
9313
+ if 'next_page_token' not in json or not json['next_page_token']:
9314
+ return
9315
+ query['page_token'] = json['next_page_token']
9219
9316
 
9220
9317
  def update(self,
9221
9318
  name: str,
@@ -9248,7 +9345,7 @@ class WorkspaceBindingsAPI:
9248
9345
  return CurrentWorkspaceBindings.from_dict(res)
9249
9346
 
9250
9347
  def update_bindings(self,
9251
- securable_type: str,
9348
+ securable_type: UpdateBindingsSecurableType,
9252
9349
  securable_name: str,
9253
9350
  *,
9254
9351
  add: Optional[List[WorkspaceBinding]] = None,
@@ -9258,8 +9355,8 @@ class WorkspaceBindingsAPI:
9258
9355
  Updates workspace bindings of the securable. The caller must be a metastore admin or an owner of the
9259
9356
  securable.
9260
9357
 
9261
- :param securable_type: str
9262
- The type of the securable.
9358
+ :param securable_type: :class:`UpdateBindingsSecurableType`
9359
+ The type of the securable to bind to a workspace.
9263
9360
  :param securable_name: str
9264
9361
  The name of the securable.
9265
9362
  :param add: List[:class:`WorkspaceBinding`] (optional)
@@ -9275,7 +9372,7 @@ class WorkspaceBindingsAPI:
9275
9372
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
9276
9373
 
9277
9374
  res = self._api.do('PATCH',
9278
- f'/api/2.1/unity-catalog/bindings/{securable_type}/{securable_name}',
9375
+ f'/api/2.1/unity-catalog/bindings/{securable_type.value}/{securable_name}',
9279
9376
  body=body,
9280
9377
  headers=headers)
9281
9378
  return WorkspaceBindingsResponse.from_dict(res)