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

@@ -25,7 +25,8 @@ class App:
25
25
  It must be unique within the workspace."""
26
26
 
27
27
  active_deployment: Optional[AppDeployment] = None
28
- """The active deployment of the app."""
28
+ """The active deployment of the app. A deployment is considered active when it has been deployed to
29
+ the app compute."""
29
30
 
30
31
  app_status: Optional[ApplicationStatus] = None
31
32
 
@@ -37,11 +38,19 @@ class App:
37
38
  creator: Optional[str] = None
38
39
  """The email of the user that created the app."""
39
40
 
41
+ default_source_code_path: Optional[str] = None
42
+ """The default workspace file system path of the source code from which app deployment are created.
43
+ This field tracks the workspace source code path of the last active deployment."""
44
+
40
45
  description: Optional[str] = None
41
46
  """The description of the app."""
42
47
 
43
48
  pending_deployment: Optional[AppDeployment] = None
44
- """The pending deployment of the app."""
49
+ """The pending deployment of the app. A deployment is considered pending when it is being prepared
50
+ for deployment to the app compute."""
51
+
52
+ resources: Optional[List[AppResource]] = None
53
+ """Resources for the app."""
45
54
 
46
55
  service_principal_id: Optional[int] = None
47
56
 
@@ -64,9 +73,12 @@ class App:
64
73
  if self.compute_status: body['compute_status'] = self.compute_status.as_dict()
65
74
  if self.create_time is not None: body['create_time'] = self.create_time
66
75
  if self.creator is not None: body['creator'] = self.creator
76
+ if self.default_source_code_path is not None:
77
+ body['default_source_code_path'] = self.default_source_code_path
67
78
  if self.description is not None: body['description'] = self.description
68
79
  if self.name is not None: body['name'] = self.name
69
80
  if self.pending_deployment: body['pending_deployment'] = self.pending_deployment.as_dict()
81
+ if self.resources: body['resources'] = [v.as_dict() for v in self.resources]
70
82
  if self.service_principal_id is not None: body['service_principal_id'] = self.service_principal_id
71
83
  if self.service_principal_name is not None:
72
84
  body['service_principal_name'] = self.service_principal_name
@@ -83,9 +95,11 @@ class App:
83
95
  compute_status=_from_dict(d, 'compute_status', ComputeStatus),
84
96
  create_time=d.get('create_time', None),
85
97
  creator=d.get('creator', None),
98
+ default_source_code_path=d.get('default_source_code_path', None),
86
99
  description=d.get('description', None),
87
100
  name=d.get('name', None),
88
101
  pending_deployment=_from_dict(d, 'pending_deployment', AppDeployment),
102
+ resources=_repeated_dict(d, 'resources', AppResource),
89
103
  service_principal_id=d.get('service_principal_id', None),
90
104
  service_principal_name=d.get('service_principal_name', None),
91
105
  update_time=d.get('update_time', None),
@@ -372,6 +386,170 @@ class AppPermissionsRequest:
372
386
  app_name=d.get('app_name', None))
373
387
 
374
388
 
389
+ @dataclass
390
+ class AppResource:
391
+ name: str
392
+ """Name of the App Resource."""
393
+
394
+ description: Optional[str] = None
395
+ """Description of the App Resource."""
396
+
397
+ job: Optional[AppResourceJob] = None
398
+
399
+ secret: Optional[AppResourceSecret] = None
400
+
401
+ serving_endpoint: Optional[AppResourceServingEndpoint] = None
402
+
403
+ sql_warehouse: Optional[AppResourceSqlWarehouse] = None
404
+
405
+ def as_dict(self) -> dict:
406
+ """Serializes the AppResource into a dictionary suitable for use as a JSON request body."""
407
+ body = {}
408
+ if self.description is not None: body['description'] = self.description
409
+ if self.job: body['job'] = self.job.as_dict()
410
+ if self.name is not None: body['name'] = self.name
411
+ if self.secret: body['secret'] = self.secret.as_dict()
412
+ if self.serving_endpoint: body['serving_endpoint'] = self.serving_endpoint.as_dict()
413
+ if self.sql_warehouse: body['sql_warehouse'] = self.sql_warehouse.as_dict()
414
+ return body
415
+
416
+ @classmethod
417
+ def from_dict(cls, d: Dict[str, any]) -> AppResource:
418
+ """Deserializes the AppResource from a dictionary."""
419
+ return cls(description=d.get('description', None),
420
+ job=_from_dict(d, 'job', AppResourceJob),
421
+ name=d.get('name', None),
422
+ secret=_from_dict(d, 'secret', AppResourceSecret),
423
+ serving_endpoint=_from_dict(d, 'serving_endpoint', AppResourceServingEndpoint),
424
+ sql_warehouse=_from_dict(d, 'sql_warehouse', AppResourceSqlWarehouse))
425
+
426
+
427
+ @dataclass
428
+ class AppResourceJob:
429
+ id: str
430
+ """Id of the job to grant permission on."""
431
+
432
+ permission: AppResourceJobJobPermission
433
+ """Permissions to grant on the Job. Supported permissions are: "CAN_MANAGE", "IS_OWNER",
434
+ "CAN_MANAGE_RUN", "CAN_VIEW"."""
435
+
436
+ def as_dict(self) -> dict:
437
+ """Serializes the AppResourceJob into a dictionary suitable for use as a JSON request body."""
438
+ body = {}
439
+ if self.id is not None: body['id'] = self.id
440
+ if self.permission is not None: body['permission'] = self.permission.value
441
+ return body
442
+
443
+ @classmethod
444
+ def from_dict(cls, d: Dict[str, any]) -> AppResourceJob:
445
+ """Deserializes the AppResourceJob from a dictionary."""
446
+ return cls(id=d.get('id', None), permission=_enum(d, 'permission', AppResourceJobJobPermission))
447
+
448
+
449
+ class AppResourceJobJobPermission(Enum):
450
+
451
+ CAN_MANAGE = 'CAN_MANAGE'
452
+ CAN_MANAGE_RUN = 'CAN_MANAGE_RUN'
453
+ CAN_VIEW = 'CAN_VIEW'
454
+ IS_OWNER = 'IS_OWNER'
455
+
456
+
457
+ @dataclass
458
+ class AppResourceSecret:
459
+ scope: str
460
+ """Scope of the secret to grant permission on."""
461
+
462
+ key: str
463
+ """Key of the secret to grant permission on."""
464
+
465
+ permission: AppResourceSecretSecretPermission
466
+ """Permission to grant on the secret scope. For secrets, only one permission is allowed. Permission
467
+ must be one of: "READ", "WRITE", "MANAGE"."""
468
+
469
+ def as_dict(self) -> dict:
470
+ """Serializes the AppResourceSecret into a dictionary suitable for use as a JSON request body."""
471
+ body = {}
472
+ if self.key is not None: body['key'] = self.key
473
+ if self.permission is not None: body['permission'] = self.permission.value
474
+ if self.scope is not None: body['scope'] = self.scope
475
+ return body
476
+
477
+ @classmethod
478
+ def from_dict(cls, d: Dict[str, any]) -> AppResourceSecret:
479
+ """Deserializes the AppResourceSecret from a dictionary."""
480
+ return cls(key=d.get('key', None),
481
+ permission=_enum(d, 'permission', AppResourceSecretSecretPermission),
482
+ scope=d.get('scope', None))
483
+
484
+
485
+ class AppResourceSecretSecretPermission(Enum):
486
+ """Permission to grant on the secret scope. Supported permissions are: "READ", "WRITE", "MANAGE"."""
487
+
488
+ MANAGE = 'MANAGE'
489
+ READ = 'READ'
490
+ WRITE = 'WRITE'
491
+
492
+
493
+ @dataclass
494
+ class AppResourceServingEndpoint:
495
+ name: str
496
+ """Name of the serving endpoint to grant permission on."""
497
+
498
+ permission: AppResourceServingEndpointServingEndpointPermission
499
+ """Permission to grant on the serving endpoint. Supported permissions are: "CAN_MANAGE",
500
+ "CAN_QUERY", "CAN_VIEW"."""
501
+
502
+ def as_dict(self) -> dict:
503
+ """Serializes the AppResourceServingEndpoint into a dictionary suitable for use as a JSON request body."""
504
+ body = {}
505
+ if self.name is not None: body['name'] = self.name
506
+ if self.permission is not None: body['permission'] = self.permission.value
507
+ return body
508
+
509
+ @classmethod
510
+ def from_dict(cls, d: Dict[str, any]) -> AppResourceServingEndpoint:
511
+ """Deserializes the AppResourceServingEndpoint from a dictionary."""
512
+ return cls(name=d.get('name', None),
513
+ permission=_enum(d, 'permission', AppResourceServingEndpointServingEndpointPermission))
514
+
515
+
516
+ class AppResourceServingEndpointServingEndpointPermission(Enum):
517
+
518
+ CAN_MANAGE = 'CAN_MANAGE'
519
+ CAN_QUERY = 'CAN_QUERY'
520
+ CAN_VIEW = 'CAN_VIEW'
521
+
522
+
523
+ @dataclass
524
+ class AppResourceSqlWarehouse:
525
+ id: str
526
+ """Id of the SQL warehouse to grant permission on."""
527
+
528
+ permission: AppResourceSqlWarehouseSqlWarehousePermission
529
+ """Permission to grant on the SQL warehouse. Supported permissions are: "CAN_MANAGE", "CAN_USE",
530
+ "IS_OWNER"."""
531
+
532
+ def as_dict(self) -> dict:
533
+ """Serializes the AppResourceSqlWarehouse into a dictionary suitable for use as a JSON request body."""
534
+ body = {}
535
+ if self.id is not None: body['id'] = self.id
536
+ if self.permission is not None: body['permission'] = self.permission.value
537
+ return body
538
+
539
+ @classmethod
540
+ def from_dict(cls, d: Dict[str, any]) -> AppResourceSqlWarehouse:
541
+ """Deserializes the AppResourceSqlWarehouse from a dictionary."""
542
+ return cls(id=d.get('id', None),
543
+ permission=_enum(d, 'permission', AppResourceSqlWarehouseSqlWarehousePermission))
544
+
545
+
546
+ class AppResourceSqlWarehouseSqlWarehousePermission(Enum):
547
+
548
+ CAN_MANAGE = 'CAN_MANAGE'
549
+ CAN_USE = 'CAN_USE'
550
+ IS_OWNER = 'IS_OWNER'
551
+
552
+
375
553
  class ApplicationState(Enum):
376
554
 
377
555
  CRASHED = 'CRASHED'
@@ -478,17 +656,23 @@ class CreateAppRequest:
478
656
  description: Optional[str] = None
479
657
  """The description of the app."""
480
658
 
659
+ resources: Optional[List[AppResource]] = None
660
+ """Resources for the app."""
661
+
481
662
  def as_dict(self) -> dict:
482
663
  """Serializes the CreateAppRequest into a dictionary suitable for use as a JSON request body."""
483
664
  body = {}
484
665
  if self.description is not None: body['description'] = self.description
485
666
  if self.name is not None: body['name'] = self.name
667
+ if self.resources: body['resources'] = [v.as_dict() for v in self.resources]
486
668
  return body
487
669
 
488
670
  @classmethod
489
671
  def from_dict(cls, d: Dict[str, any]) -> CreateAppRequest:
490
672
  """Deserializes the CreateAppRequest from a dictionary."""
491
- return cls(description=d.get('description', None), name=d.get('name', None))
673
+ return cls(description=d.get('description', None),
674
+ name=d.get('name', None),
675
+ resources=_repeated_dict(d, 'resources', AppResource))
492
676
 
493
677
 
494
678
  @dataclass
@@ -571,17 +755,23 @@ class UpdateAppRequest:
571
755
  description: Optional[str] = None
572
756
  """The description of the app."""
573
757
 
758
+ resources: Optional[List[AppResource]] = None
759
+ """Resources for the app."""
760
+
574
761
  def as_dict(self) -> dict:
575
762
  """Serializes the UpdateAppRequest into a dictionary suitable for use as a JSON request body."""
576
763
  body = {}
577
764
  if self.description is not None: body['description'] = self.description
578
765
  if self.name is not None: body['name'] = self.name
766
+ if self.resources: body['resources'] = [v.as_dict() for v in self.resources]
579
767
  return body
580
768
 
581
769
  @classmethod
582
770
  def from_dict(cls, d: Dict[str, any]) -> UpdateAppRequest:
583
771
  """Deserializes the UpdateAppRequest from a dictionary."""
584
- return cls(description=d.get('description', None), name=d.get('name', None))
772
+ return cls(description=d.get('description', None),
773
+ name=d.get('name', None),
774
+ resources=_repeated_dict(d, 'resources', AppResource))
585
775
 
586
776
 
587
777
  class AppsAPI:
@@ -597,7 +787,7 @@ class AppsAPI:
597
787
  callback: Optional[Callable[[App], None]] = None) -> App:
598
788
  deadline = time.time() + timeout.total_seconds()
599
789
  target_states = (ComputeState.ACTIVE, )
600
- failure_states = (ComputeState.ERROR, )
790
+ failure_states = (ComputeState.ERROR, ComputeState.STOPPED, )
601
791
  status_message = 'polling...'
602
792
  attempt = 1
603
793
  while time.time() < deadline:
@@ -689,7 +879,11 @@ class AppsAPI:
689
879
  attempt += 1
690
880
  raise TimeoutError(f'timed out after {timeout}: {status_message}')
691
881
 
692
- def create(self, name: str, *, description: Optional[str] = None) -> Wait[App]:
882
+ def create(self,
883
+ name: str,
884
+ *,
885
+ description: Optional[str] = None,
886
+ resources: Optional[List[AppResource]] = None) -> Wait[App]:
693
887
  """Create an app.
