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

@@ -38,6 +38,12 @@ from databricks.sdk.service.iam import (AccountAccessControlAPI,
38
38
  PermissionsAPI, ServicePrincipalsAPI,
39
39
  UsersAPI, WorkspaceAssignmentAPI)
40
40
  from databricks.sdk.service.jobs import JobsAPI
41
+ from databricks.sdk.service.marketplace import (
42
+ ConsumerFulfillmentsAPI, ConsumerInstallationsAPI, ConsumerListingsAPI,
43
+ ConsumerPersonalizationRequestsAPI, ConsumerProvidersAPI,
44
+ ProviderExchangeFiltersAPI, ProviderExchangesAPI, ProviderFilesAPI,
45
+ ProviderListingsAPI, ProviderPersonalizationRequestsAPI,
46
+ ProviderProviderAnalyticsDashboardsAPI, ProviderProvidersAPI)
41
47
  from databricks.sdk.service.ml import ExperimentsAPI, ModelRegistryAPI
42
48
  from databricks.sdk.service.oauth2 import (CustomAppIntegrationAPI,
43
49
  OAuthPublishedAppsAPI,
@@ -164,6 +170,11 @@ class WorkspaceClient:
164
170
  self._clusters = ClustersExt(self._api_client)
165
171
  self._command_execution = CommandExecutionAPI(self._api_client)
166
172
  self._connections = ConnectionsAPI(self._api_client)
173
+ self._consumer_fulfillments = ConsumerFulfillmentsAPI(self._api_client)
174
+ self._consumer_installations = ConsumerInstallationsAPI(self._api_client)
175
+ self._consumer_listings = ConsumerListingsAPI(self._api_client)
176
+ self._consumer_personalization_requests = ConsumerPersonalizationRequestsAPI(self._api_client)
177
+ self._consumer_providers = ConsumerProvidersAPI(self._api_client)
167
178
  self._credentials_manager = CredentialsManagerAPI(self._api_client)
168
179
  self._current_user = CurrentUserAPI(self._api_client)
169
180
  self._dashboard_widgets = DashboardWidgetsAPI(self._api_client)
@@ -194,6 +205,14 @@ class WorkspaceClient:
194
205
  self._permissions = PermissionsAPI(self._api_client)
195
206
  self._pipelines = PipelinesAPI(self._api_client)
196
207
  self._policy_families = PolicyFamiliesAPI(self._api_client)
208
+ self._provider_exchange_filters = ProviderExchangeFiltersAPI(self._api_client)
209
+ self._provider_exchanges = ProviderExchangesAPI(self._api_client)
210
+ self._provider_files = ProviderFilesAPI(self._api_client)
211
+ self._provider_listings = ProviderListingsAPI(self._api_client)
212
+ self._provider_personalization_requests = ProviderPersonalizationRequestsAPI(self._api_client)
213
+ self._provider_provider_analytics_dashboards = ProviderProviderAnalyticsDashboardsAPI(
214
+ self._api_client)
215
+ self._provider_providers = ProviderProvidersAPI(self._api_client)
197
216
  self._providers = ProvidersAPI(self._api_client)
198
217
  self._queries = QueriesAPI(self._api_client)
199
218
  self._query_history = QueryHistoryAPI(self._api_client)
@@ -286,6 +305,31 @@ class WorkspaceClient:
286
305
  """Connections allow for creating a connection to an external data source."""
287
306
  return self._connections
288
307
 
308
+ @property
309
+ def consumer_fulfillments(self) -> ConsumerFulfillmentsAPI:
310
+ """Fulfillments are entities that allow consumers to preview installations."""
311
+ return self._consumer_fulfillments
312
+
313
+ @property
314
+ def consumer_installations(self) -> ConsumerInstallationsAPI:
315
+ """Installations are entities that allow consumers to interact with Databricks Marketplace listings."""
316
+ return self._consumer_installations
317
+
318
+ @property
319
+ def consumer_listings(self) -> ConsumerListingsAPI:
320
+ """Listings are the core entities in the Marketplace."""
321
+ return self._consumer_listings
322
+
323
+ @property
324
+ def consumer_personalization_requests(self) -> ConsumerPersonalizationRequestsAPI:
325
+ """Personalization Requests allow customers to interact with the individualized Marketplace listing flow."""
326
+ return self._consumer_personalization_requests
327
+
328
+ @property
329
+ def consumer_providers(self) -> ConsumerProvidersAPI:
330
+ """Providers are the entities that publish listings to the Marketplace."""
331
+ return self._consumer_providers
332
+
289
333
  @property
290
334
  def credentials_manager(self) -> CredentialsManagerAPI:
291
335
  """Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens."""
@@ -436,6 +480,41 @@ class WorkspaceClient:
436
480
  """View available policy families."""
437
481
  return self._policy_families
438
482
 
483
+ @property
484
+ def provider_exchange_filters(self) -> ProviderExchangeFiltersAPI:
485
+ """Marketplace exchanges filters curate which groups can access an exchange."""
486
+ return self._provider_exchange_filters
487
+
488
+ @property
489
+ def provider_exchanges(self) -> ProviderExchangesAPI:
490
+ """Marketplace exchanges allow providers to share their listings with a curated set of customers."""
491
+ return self._provider_exchanges
492
+
493
+ @property
494
+ def provider_files(self) -> ProviderFilesAPI:
495
+ """Marketplace offers a set of file APIs for various purposes such as preview notebooks and provider icons."""
496
+ return self._provider_files
497
+
498
+ @property
499
+ def provider_listings(self) -> ProviderListingsAPI:
500
+ """Listings are the core entities in the Marketplace."""
501
+ return self._provider_listings
502
+
503
+ @property
504
+ def provider_personalization_requests(self) -> ProviderPersonalizationRequestsAPI:
505
+ """Personalization requests are an alternate to instantly available listings."""
506
+ return self._provider_personalization_requests
507
+
508
+ @property
509
+ def provider_provider_analytics_dashboards(self) -> ProviderProviderAnalyticsDashboardsAPI:
510
+ """Manage templated analytics solution for providers."""
511
+ return self._provider_provider_analytics_dashboards
512
+
513
+ @property
514
+ def provider_providers(self) -> ProviderProvidersAPI:
515
+ """Providers are entities that manage assets in Marketplace."""
516
+ return self._provider_providers
517
+
439
518
  @property
440
519
  def providers(self) -> ProvidersAPI:
441
520
  """A data provider is an object representing the organization in the real world who shares the data."""
databricks/sdk/core.py CHANGED
@@ -264,7 +264,7 @@ class ApiClient:
264
264
  if is_too_many_requests_or_unavailable:
265
265
  kwargs['retry_after_secs'] = self._parse_retry_after(response)
266
266
  kwargs['message'] = message
267
- return error_mapper(status_code, kwargs)
267
+ return error_mapper(response, kwargs)
268
268
 
269
269
  def _record_request_log(self, response: requests.Response, raw=False):
270
270
  if not logger.isEnabledFor(logging.DEBUG):
@@ -1,4 +1,8 @@
1
- from typing import Dict, List
1
+ import re
2
+ from dataclasses import dataclass
3
+ from typing import Dict, List, Optional
4
+
5
+ import requests
2
6
 
3
7
 
4
8
  class ErrorDetail:
@@ -63,3 +67,43 @@ class DatabricksError(IOError):
63
67
  if self.details == None:
64
68
  return []
65
69
  return [detail for detail in self.details if detail.type == error_type]
70
+
71
+
72
+ @dataclass
73
+ class _ErrorOverride:
74
+ # The name of the override. Used for logging purposes.
75
+ debug_name: str
76
+
77
+ # A regex that must match the path of the request for this override to be applied.
78
+ path_regex: re.Pattern
79
+
80
+ # The HTTP method of the request for the override to apply
81
+ verb: str
82
+
83
+ # The custom error class to use for this override.
84
+ custom_error: type
85
+
86
+ # A regular expression that must match the error code for this override to be applied. If None,
87
+ # this field is ignored.
88
+ status_code_matcher: Optional[re.Pattern] = None
89
+
90
+ # A regular expression that must match the error code for this override to be applied. If None,
91
+ # this field is ignored.
92
+ error_code_matcher: Optional[re.Pattern] = None
93
+
94
+ # A regular expression that must match the message for this override to be applied. If None,
95
+ # this field is ignored.
96
+ message_matcher: Optional[re.Pattern] = None
97
+
98
+ def matches(self, response: requests.Response, raw_error: dict):
99
+ if response.request.method != self.verb:
100
+ return False
101
+ if not self.path_regex.match(response.request.path_url):
102
+ return False
103
+ if self.status_code_matcher and not self.status_code_matcher.match(str(response.status_code)):
104
+ return False
105
+ if self.error_code_matcher and not self.error_code_matcher.match(raw_error.get('error_code', '')):
106
+ return False
107
+ if self.message_matcher and not self.message_matcher.match(raw_error.get('message', '')):
108
+ return False
109
+ return True
@@ -1,8 +1,16 @@
1
+ import requests
2
+
1
3
  from databricks.sdk.errors import platform
2
4
  from databricks.sdk.errors.base import DatabricksError
3
5
 
6
+ from .overrides import _ALL_OVERRIDES
7
+
4
8
 
5
- def error_mapper(status_code: int, raw: dict) -> DatabricksError:
9
+ def error_mapper(response: requests.Response, raw: dict) -> DatabricksError:
10
+ for override in _ALL_OVERRIDES:
11
+ if override.matches(response, raw):
12
+ return override.custom_error(**raw)
13
+ status_code = response.status_code
6
14
  error_code = raw.get('error_code', None)
7
15
  if error_code in platform.ERROR_CODE_MAPPING:
8
16
  # more specific error codes override more generic HTTP status codes
@@ -0,0 +1,25 @@
1
+ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
2
+
3
+ import re
4
+
5
+ from .base import _ErrorOverride
6
+ from .platform import ResourceDoesNotExist
7
+
8
+ _ALL_OVERRIDES = [
9
+ _ErrorOverride(debug_name="Clusters InvalidParameterValue=>ResourceDoesNotExist",
10
+ path_regex=re.compile(r'^/api/2\.\d/clusters/get'),
11
+ verb="GET",
12
+ status_code_matcher=re.compile(r'^400$'),
13
+ error_code_matcher=re.compile(r'INVALID_PARAMETER_VALUE'),
14
+ message_matcher=re.compile(r'Cluster .* does not exist'),
15
+ custom_error=ResourceDoesNotExist,
16
+ ),
17
+ _ErrorOverride(debug_name="Jobs InvalidParameterValue=>ResourceDoesNotExist",
18
+ path_regex=re.compile(r'^/api/2\.\d/jobs/get'),
19
+ verb="GET",
20
+ status_code_matcher=re.compile(r'^400$'),
21
+ error_code_matcher=re.compile(r'INVALID_PARAMETER_VALUE'),
22
+ message_matcher=re.compile(r'Job .* does not exist'),
23
+ custom_error=ResourceDoesNotExist,
24
+ ),
25
+ ]
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ import urllib.parse
2
3
  from typing import Callable, Dict, Generic, Optional, Type, TypeVar
3
4
 
4
5
 
@@ -38,6 +39,10 @@ def _repeated_enum(d: Dict[str, any], field: str, cls: Type) -> any:
38
39
  return res
39
40
 
40
41
 
42
+ def _escape_multi_segment_path_parameter(param: str) -> str:
43
+ return urllib.parse.quote(param)
44
+
45
+
41
46
  ReturnType = TypeVar('ReturnType')
42
47
 
43
48