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

@@ -11,7 +11,7 @@ from enum import Enum
11
11
  from typing import Callable, Dict, Iterator, List, Optional
12
12
 
13
13
  from ..errors import OperationFailed
14
- from ._internal import Wait, _enum, _from_dict, _repeated_dict
14
+ from ._internal import Wait, _enum, _from_dict, _repeated_dict, _repeated_enum
15
15
 
16
16
  _LOG = logging.getLogger('databricks.sdk')
17
17
 
@@ -85,6 +85,14 @@ class CreatePipeline:
85
85
  restart_window: Optional[RestartWindow] = None
86
86
  """Restart window of this pipeline."""
87
87
 
88
+ run_as: Optional[RunAs] = None
89
+ """Write-only setting, available only in Create/Update calls. Specifies the user or service
90
+ principal that the pipeline runs as. If not specified, the pipeline runs as the user who created
91
+ the pipeline.
92
+
93
+ Only `user_name` or `service_principal_name` can be specified. If both are specified, an error
94
+ is thrown."""
95
+
88
96
  schema: Optional[str] = None
89
97
  """The default schema (database) where tables are read from or published to. The presence of this
90
98
  field implies that the pipeline is in direct publishing mode."""
@@ -126,6 +134,7 @@ class CreatePipeline:
126
134
  if self.notifications: body['notifications'] = [v.as_dict() for v in self.notifications]
127
135
  if self.photon is not None: body['photon'] = self.photon
128
136
  if self.restart_window: body['restart_window'] = self.restart_window.as_dict()
137
+ if self.run_as: body['run_as'] = self.run_as.as_dict()
129
138
  if self.schema is not None: body['schema'] = self.schema
130
139
  if self.serverless is not None: body['serverless'] = self.serverless
131
140
  if self.storage is not None: body['storage'] = self.storage
@@ -156,6 +165,7 @@ class CreatePipeline:
156
165
  if self.notifications: body['notifications'] = self.notifications
157
166
  if self.photon is not None: body['photon'] = self.photon
158
167
  if self.restart_window: body['restart_window'] = self.restart_window
168
+ if self.run_as: body['run_as'] = self.run_as
159
169
  if self.schema is not None: body['schema'] = self.schema
160
170
  if self.serverless is not None: body['serverless'] = self.serverless
161
171
  if self.storage is not None: body['storage'] = self.storage
@@ -186,6 +196,7 @@ class CreatePipeline:
186
196
  notifications=_repeated_dict(d, 'notifications', Notifications),
187
197
  photon=d.get('photon', None),
188
198
  restart_window=_from_dict(d, 'restart_window', RestartWindow),
199
+ run_as=_from_dict(d, 'run_as', RunAs),
189
200
  schema=d.get('schema', None),
190
201
  serverless=d.get('serverless', None),
191
202
  storage=d.get('storage', None),
@@ -277,6 +288,19 @@ class DataPlaneId:
277
288
  return cls(instance=d.get('instance', None), seq_no=d.get('seq_no', None))
278
289
 
279
290
 
291
+ class DayOfWeek(Enum):
292
+ """Days of week in which the restart is allowed to happen (within a five-hour window starting at
293
+ start_hour). If not specified all days of the week will be used."""
294
+
295
+ FRIDAY = 'FRIDAY'
296
+ MONDAY = 'MONDAY'
297
+ SATURDAY = 'SATURDAY'
298
+ SUNDAY = 'SUNDAY'
299
+ THURSDAY = 'THURSDAY'
300
+ TUESDAY = 'TUESDAY'
301
+ WEDNESDAY = 'WEDNESDAY'
302
+
303
+
280
304
  @dataclass
281
305
  class DeletePipelineResponse:
282
306
 
@@ -373,6 +397,14 @@ class EditPipeline:
373
397
  restart_window: Optional[RestartWindow] = None
374
398
  """Restart window of this pipeline."""
375
399
 
400
+ run_as: Optional[RunAs] = None
401
+ """Write-only setting, available only in Create/Update calls. Specifies the user or service
402
+ principal that the pipeline runs as. If not specified, the pipeline runs as the user who created
403
+ the pipeline.
404
+
405
+ Only `user_name` or `service_principal_name` can be specified. If both are specified, an error
406
+ is thrown."""
407
+
376
408
  schema: Optional[str] = None
377
409
  """The default schema (database) where tables are read from or published to. The presence of this
378
410
  field implies that the pipeline is in direct publishing mode."""
@@ -416,6 +448,7 @@ class EditPipeline:
416
448
  if self.photon is not None: body['photon'] = self.photon
417
449
  if self.pipeline_id is not None: body['pipeline_id'] = self.pipeline_id
418
450
  if self.restart_window: body['restart_window'] = self.restart_window.as_dict()
451
+ if self.run_as: body['run_as'] = self.run_as.as_dict()
419
452
  if self.schema is not None: body['schema'] = self.schema
420
453
  if self.serverless is not None: body['serverless'] = self.serverless