694
888
 
695
889
  Creates a new app.
@@ -699,6 +893,8 @@ class AppsAPI:
699
893
  must be unique within the workspace.
700
894
  :param description: str (optional)
701
895
  The description of the app.
896
+ :param resources: List[:class:`AppResource`] (optional)
897
+ Resources for the app.
702
898
 
703
899
  :returns:
704
900
  Long-running operation waiter for :class:`App`.
@@ -707,6 +903,7 @@ class AppsAPI:
707
903
  body = {}
708
904
  if description is not None: body['description'] = description
709
905
  if name is not None: body['name'] = name
906
+ if resources is not None: body['resources'] = [v.as_dict() for v in resources]
710
907
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
711
908
 
712
909
  op_response = self._api.do('POST', '/api/2.0/apps', body=body, headers=headers)
@@ -716,8 +913,9 @@ class AppsAPI:
716
913
  name: str,
717
914
  *,
718
915
  description: Optional[str] = None,
916
+ resources: Optional[List[AppResource]] = None,
719
917
  timeout=timedelta(minutes=20)) -> App:
720
- return self.create(description=description, name=name).result(timeout=timeout)
918
+ return self.create(description=description, name=name, resources=resources).result(timeout=timeout)
721
919
 
722
920
  def delete(self, name: str) -> App:
723
921
  """Delete an app.
@@ -981,7 +1179,11 @@ class AppsAPI:
981
1179
  def stop_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App:
982
1180
  return self.stop(name=name).result(timeout=timeout)
983
1181
 
984
- def update(self, name: str, *, description: Optional[str] = None) -> App:
1182
+ def update(self,
1183
+ name: str,
1184
+ *,
1185
+ description: Optional[str] = None,
1186
+ resources: Optional[List[AppResource]] = None) -> App:
985
1187
  """Update an app.
986
1188
 
987
1189
  Updates the app with the supplied name.
@@ -991,11 +1193,14 @@ class AppsAPI:
991
1193
  must be unique within the workspace.
992
1194
  :param description: str (optional)
993
1195
  The description of the app.
1196
+ :param resources: List[:class:`AppResource`] (optional)
1197
+ Resources for the app.
994
1198
 
995
1199
  :returns: :class:`App`
996
1200
  """
997
1201
  body = {}
998
1202
  if description is not None: body['description'] = description
1203
+ if resources is not None: body['resources'] = [v.as_dict() for v in resources]
999
1204
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1000
1205
 
1001
1206
  res = self._api.do('PATCH', f'/api/2.0/apps/{name}', body=body, headers=headers)
@@ -909,6 +909,7 @@ class ConnectionInfoSecurableKind(Enum):
909
909
  CONNECTION_DATABRICKS = 'CONNECTION_DATABRICKS'
910
910
  CONNECTION_EXTERNAL_HIVE_METASTORE = 'CONNECTION_EXTERNAL_HIVE_METASTORE'
911
911
  CONNECTION_GLUE = 'CONNECTION_GLUE'
912
+ CONNECTION_HTTP_BEARER = 'CONNECTION_HTTP_BEARER'
912
913
  CONNECTION_MYSQL = 'CONNECTION_MYSQL'
913
914
  CONNECTION_ONLINE_CATALOG = 'CONNECTION_ONLINE_CATALOG'
914
915
  CONNECTION_POSTGRESQL = 'CONNECTION_POSTGRESQL'
@@ -925,6 +926,7 @@ class ConnectionType(Enum):
925
926
  DATABRICKS = 'DATABRICKS'
926
927
  GLUE = 'GLUE'
927
928
  HIVE_METASTORE = 'HIVE_METASTORE'
929
+ HTTP = 'HTTP'
928
930
  MYSQL = 'MYSQL'
929
931
  POSTGRESQL = 'POSTGRESQL'
930
932
  REDSHIFT = 'REDSHIFT'
@@ -1676,6 +1678,7 @@ class CreateVolumeRequestContent:
1676
1678
  class CredentialType(Enum):
1677
1679
  """The type of credential."""
1678
1680
 
1681
+ BEARER_TOKEN = 'BEARER_TOKEN'
1679
1682
  USERNAME_PASSWORD = 'USERNAME_PASSWORD'
1680
1683
 
1681
1684
 
@@ -2547,8 +2550,8 @@ class GenerateTemporaryTableCredentialResponse:
2547
2550
  https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas"""