421
454
  if self.storage is not None: body['storage'] = self.storage
@@ -448,6 +481,7 @@ class EditPipeline:
448
481
  if self.photon is not None: body['photon'] = self.photon
449
482
  if self.pipeline_id is not None: body['pipeline_id'] = self.pipeline_id
450
483
  if self.restart_window: body['restart_window'] = self.restart_window
484
+ if self.run_as: body['run_as'] = self.run_as
451
485
  if self.schema is not None: body['schema'] = self.schema
452
486
  if self.serverless is not None: body['serverless'] = self.serverless
453
487
  if self.storage is not None: body['storage'] = self.storage
@@ -479,6 +513,7 @@ class EditPipeline:
479
513
  photon=d.get('photon', None),
480
514
  pipeline_id=d.get('pipeline_id', None),
481
515
  restart_window=_from_dict(d, 'restart_window', RestartWindow),
516
+ run_as=_from_dict(d, 'run_as', RunAs),
482
517
  schema=d.get('schema', None),
483
518
  serverless=d.get('serverless', None),
484
519
  storage=d.get('storage', None),
@@ -2105,7 +2140,7 @@ class RestartWindow:
2105
2140
  """An integer between 0 and 23 denoting the start hour for the restart window in the 24-hour day.
2106
2141
  Continuous pipeline restart is triggered only within a five-hour window starting at this hour."""
2107
2142
 
2108
- days_of_week: Optional[RestartWindowDaysOfWeek] = None
2143
+ days_of_week: Optional[List[DayOfWeek]] = None
2109
2144
  """Days of week in which the restart is allowed to happen (within a five-hour window starting at
2110
2145
  start_hour). If not specified all days of the week will be used."""
2111
2146
 
@@ -2117,7 +2152,7 @@ class RestartWindow:
2117
2152
  def as_dict(self) -> dict:
2118
2153
  """Serializes the RestartWindow into a dictionary suitable for use as a JSON request body."""
2119
2154
  body = {}
2120
- if self.days_of_week is not None: body['days_of_week'] = self.days_of_week.value
2155
+ if self.days_of_week: body['days_of_week'] = [v.value for v in self.days_of_week]
2121
2156
  if self.start_hour is not None: body['start_hour'] = self.start_hour
2122
2157
  if self.time_zone_id is not None: body['time_zone_id'] = self.time_zone_id
2123
2158
  return body
@@ -2125,7 +2160,7 @@ class RestartWindow:
2125
2160
  def as_shallow_dict(self) -> dict:
2126
2161
  """Serializes the RestartWindow into a shallow dictionary of its immediate attributes."""
2127
2162
  body = {}
2128
- if self.days_of_week is not None: body['days_of_week'] = self.days_of_week
2163
+ if self.days_of_week: body['days_of_week'] = self.days_of_week
2129
2164
  if self.start_hour is not None: body['start_hour'] = self.start_hour
2130
2165
  if self.time_zone_id is not None: body['time_zone_id'] = self.time_zone_id
2131
2166
  return body
@@ -2133,22 +2168,48 @@ class RestartWindow:
2133
2168
  @classmethod
2134
2169
  def from_dict(cls, d: Dict[str, any]) -> RestartWindow:
2135
2170
  """Deserializes the RestartWindow from a dictionary."""