2548
2551
 
2549
2552
  expiration_time: Optional[int] = None
2550
- """Server time when the credential will expire, in unix epoch milliseconds since January 1, 1970 at
2551
- 00:00:00 UTC. The API client is advised to cache the credential given this expiration time."""
2553
+ """Server time when the credential will expire, in epoch milliseconds. The API client is advised to
2554
+ cache the credential given this expiration time."""
2552
2555
 
2553
2556
  gcp_oauth_token: Optional[GcpOauthToken] = None
2554
2557
  """GCP temporary credentials for API authentication. Read more at
@@ -3862,11 +3865,16 @@ class OnlineTable:
3862
3865
  """Specification of the online table."""
3863
3866
 
3864
3867
  status: Optional[OnlineTableStatus] = None
3865
- """Online Table status"""
3868
+ """Online Table data synchronization status"""
3866
3869
 
3867
3870
  table_serving_url: Optional[str] = None
3868
3871
  """Data serving REST API URL for this table"""
3869
3872
 
3873
+ unity_catalog_provisioning_state: Optional[ProvisioningInfoState] = None
3874
+ """The provisioning state of the online table entity in Unity Catalog. This is distinct from the
3875
+ state of the data synchronization pipeline (i.e. the table may be in "ACTIVE" but the pipeline
3876
+ may be in "PROVISIONING" as it runs asynchronously)."""
3877
+
3870
3878
  def as_dict(self) -> dict:
3871
3879
  """Serializes the OnlineTable into a dictionary suitable for use as a JSON request body."""
3872
3880
  body = {}
@@ -3874,6 +3882,8 @@ class OnlineTable:
3874
3882
  if self.spec: body['spec'] = self.spec.as_dict()
3875
3883
  if self.status: body['status'] = self.status.as_dict()
3876
3884
  if self.table_serving_url is not None: body['table_serving_url'] = self.table_serving_url
3885
+ if self.unity_catalog_provisioning_state is not None:
3886
+ body['unity_catalog_provisioning_state'] = self.unity_catalog_provisioning_state.value
3877
3887
  return body
3878
3888
 
3879
3889
  @classmethod
@@ -3882,7 +3892,9 @@ class OnlineTable:
3882
3892
  return cls(name=d.get('name', None),
3883
3893
  spec=_from_dict(d, 'spec', OnlineTableSpec),
3884
3894
  status=_from_dict(d, 'status', OnlineTableStatus),
3885
- table_serving_url=d.get('table_serving_url', None))
3895
+ table_serving_url=d.get('table_serving_url', None),
3896
+ unity_catalog_provisioning_state=_enum(d, 'unity_catalog_provisioning_state',
3897
+ ProvisioningInfoState))
3886
3898
 
3887
3899
 
3888
3900
  @dataclass
@@ -4241,7 +4253,7 @@ class ProvisioningInfoState(Enum):
4241
4253
  DELETING = 'DELETING'
4242
4254
  FAILED = 'FAILED'
4243
4255
  PROVISIONING = 'PROVISIONING'
4244
- STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
4256
+ UPDATING = 'UPDATING'
4245
4257
 
4246
4258
 
4247
4259
  @dataclass
@@ -169,8 +169,8 @@ class Dashboard:
169
169
  trailing slash. This field is excluded in List Dashboards responses."""
170
170
 
171
171
  path: Optional[str] = None
172
- """The workspace path of the dashboard asset, including the file name. This field is excluded in
173
- List Dashboards responses."""
172
+ """The workspace path of the dashboard asset, including the file name. Exported dashboards always
173
+ have the file extension `.lvdash.json`. This field is excluded in List Dashboards responses."""
174
174
 
175
175
  serialized_dashboard: Optional[str] = None
176
176
  """The contents of the dashboard in serialized string form. This field is excluded in List
@@ -607,6 +607,7 @@ class MessageErrorType(Enum):
607
607
  LOCAL_CONTEXT_EXCEEDED_EXCEPTION = 'LOCAL_CONTEXT_EXCEEDED_EXCEPTION'
608
608
  MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION = 'MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION'
609
609
  MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION = 'MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION'
610
+ NO_QUERY_TO_VISUALIZE_EXCEPTION = 'NO_QUERY_TO_VISUALIZE_EXCEPTION'
610
611
  NO_TABLES_TO_QUERY_EXCEPTION = 'NO_TABLES_TO_QUERY_EXCEPTION'
611
612
  RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION = 'RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION'
612
613
  RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION = 'RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION'
@@ -784,6 +785,9 @@ class QueryAttachment:
784
785
 
785
786
  @dataclass
786
787
  class Result:
788
+ is_truncated: Optional[bool] = None
789
+ """If result is truncated"""
790
+
787
791
  row_count: Optional[int] = None
788
792
  """Row count of the result"""
789
793
 
@@ -794,6 +798,7 @@ class Result:
794
798
  def as_dict(self) -> dict:
795
799
  """Serializes the Result into a dictionary suitable for use as a JSON request body."""
796
800
  body = {}
801
+ if self.is_truncated is not None: body['is_truncated'] = self.is_truncated
797
802
  if self.row_count is not None: body['row_count'] = self.row_count
798
803
  if self.statement_id is not None: body['statement_id'] = self.statement_id
799
804
  return body
@@ -801,7 +806,9 @@ class Result:
801
806
  @classmethod
802
807
  def from_dict(cls, d: Dict[str, any]) -> Result:
803
808
  """Deserializes the Result from a dictionary."""
804
- return cls(row_count=d.get('row_count', None), statement_id=d.get('statement_id', None))
809
+ return cls(is_truncated=d.get('is_truncated', None),
810
+ row_count=d.get('row_count', None),
811
+ statement_id=d.get('statement_id', None))
805
812
 
806
813
 
807
814
  @dataclass