2136
- return cls(days_of_week=_enum(d, 'days_of_week', RestartWindowDaysOfWeek),
2171
+ return cls(days_of_week=_repeated_enum(d, 'days_of_week', DayOfWeek),
2137
2172
  start_hour=d.get('start_hour', None),
2138
2173
  time_zone_id=d.get('time_zone_id', None))
2139
2174
 
2140
2175
 
2141
- class RestartWindowDaysOfWeek(Enum):
2142
- """Days of week in which the restart is allowed to happen (within a five-hour window starting at
2143
- start_hour). If not specified all days of the week will be used."""
2176
+ @dataclass
2177
+ class RunAs:
2178
+ """Write-only setting, available only in Create/Update calls. Specifies the user or service
2179
+ principal that the pipeline runs as. If not specified, the pipeline runs as the user who created
2180
+ the pipeline.
2181
+
2182
+ Only `user_name` or `service_principal_name` can be specified. If both are specified, an error
2183
+ is thrown."""
2144
2184
 
2145
- FRIDAY = 'FRIDAY'
2146
- MONDAY = 'MONDAY'
2147
- SATURDAY = 'SATURDAY'
2148
- SUNDAY = 'SUNDAY'
2149
- THURSDAY = 'THURSDAY'
2150
- TUESDAY = 'TUESDAY'
2151
- WEDNESDAY = 'WEDNESDAY'
2185
+ service_principal_name: Optional[str] = None
2186
+ """Application ID of an active service principal. Setting this field requires the
2187
+ `servicePrincipal/user` role."""
2188
+
2189
+ user_name: Optional[str] = None
2190
+ """The email of an active workspace user. Users can only set this field to their own email."""
2191
+
2192
+ def as_dict(self) -> dict:
2193
+ """Serializes the RunAs into a dictionary suitable for use as a JSON request body."""
2194
+ body = {}
2195
+ if self.service_principal_name is not None:
2196
+ body['service_principal_name'] = self.service_principal_name
2197
+ if self.user_name is not None: body['user_name'] = self.user_name
2198
+ return body
2199
+
2200
+ def as_shallow_dict(self) -> dict:
2201
+ """Serializes the RunAs into a shallow dictionary of its immediate attributes."""
2202
+ body = {}
2203
+ if self.service_principal_name is not None:
2204
+ body['service_principal_name'] = self.service_principal_name
2205
+ if self.user_name is not None: body['user_name'] = self.user_name
2206
+ return body
2207
+
2208
+ @classmethod
2209
+ def from_dict(cls, d: Dict[str, any]) -> RunAs:
2210
+ """Deserializes the RunAs from a dictionary."""
2211
+ return cls(service_principal_name=d.get('service_principal_name', None),
2212
+ user_name=d.get('user_name', None))
2152
2213
 
2153
2214
 
2154
2215
  @dataclass
@@ -2791,6 +2852,7 @@ class PipelinesAPI:
2791
2852
  notifications: Optional[List[Notifications]] = None,
2792
2853
  photon: Optional[bool] = None,
2793
2854
  restart_window: Optional[RestartWindow] = None,
2855
+ run_as: Optional[RunAs] = None,
2794
2856
  schema: Optional[str] = None,
2795
2857
  serverless: Optional[bool] = None,
2796
2858
  storage: Optional[str] = None,
@@ -2843,6 +2905,12 @@ class PipelinesAPI:
2843
2905
  Whether Photon is enabled for this pipeline.
2844
2906
  :param restart_window: :class:`RestartWindow` (optional)
2845
2907
  Restart window of this pipeline.
2908
+ :param run_as: :class:`RunAs` (optional)
2909
+ Write-only setting, available only in Create/Update calls. Specifies the user or service principal
2910
+ that the pipeline runs as. If not specified, the pipeline runs as the user who created the pipeline.
2911
+
2912
+ Only `user_name` or `service_principal_name` can be specified. If both are specified, an error is
2913
+ thrown.
2846
2914
  :param schema: str (optional)
2847
2915
  The default schema (database) where tables are read from or published to. The presence of this field
2848
2916
  implies that the pipeline is in direct publishing mode.
@@ -2879,6 +2947,7 @@ class PipelinesAPI:
2879
2947
  if notifications is not None: body['notifications'] = [v.as_dict() for v in notifications]
2880
2948
  if photon is not None: body['photon'] = photon
2881
2949
  if restart_window is not None: body['restart_window'] = restart_window.as_dict()
2950
+ if run_as is not None: body['run_as'] = run_as.as_dict()
2882
2951
  if schema is not None: body['schema'] = schema
2883
2952
  if serverless is not None: body['serverless'] = serverless
2884
2953
  if storage is not None: body['storage'] = storage
@@ -3213,6 +3282,7 @@ class PipelinesAPI:
3213
3282
  notifications: Optional[List[Notifications]] = None,
3214
3283
  photon: Optional[bool] = None,
3215
3284
  restart_window: Optional[RestartWindow] = None,
3285
+ run_as: Optional[RunAs] = None,
3216
3286
  schema: Optional[str] = None,
3217
3287
  serverless: Optional[bool] = None,
3218
3288
  storage: Optional[str] = None,
@@ -3268,6 +3338,12 @@ class PipelinesAPI:
3268
3338
  Whether Photon is enabled for this pipeline.
3269
3339
  :param restart_window: :class:`RestartWindow` (optional)
3270
3340
  Restart window of this pipeline.
3341
+ :param run_as: :class:`RunAs` (optional)
3342
+ Write-only setting, available only in Create/Update calls. Specifies the user or service principal
3343
+ that the pipeline runs as. If not specified, the pipeline runs as the user who created the pipeline.
3344
+
3345
+ Only `user_name` or `service_principal_name` can be specified. If both are specified, an error is
3346
+ thrown.
3271
3347
  :param schema: str (optional)
3272
3348
  The default schema (database) where tables are read from or published to. The presence of this field
3273
3349
  implies that the pipeline is in direct publishing mode.
@@ -3304,6 +3380,7 @@ class PipelinesAPI:
3304
3380
  if notifications is not None: body['notifications'] = [v.as_dict() for v in notifications]
3305
3381
  if photon is not None: body['photon'] = photon
3306
3382
  if restart_window is not None: body['restart_window'] = restart_window.as_dict()
3383
+ if run_as is not None: body['run_as'] = run_as.as_dict()
3307
3384
  if schema is not None: body['schema'] = schema
3308
3385
  if serverless is not None: body['serverless'] = serverless
3309
3386
  if storage is not None: body['storage'] = storage