databricks-sdk 0.20.0__py3-none-any.whl → 0.21.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.
- databricks/sdk/__init__.py +21 -6
- databricks/sdk/_widgets/__init__.py +2 -2
- databricks/sdk/config.py +3 -2
- databricks/sdk/oauth.py +1 -1
- databricks/sdk/runtime/__init__.py +85 -11
- databricks/sdk/runtime/dbutils_stub.py +1 -1
- databricks/sdk/service/_internal.py +1 -1
- databricks/sdk/service/billing.py +42 -0
- databricks/sdk/service/catalog.py +245 -44
- databricks/sdk/service/compute.py +334 -13
- databricks/sdk/service/dashboards.py +14 -0
- databricks/sdk/service/files.py +154 -12
- databricks/sdk/service/iam.py +161 -0
- databricks/sdk/service/jobs.py +95 -8
- databricks/sdk/service/ml.py +350 -0
- databricks/sdk/service/oauth2.py +70 -0
- databricks/sdk/service/pipelines.py +66 -8
- databricks/sdk/service/provisioning.py +78 -36
- databricks/sdk/service/serving.py +28 -0
- databricks/sdk/service/settings.py +1292 -203
- databricks/sdk/service/sharing.py +56 -0
- databricks/sdk/service/sql.py +138 -11
- databricks/sdk/service/vectorsearch.py +95 -60
- databricks/sdk/service/workspace.py +141 -1
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.20.0.dist-info → databricks_sdk-0.21.0.dist-info}/METADATA +3 -1
- databricks_sdk-0.21.0.dist-info/RECORD +53 -0
- databricks/sdk/runtime/stub.py +0 -48
- databricks_sdk-0.20.0.dist-info/RECORD +0 -54
- {databricks_sdk-0.20.0.dist-info → databricks_sdk-0.21.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.20.0.dist-info → databricks_sdk-0.21.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.20.0.dist-info → databricks_sdk-0.21.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.20.0.dist-info → databricks_sdk-0.21.0.dist-info}/top_level.txt +0 -0
|
@@ -544,6 +544,34 @@ class CreateShare:
|
|
|
544
544
|
return cls(comment=d.get('comment', None), name=d.get('name', None))
|
|
545
545
|
|
|
546
546
|
|
|
547
|
+
@dataclass
|
|
548
|
+
class DeleteResponse:
|
|
549
|
+
|
|
550
|
+
def as_dict(self) -> dict:
|
|
551
|
+
"""Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body."""
|
|
552
|
+
body = {}
|
|
553
|
+
return body
|
|
554
|
+
|
|
555
|
+
@classmethod
|
|
556
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteResponse:
|
|
557
|
+
"""Deserializes the DeleteResponse from a dictionary."""
|
|
558
|
+
return cls()
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@dataclass
|
|
562
|
+
class GetActivationUrlInfoResponse:
|
|
563
|
+
|
|
564
|
+
def as_dict(self) -> dict:
|
|
565
|
+
"""Serializes the GetActivationUrlInfoResponse into a dictionary suitable for use as a JSON request body."""
|
|
566
|
+
body = {}
|
|
567
|
+
return body
|
|
568
|
+
|
|
569
|
+
@classmethod
|
|
570
|
+
def from_dict(cls, d: Dict[str, any]) -> GetActivationUrlInfoResponse:
|
|
571
|
+
"""Deserializes the GetActivationUrlInfoResponse from a dictionary."""
|
|
572
|
+
return cls()
|
|
573
|
+
|
|
574
|
+
|
|
547
575
|
@dataclass
|
|
548
576
|
class GetRecipientSharePermissionsResponse:
|
|
549
577
|
permissions_out: Optional[List[ShareToPrivilegeAssignment]] = None
|
|
@@ -1404,6 +1432,20 @@ class UpdateCleanRoom:
|
|
|
1404
1432
|
owner=d.get('owner', None))
|
|
1405
1433
|
|
|
1406
1434
|
|
|
1435
|
+
@dataclass
|
|
1436
|
+
class UpdatePermissionsResponse:
|
|
1437
|
+
|
|
1438
|
+
def as_dict(self) -> dict:
|
|
1439
|
+
"""Serializes the UpdatePermissionsResponse into a dictionary suitable for use as a JSON request body."""
|
|
1440
|
+
body = {}
|
|
1441
|
+
return body
|
|
1442
|
+
|
|
1443
|
+
@classmethod
|
|
1444
|
+
def from_dict(cls, d: Dict[str, any]) -> UpdatePermissionsResponse:
|
|
1445
|
+
"""Deserializes the UpdatePermissionsResponse from a dictionary."""
|
|
1446
|
+
return cls()
|
|
1447
|
+
|
|
1448
|
+
|
|
1407
1449
|
@dataclass
|
|
1408
1450
|
class UpdateProvider:
|
|
1409
1451
|
comment: Optional[str] = None
|
|
@@ -1485,6 +1527,20 @@ class UpdateRecipient:
|
|
|
1485
1527
|
properties_kvpairs=_from_dict(d, 'properties_kvpairs', SecurablePropertiesKvPairs))
|
|
1486
1528
|
|
|
1487
1529
|
|
|
1530
|
+
@dataclass
|
|
1531
|
+
class UpdateResponse:
|
|
1532
|
+
|
|
1533
|
+
def as_dict(self) -> dict:
|
|
1534
|
+
"""Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body."""
|
|
1535
|
+
body = {}
|
|
1536
|
+
return body
|
|
1537
|
+
|
|
1538
|
+
@classmethod
|
|
1539
|
+
def from_dict(cls, d: Dict[str, any]) -> UpdateResponse:
|
|
1540
|
+
"""Deserializes the UpdateResponse from a dictionary."""
|
|
1541
|
+
return cls()
|
|
1542
|
+
|
|
1543
|
+
|
|
1488
1544
|
@dataclass
|
|
1489
1545
|
class UpdateShare:
|
|
1490
1546
|
comment: Optional[str] = None
|
databricks/sdk/service/sql.py
CHANGED
|
@@ -303,6 +303,20 @@ class BaseChunkInfo:
|
|
|
303
303
|
row_offset=d.get('row_offset', None))
|
|
304
304
|
|
|
305
305
|
|
|
306
|
+
@dataclass
|
|
307
|
+
class CancelExecutionResponse:
|
|
308
|
+
|
|
309
|
+
def as_dict(self) -> dict:
|
|
310
|
+
"""Serializes the CancelExecutionResponse into a dictionary suitable for use as a JSON request body."""
|
|
311
|
+
body = {}
|
|
312
|
+
return body
|
|
313
|
+
|
|
314
|
+
@classmethod
|
|
315
|
+
def from_dict(cls, d: Dict[str, any]) -> CancelExecutionResponse:
|
|
316
|
+
"""Deserializes the CancelExecutionResponse from a dictionary."""
|
|
317
|
+
return cls()
|
|
318
|
+
|
|
319
|
+
|
|
306
320
|
@dataclass
|
|
307
321
|
class Channel:
|
|
308
322
|
dbsql_version: Optional[str] = None
|
|
@@ -895,6 +909,34 @@ class DataSource:
|
|
|
895
909
|
warehouse_id=d.get('warehouse_id', None))
|
|
896
910
|
|
|
897
911
|
|
|
912
|
+
@dataclass
|
|
913
|
+
class DeleteResponse:
|
|
914
|
+
|
|
915
|
+
def as_dict(self) -> dict:
|
|
916
|
+
"""Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body."""
|
|
917
|
+
body = {}
|
|
918
|
+
return body
|
|
919
|
+
|
|
920
|
+
@classmethod
|
|
921
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteResponse:
|
|
922
|
+
"""Deserializes the DeleteResponse from a dictionary."""
|
|
923
|
+
return cls()
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
@dataclass
|
|
927
|
+
class DeleteWarehouseResponse:
|
|
928
|
+
|
|
929
|
+
def as_dict(self) -> dict:
|
|
930
|
+
"""Serializes the DeleteWarehouseResponse into a dictionary suitable for use as a JSON request body."""
|
|
931
|
+
body = {}
|
|
932
|
+
return body
|
|
933
|
+
|
|
934
|
+
@classmethod
|
|
935
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteWarehouseResponse:
|
|
936
|
+
"""Deserializes the DeleteWarehouseResponse from a dictionary."""
|
|
937
|
+
return cls()
|
|
938
|
+
|
|
939
|
+
|
|
898
940
|
class Disposition(Enum):
|
|
899
941
|
"""The fetch disposition provides two modes of fetching results: `INLINE` and `EXTERNAL_LINKS`.
|
|
900
942
|
|
|
@@ -1080,6 +1122,20 @@ class EditWarehouseRequestWarehouseType(Enum):
|
|
|
1080
1122
|
TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED'
|
|
1081
1123
|
|
|
1082
1124
|
|
|
1125
|
+
@dataclass
|
|
1126
|
+
class EditWarehouseResponse:
|
|
1127
|
+
|
|
1128
|
+
def as_dict(self) -> dict:
|
|
1129
|
+
"""Serializes the EditWarehouseResponse into a dictionary suitable for use as a JSON request body."""
|
|
1130
|
+
body = {}
|
|
1131
|
+
return body
|
|
1132
|
+
|
|
1133
|
+
@classmethod
|
|
1134
|
+
def from_dict(cls, d: Dict[str, any]) -> EditWarehouseResponse:
|
|
1135
|
+
"""Deserializes the EditWarehouseResponse from a dictionary."""
|
|
1136
|
+
return cls()
|
|
1137
|
+
|
|
1138
|
+
|
|
1083
1139
|
@dataclass
|
|
1084
1140
|
class EndpointConfPair:
|
|
1085
1141
|
key: Optional[str] = None
|
|
@@ -2584,9 +2640,6 @@ class QueryMetrics:
|
|
|
2584
2640
|
photon_total_time_ms: Optional[int] = None
|
|
2585
2641
|
"""Total execution time for all individual Photon query engine tasks in the query, in milliseconds."""
|
|
2586
2642
|
|
|
2587
|
-
planning_phases: Optional[List[Any]] = None
|
|
2588
|
-
"""Reserved for internal use."""
|
|
2589
|
-
|
|
2590
2643
|
planning_time_ms: Optional[int] = None
|
|
2591
2644
|
"""Reserved for internal use."""
|
|
2592
2645
|
|
|
@@ -2656,7 +2709,6 @@ class QueryMetrics:
|
|
|
2656
2709
|
if self.overloading_queue_start_timestamp is not None:
|
|
2657
2710
|
body['overloading_queue_start_timestamp'] = self.overloading_queue_start_timestamp
|
|
2658
2711
|
if self.photon_total_time_ms is not None: body['photon_total_time_ms'] = self.photon_total_time_ms
|
|
2659
|
-
if self.planning_phases: body['planning_phases'] = [v for v in self.planning_phases]
|
|
2660
2712
|
if self.planning_time_ms is not None: body['planning_time_ms'] = self.planning_time_ms
|
|
2661
2713
|
if self.provisioning_queue_start_timestamp is not None:
|
|
2662
2714
|
body['provisioning_queue_start_timestamp'] = self.provisioning_queue_start_timestamp
|
|
@@ -2690,7 +2742,6 @@ class QueryMetrics:
|
|
|
2690
2742
|
network_sent_bytes=d.get('network_sent_bytes', None),
|
|
2691
2743
|
overloading_queue_start_timestamp=d.get('overloading_queue_start_timestamp', None),
|
|
2692
2744
|
photon_total_time_ms=d.get('photon_total_time_ms', None),
|
|
2693
|
-
planning_phases=d.get('planning_phases', None),
|
|
2694
2745
|
planning_time_ms=d.get('planning_time_ms', None),
|
|
2695
2746
|
provisioning_queue_start_timestamp=d.get('provisioning_queue_start_timestamp', None),
|
|
2696
2747
|
pruned_bytes=d.get('pruned_bytes', None),
|
|
@@ -2848,6 +2899,20 @@ class RepeatedEndpointConfPairs:
|
|
|
2848
2899
|
configuration_pairs=_repeated_dict(d, 'configuration_pairs', EndpointConfPair))
|
|
2849
2900
|
|
|
2850
2901
|
|
|
2902
|
+
@dataclass
|
|
2903
|
+
class RestoreResponse:
|
|
2904
|
+
|
|
2905
|
+
def as_dict(self) -> dict:
|
|
2906
|
+
"""Serializes the RestoreResponse into a dictionary suitable for use as a JSON request body."""
|
|
2907
|
+
body = {}
|
|
2908
|
+
return body
|
|
2909
|
+
|
|
2910
|
+
@classmethod
|
|
2911
|
+
def from_dict(cls, d: Dict[str, any]) -> RestoreResponse:
|
|
2912
|
+
"""Deserializes the RestoreResponse from a dictionary."""
|
|
2913
|
+
return cls()
|
|
2914
|
+
|
|
2915
|
+
|
|
2851
2916
|
@dataclass
|
|
2852
2917
|
class ResultData:
|
|
2853
2918
|
"""Contains the result data of a single chunk when using `INLINE` disposition. When using
|
|
@@ -3131,6 +3196,20 @@ class SetWorkspaceWarehouseConfigRequestSecurityPolicy(Enum):
|
|
|
3131
3196
|
PASSTHROUGH = 'PASSTHROUGH'
|
|
3132
3197
|
|
|
3133
3198
|
|
|
3199
|
+
@dataclass
|
|
3200
|
+
class SetWorkspaceWarehouseConfigResponse:
|
|
3201
|
+
|
|
3202
|
+
def as_dict(self) -> dict:
|
|
3203
|
+
"""Serializes the SetWorkspaceWarehouseConfigResponse into a dictionary suitable for use as a JSON request body."""
|
|
3204
|
+
body = {}
|
|
3205
|
+
return body
|
|
3206
|
+
|
|
3207
|
+
@classmethod
|
|
3208
|
+
def from_dict(cls, d: Dict[str, any]) -> SetWorkspaceWarehouseConfigResponse:
|
|
3209
|
+
"""Deserializes the SetWorkspaceWarehouseConfigResponse from a dictionary."""
|
|
3210
|
+
return cls()
|
|
3211
|
+
|
|
3212
|
+
|
|
3134
3213
|
class SpotInstancePolicy(Enum):
|
|
3135
3214
|
"""Configurations whether the warehouse should use spot instances."""
|
|
3136
3215
|
|
|
@@ -3139,6 +3218,20 @@ class SpotInstancePolicy(Enum):
|
|
|
3139
3218
|
RELIABILITY_OPTIMIZED = 'RELIABILITY_OPTIMIZED'
|
|
3140
3219
|
|
|
3141
3220
|
|
|
3221
|
+
@dataclass
|
|
3222
|
+
class StartWarehouseResponse:
|
|
3223
|
+
|
|
3224
|
+
def as_dict(self) -> dict:
|
|
3225
|
+
"""Serializes the StartWarehouseResponse into a dictionary suitable for use as a JSON request body."""
|
|
3226
|
+
body = {}
|
|
3227
|
+
return body
|
|
3228
|
+
|
|
3229
|
+
@classmethod
|
|
3230
|
+
def from_dict(cls, d: Dict[str, any]) -> StartWarehouseResponse:
|
|
3231
|
+
"""Deserializes the StartWarehouseResponse from a dictionary."""
|
|
3232
|
+
return cls()
|
|
3233
|
+
|
|
3234
|
+
|
|
3142
3235
|
class State(Enum):
|
|
3143
3236
|
"""State of the warehouse"""
|
|
3144
3237
|
|
|
@@ -3228,6 +3321,20 @@ class Status(Enum):
|
|
|
3228
3321
|
STATUS_UNSPECIFIED = 'STATUS_UNSPECIFIED'
|
|
3229
3322
|
|
|
3230
3323
|
|
|
3324
|
+
@dataclass
|
|
3325
|
+
class StopWarehouseResponse:
|
|
3326
|
+
|
|
3327
|
+
def as_dict(self) -> dict:
|
|
3328
|
+
"""Serializes the StopWarehouseResponse into a dictionary suitable for use as a JSON request body."""
|
|
3329
|
+
body = {}
|
|
3330
|
+
return body
|
|
3331
|
+
|
|
3332
|
+
@classmethod
|
|
3333
|
+
def from_dict(cls, d: Dict[str, any]) -> StopWarehouseResponse:
|
|
3334
|
+
"""Deserializes the StopWarehouseResponse from a dictionary."""
|
|
3335
|
+
return cls()
|
|
3336
|
+
|
|
3337
|
+
|
|
3231
3338
|
@dataclass
|
|
3232
3339
|
class Success:
|
|
3233
3340
|
message: Optional[SuccessMessage] = None
|
|
@@ -3407,6 +3514,20 @@ class TransferOwnershipObjectId:
|
|
|
3407
3514
|
return cls(new_owner=d.get('new_owner', None))
|
|
3408
3515
|
|
|
3409
3516
|
|
|
3517
|
+
@dataclass
|
|
3518
|
+
class UpdateResponse:
|
|
3519
|
+
|
|
3520
|
+
def as_dict(self) -> dict:
|
|
3521
|
+
"""Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body."""
|
|
3522
|
+
body = {}
|
|
3523
|
+
return body
|
|
3524
|
+
|
|
3525
|
+
@classmethod
|
|
3526
|
+
def from_dict(cls, d: Dict[str, any]) -> UpdateResponse:
|
|
3527
|
+
"""Deserializes the UpdateResponse from a dictionary."""
|
|
3528
|
+
return cls()
|
|
3529
|
+
|
|
3530
|
+
|
|
3410
3531
|
@dataclass
|
|
3411
3532
|
class User:
|
|
3412
3533
|
email: Optional[str] = None
|
|
@@ -5306,8 +5427,10 @@ class WarehousesAPI:
|
|
|
5306
5427
|
if warehouse_type is not None: body['warehouse_type'] = warehouse_type.value
|
|
5307
5428
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
5308
5429
|
|
|
5309
|
-
self._api.do('POST', f'/api/2.0/sql/warehouses/{id}/edit', body=body, headers=headers)
|
|
5310
|
-
return Wait(self.wait_get_warehouse_running,
|
|
5430
|
+
op_response = self._api.do('POST', f'/api/2.0/sql/warehouses/{id}/edit', body=body, headers=headers)
|
|
5431
|
+
return Wait(self.wait_get_warehouse_running,
|
|
5432
|
+
response=EditWarehouseResponse.from_dict(op_response),
|
|
5433
|
+
id=id)
|
|
5311
5434
|
|
|
5312
5435
|
def edit_and_wait(
|
|
5313
5436
|
self,
|
|
@@ -5526,8 +5649,10 @@ class WarehousesAPI:
|
|
|
5526
5649
|
|
|
5527
5650
|
headers = {'Accept': 'application/json', }
|
|
5528
5651
|
|
|
5529
|
-
self._api.do('POST', f'/api/2.0/sql/warehouses/{id}/start', headers=headers)
|
|
5530
|
-
return Wait(self.wait_get_warehouse_running,
|
|
5652
|
+
op_response = self._api.do('POST', f'/api/2.0/sql/warehouses/{id}/start', headers=headers)
|
|
5653
|
+
return Wait(self.wait_get_warehouse_running,
|
|
5654
|
+
response=StartWarehouseResponse.from_dict(op_response),
|
|
5655
|
+
id=id)
|
|
5531
5656
|
|
|
5532
5657
|
def start_and_wait(self, id: str, timeout=timedelta(minutes=20)) -> GetWarehouseResponse:
|
|
5533
5658
|
return self.start(id=id).result(timeout=timeout)
|
|
@@ -5547,8 +5672,10 @@ class WarehousesAPI:
|
|
|
5547
5672
|
|
|
5548
5673
|
headers = {'Accept': 'application/json', }
|
|
5549
5674
|
|
|
5550
|
-
self._api.do('POST', f'/api/2.0/sql/warehouses/{id}/stop', headers=headers)
|
|
5551
|
-
return Wait(self.wait_get_warehouse_stopped,
|
|
5675
|
+
op_response = self._api.do('POST', f'/api/2.0/sql/warehouses/{id}/stop', headers=headers)
|
|
5676
|
+
return Wait(self.wait_get_warehouse_stopped,
|
|
5677
|
+
response=StopWarehouseResponse.from_dict(op_response),
|
|
5678
|
+
id=id)
|
|
5552
5679
|
|
|
5553
5680
|
def stop_and_wait(self, id: str, timeout=timedelta(minutes=20)) -> GetWarehouseResponse:
|
|
5554
5681
|
return self.stop(id=id).result(timeout=timeout)
|
|
@@ -61,6 +61,9 @@ class CreateVectorIndexRequest:
|
|
|
61
61
|
name: str
|
|
62
62
|
"""Name of the index"""
|
|
63
63
|
|
|
64
|
+
endpoint_name: str
|
|
65
|
+
"""Name of the endpoint to be used for serving the index"""
|
|
66
|
+
|
|
64
67
|
primary_key: str
|
|
65
68
|
"""Primary key of the index"""
|
|
66
69
|
|
|
@@ -78,9 +81,6 @@ class CreateVectorIndexRequest:
|
|
|
78
81
|
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None
|
|
79
82
|
"""Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`."""
|
|
80
83
|
|
|
81
|
-
endpoint_name: Optional[str] = None
|
|
82
|
-
"""Name of the endpoint to be used for serving the index"""
|
|
83
|
-
|
|
84
84
|
def as_dict(self) -> dict:
|
|
85
85
|
"""Serializes the CreateVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
86
86
|
body = {}
|
|
@@ -161,20 +161,20 @@ class DeleteDataVectorIndexRequest:
|
|
|
161
161
|
primary_keys: List[str]
|
|
162
162
|
"""List of primary keys for the data to be deleted."""
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
index_name: Optional[str] = None
|
|
165
165
|
"""Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index."""
|
|
166
166
|
|
|
167
167
|
def as_dict(self) -> dict:
|
|
168
168
|
"""Serializes the DeleteDataVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
169
169
|
body = {}
|
|
170
|
-
if self.
|
|
170
|
+
if self.index_name is not None: body['index_name'] = self.index_name
|
|
171
171
|
if self.primary_keys: body['primary_keys'] = [v for v in self.primary_keys]
|
|
172
172
|
return body
|
|
173
173
|
|
|
174
174
|
@classmethod
|
|
175
175
|
def from_dict(cls, d: Dict[str, any]) -> DeleteDataVectorIndexRequest:
|
|
176
176
|
"""Deserializes the DeleteDataVectorIndexRequest from a dictionary."""
|
|
177
|
-
return cls(
|
|
177
|
+
return cls(index_name=d.get('index_name', None), primary_keys=d.get('primary_keys', None))
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
@dataclass
|
|
@@ -201,6 +201,34 @@ class DeleteDataVectorIndexResponse:
|
|
|
201
201
|
status=_enum(d, 'status', DeleteDataStatus))
|
|
202
202
|
|
|
203
203
|
|
|
204
|
+
@dataclass
|
|
205
|
+
class DeleteEndpointResponse:
|
|
206
|
+
|
|
207
|
+
def as_dict(self) -> dict:
|
|
208
|
+
"""Serializes the DeleteEndpointResponse into a dictionary suitable for use as a JSON request body."""
|
|
209
|
+
body = {}
|
|
210
|
+
return body
|
|
211
|
+
|
|
212
|
+
@classmethod
|
|
213
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteEndpointResponse:
|
|
214
|
+
"""Deserializes the DeleteEndpointResponse from a dictionary."""
|
|
215
|
+
return cls()
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@dataclass
|
|
219
|
+
class DeleteIndexResponse:
|
|
220
|
+
|
|
221
|
+
def as_dict(self) -> dict:
|
|
222
|
+
"""Serializes the DeleteIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
223
|
+
body = {}
|
|
224
|
+
return body
|
|
225
|
+
|
|
226
|
+
@classmethod
|
|
227
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteIndexResponse:
|
|
228
|
+
"""Deserializes the DeleteIndexResponse from a dictionary."""
|
|
229
|
+
return cls()
|
|
230
|
+
|
|
231
|
+
|
|
204
232
|
@dataclass
|
|
205
233
|
class DeltaSyncVectorIndexSpecRequest:
|
|
206
234
|
embedding_source_columns: Optional[List[EmbeddingSourceColumn]] = None
|
|
@@ -319,41 +347,25 @@ class DirectAccessVectorIndexSpec:
|
|
|
319
347
|
|
|
320
348
|
|
|
321
349
|
@dataclass
|
|
322
|
-
class
|
|
350
|
+
class EmbeddingSourceColumn:
|
|
323
351
|
embedding_model_endpoint_name: Optional[str] = None
|
|
324
352
|
"""Name of the embedding model endpoint"""
|
|
325
353
|
|
|
326
|
-
def as_dict(self) -> dict:
|
|
327
|
-
"""Serializes the EmbeddingConfig into a dictionary suitable for use as a JSON request body."""
|
|
328
|
-
body = {}
|
|
329
|
-
if self.embedding_model_endpoint_name is not None:
|
|
330
|
-
body['embedding_model_endpoint_name'] = self.embedding_model_endpoint_name
|
|
331
|
-
return body
|
|
332
|
-
|
|
333
|
-
@classmethod
|
|
334
|
-
def from_dict(cls, d: Dict[str, any]) -> EmbeddingConfig:
|
|
335
|
-
"""Deserializes the EmbeddingConfig from a dictionary."""
|
|
336
|
-
return cls(embedding_model_endpoint_name=d.get('embedding_model_endpoint_name', None))
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
@dataclass
|
|
340
|
-
class EmbeddingSourceColumn:
|
|
341
|
-
embedding_config: Optional[EmbeddingConfig] = None
|
|
342
|
-
|
|
343
354
|
name: Optional[str] = None
|
|
344
355
|
"""Name of the column"""
|
|
345
356
|
|
|
346
357
|
def as_dict(self) -> dict:
|
|
347
358
|
"""Serializes the EmbeddingSourceColumn into a dictionary suitable for use as a JSON request body."""
|
|
348
359
|
body = {}
|
|
349
|
-
if self.
|
|
360
|
+
if self.embedding_model_endpoint_name is not None:
|
|
361
|
+
body['embedding_model_endpoint_name'] = self.embedding_model_endpoint_name
|
|
350
362
|
if self.name is not None: body['name'] = self.name
|
|
351
363
|
return body
|
|
352
364
|
|
|
353
365
|
@classmethod
|
|
354
366
|
def from_dict(cls, d: Dict[str, any]) -> EmbeddingSourceColumn:
|
|
355
367
|
"""Deserializes the EmbeddingSourceColumn from a dictionary."""
|
|
356
|
-
return cls(
|
|
368
|
+
return cls(embedding_model_endpoint_name=d.get('embedding_model_endpoint_name', None),
|
|
357
369
|
name=d.get('name', None))
|
|
358
370
|
|
|
359
371
|
|
|
@@ -598,6 +610,9 @@ class QueryVectorIndexRequest:
|
|
|
598
610
|
"""Query vector. Required for Direct Vector Access Index and Delta Sync Index using self-managed
|
|
599
611
|
vectors."""
|
|
600
612
|
|
|
613
|
+
score_threshold: Optional[float] = None
|
|
614
|
+
"""Threshold for the approximate nearest neighbor search. Defaults to 0.0."""
|
|
615
|
+
|
|
601
616
|
def as_dict(self) -> dict:
|
|
602
617
|
"""Serializes the QueryVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
603
618
|
body = {}
|
|
@@ -607,6 +622,7 @@ class QueryVectorIndexRequest:
|
|
|
607
622
|
if self.num_results is not None: body['num_results'] = self.num_results
|
|
608
623
|
if self.query_text is not None: body['query_text'] = self.query_text
|
|
609
624
|
if self.query_vector: body['query_vector'] = [v for v in self.query_vector]
|
|
625
|
+
if self.score_threshold is not None: body['score_threshold'] = self.score_threshold
|
|
610
626
|
return body
|
|
611
627
|
|
|
612
628
|
@classmethod
|
|
@@ -617,7 +633,8 @@ class QueryVectorIndexRequest:
|
|
|
617
633
|
index_name=d.get('index_name', None),
|
|
618
634
|
num_results=d.get('num_results', None),
|
|
619
635
|
query_text=d.get('query_text', None),
|
|
620
|
-
query_vector=d.get('query_vector', None)
|
|
636
|
+
query_vector=d.get('query_vector', None),
|
|
637
|
+
score_threshold=d.get('score_threshold', None))
|
|
621
638
|
|
|
622
639
|
|
|
623
640
|
@dataclass
|
|
@@ -688,6 +705,20 @@ class ResultManifest:
|
|
|
688
705
|
return cls(column_count=d.get('column_count', None), columns=_repeated_dict(d, 'columns', ColumnInfo))
|
|
689
706
|
|
|
690
707
|
|
|
708
|
+
@dataclass
|
|
709
|
+
class SyncIndexResponse:
|
|
710
|
+
|
|
711
|
+
def as_dict(self) -> dict:
|
|
712
|
+
"""Serializes the SyncIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
713
|
+
body = {}
|
|
714
|
+
return body
|
|
715
|
+
|
|
716
|
+
@classmethod
|
|
717
|
+
def from_dict(cls, d: Dict[str, any]) -> SyncIndexResponse:
|
|
718
|
+
"""Deserializes the SyncIndexResponse from a dictionary."""
|
|
719
|
+
return cls()
|
|
720
|
+
|
|
721
|
+
|
|
691
722
|
@dataclass
|
|
692
723
|
class UpsertDataResult:
|
|
693
724
|
"""Result of the upsert or delete operation."""
|
|
@@ -727,20 +758,20 @@ class UpsertDataVectorIndexRequest:
|
|
|
727
758
|
inputs_json: str
|
|
728
759
|
"""JSON string representing the data to be upserted."""
|
|
729
760
|
|
|
730
|
-
|
|
761
|
+
index_name: Optional[str] = None
|
|
731
762
|
"""Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index."""
|
|
732
763
|
|
|
733
764
|
def as_dict(self) -> dict:
|
|
734
765
|
"""Serializes the UpsertDataVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
735
766
|
body = {}
|
|
767
|
+
if self.index_name is not None: body['index_name'] = self.index_name
|
|
736
768
|
if self.inputs_json is not None: body['inputs_json'] = self.inputs_json
|
|
737
|
-
if self.name is not None: body['name'] = self.name
|
|
738
769
|
return body
|
|
739
770
|
|
|
740
771
|
@classmethod
|
|
741
772
|
def from_dict(cls, d: Dict[str, any]) -> UpsertDataVectorIndexRequest:
|
|
742
773
|
"""Deserializes the UpsertDataVectorIndexRequest from a dictionary."""
|
|
743
|
-
return cls(
|
|
774
|
+
return cls(index_name=d.get('index_name', None), inputs_json=d.get('inputs_json', None))
|
|
744
775
|
|
|
745
776
|
|
|
746
777
|
@dataclass
|
|
@@ -772,9 +803,9 @@ class VectorIndex:
|
|
|
772
803
|
creator: Optional[str] = None
|
|
773
804
|
"""The user who created the index."""
|
|
774
805
|
|
|
775
|
-
|
|
806
|
+
delta_sync_index_spec: Optional[DeltaSyncVectorIndexSpecResponse] = None
|
|
776
807
|
|
|
777
|
-
|
|
808
|
+
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None
|
|
778
809
|
|
|
779
810
|
endpoint_name: Optional[str] = None
|
|
780
811
|
"""Name of the endpoint associated with the index"""
|
|
@@ -799,10 +830,9 @@ class VectorIndex:
|
|
|
799
830
|
"""Serializes the VectorIndex into a dictionary suitable for use as a JSON request body."""
|
|
800
831
|
body = {}
|
|
801
832
|
if self.creator is not None: body['creator'] = self.creator
|
|
802
|
-
if self.
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
body['direct_access_vector_index_spec'] = self.direct_access_vector_index_spec.as_dict()
|
|
833
|
+
if self.delta_sync_index_spec: body['delta_sync_index_spec'] = self.delta_sync_index_spec.as_dict()
|
|
834
|
+
if self.direct_access_index_spec:
|
|
835
|
+
body['direct_access_index_spec'] = self.direct_access_index_spec.as_dict()
|
|
806
836
|
if self.endpoint_name is not None: body['endpoint_name'] = self.endpoint_name
|
|
807
837
|
if self.index_type is not None: body['index_type'] = self.index_type.value
|
|
808
838
|
if self.name is not None: body['name'] = self.name
|
|
@@ -814,10 +844,10 @@ class VectorIndex:
|
|
|
814
844
|
def from_dict(cls, d: Dict[str, any]) -> VectorIndex:
|
|
815
845
|
"""Deserializes the VectorIndex from a dictionary."""
|
|
816
846
|
return cls(creator=d.get('creator', None),
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
847
|
+
delta_sync_index_spec=_from_dict(d, 'delta_sync_index_spec',
|
|
848
|
+
DeltaSyncVectorIndexSpecResponse),
|
|
849
|
+
direct_access_index_spec=_from_dict(d, 'direct_access_index_spec',
|
|
850
|
+
DirectAccessVectorIndexSpec),
|
|
821
851
|
endpoint_name=d.get('endpoint_name', None),
|
|
822
852
|
index_type=_enum(d, 'index_type', VectorIndexType),
|
|
823
853
|
name=d.get('name', None),
|
|
@@ -936,13 +966,11 @@ class VectorSearchEndpointsAPI:
|
|
|
936
966
|
timeout=timedelta(minutes=20)) -> EndpointInfo:
|
|
937
967
|
return self.create_endpoint(endpoint_type=endpoint_type, name=name).result(timeout=timeout)
|
|
938
968
|
|
|
939
|
-
def delete_endpoint(self, endpoint_name: str
|
|
969
|
+
def delete_endpoint(self, endpoint_name: str):
|
|
940
970
|
"""Delete an endpoint.
|
|
941
971
|
|
|
942
972
|
:param endpoint_name: str
|
|
943
973
|
Name of the endpoint
|
|
944
|
-
:param name: str
|
|
945
|
-
Name of the endpoint to delete
|
|
946
974
|
|
|
947
975
|
|
|
948
976
|
"""
|
|
@@ -1000,20 +1028,24 @@ class VectorSearchIndexesAPI:
|
|
|
1000
1028
|
def __init__(self, api_client):
|
|
1001
1029
|
self._api = api_client
|
|
1002
1030
|
|
|
1003
|
-
def create_index(
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1031
|
+
def create_index(
|
|
1032
|
+
self,
|
|
1033
|
+
name: str,
|
|
1034
|
+
endpoint_name: str,
|
|
1035
|
+
primary_key: str,
|
|
1036
|
+
index_type: VectorIndexType,
|
|
1037
|
+
*,
|
|
1038
|
+
delta_sync_index_spec: Optional[DeltaSyncVectorIndexSpecRequest] = None,
|
|
1039
|
+
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None
|
|
1040
|
+
) -> CreateVectorIndexResponse:
|
|
1011
1041
|
"""Create an index.
|
|
1012
1042
|
|
|
1013
1043
|
Create a new index.
|
|
1014
1044
|
|
|
1015
1045
|
:param name: str
|
|
1016
1046
|
Name of the index
|
|
1047
|
+
:param endpoint_name: str
|
|
1048
|
+
Name of the endpoint to be used for serving the index
|
|
1017
1049
|
:param primary_key: str
|
|
1018
1050
|
Primary key of the index
|
|
1019
1051
|
:param index_type: :class:`VectorIndexType`
|
|
@@ -1027,8 +1059,6 @@ class VectorSearchIndexesAPI:
|
|
|
1027
1059
|
Specification for Delta Sync Index. Required if `index_type` is `DELTA_SYNC`.
|
|
1028
1060
|
:param direct_access_index_spec: :class:`DirectAccessVectorIndexSpec` (optional)
|
|
1029
1061
|
Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`.
|
|
1030
|
-
:param endpoint_name: str (optional)
|
|
1031
|
-
Name of the endpoint to be used for serving the index
|
|
1032
1062
|
|
|
1033
1063
|
:returns: :class:`CreateVectorIndexResponse`
|
|
1034
1064
|
"""
|
|
@@ -1045,12 +1075,13 @@ class VectorSearchIndexesAPI:
|
|
|
1045
1075
|
res = self._api.do('POST', '/api/2.0/vector-search/indexes', body=body, headers=headers)
|
|
1046
1076
|
return CreateVectorIndexResponse.from_dict(res)
|
|
1047
1077
|
|
|
1048
|
-
def delete_data_vector_index(self,
|
|
1078
|
+
def delete_data_vector_index(self, index_name: str,
|
|
1079
|
+
primary_keys: List[str]) -> DeleteDataVectorIndexResponse:
|
|
1049
1080
|
"""Delete data from index.
|
|
1050
1081
|
|
|
1051
1082
|
Handles the deletion of data from a specified vector index.
|
|
1052
1083
|
|
|
1053
|
-
:param
|
|
1084
|
+
:param index_name: str
|
|
1054
1085
|
Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index.
|
|
1055
1086
|
:param primary_keys: List[str]
|
|
1056
1087
|
List of primary keys for the data to be deleted.
|
|
@@ -1062,7 +1093,7 @@ class VectorSearchIndexesAPI:
|
|
|
1062
1093
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1063
1094
|
|
|
1064
1095
|
res = self._api.do('POST',
|
|
1065
|
-
f'/api/2.0/vector-search/indexes/{
|
|
1096
|
+
f'/api/2.0/vector-search/indexes/{index_name}/delete-data',
|
|
1066
1097
|
body=body,
|
|
1067
1098
|
headers=headers)
|
|
1068
1099
|
return DeleteDataVectorIndexResponse.from_dict(res)
|
|
@@ -1135,7 +1166,8 @@ class VectorSearchIndexesAPI:
|
|
|
1135
1166
|
filters_json: Optional[str] = None,
|
|
1136
1167
|
num_results: Optional[int] = None,
|
|
1137
1168
|
query_text: Optional[str] = None,
|
|
1138
|
-
query_vector: Optional[List[float]] = None
|
|
1169
|
+
query_vector: Optional[List[float]] = None,
|
|
1170
|
+
score_threshold: Optional[float] = None) -> QueryVectorIndexResponse:
|
|
1139
1171
|
"""Query an index.
|
|
1140
1172
|
|
|
1141
1173
|
Query the specified vector index.
|
|
@@ -1157,6 +1189,8 @@ class VectorSearchIndexesAPI:
|
|
|
1157
1189
|
:param query_vector: List[float] (optional)
|
|
1158
1190
|
Query vector. Required for Direct Vector Access Index and Delta Sync Index using self-managed
|
|
1159
1191
|
vectors.
|
|
1192
|
+
:param score_threshold: float (optional)
|
|
1193
|
+
Threshold for the approximate nearest neighbor search. Defaults to 0.0.
|
|
1160
1194
|
|
|
1161
1195
|
:returns: :class:`QueryVectorIndexResponse`
|
|
1162
1196
|
"""
|
|
@@ -1166,6 +1200,7 @@ class VectorSearchIndexesAPI:
|
|
|
1166
1200
|
if num_results is not None: body['num_results'] = num_results
|
|
1167
1201
|
if query_text is not None: body['query_text'] = query_text
|
|
1168
1202
|
if query_vector is not None: body['query_vector'] = [v for v in query_vector]
|
|
1203
|
+
if score_threshold is not None: body['score_threshold'] = score_threshold
|
|
1169
1204
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1170
1205
|
|
|
1171
1206
|
res = self._api.do('POST',
|
|
@@ -1189,12 +1224,12 @@ class VectorSearchIndexesAPI:
|
|
|
1189
1224
|
|
|
1190
1225
|
self._api.do('POST', f'/api/2.0/vector-search/indexes/{index_name}/sync', headers=headers)
|
|
1191
1226
|
|
|
1192
|
-
def upsert_data_vector_index(self,
|
|
1227
|
+
def upsert_data_vector_index(self, index_name: str, inputs_json: str) -> UpsertDataVectorIndexResponse:
|
|
1193
1228
|
"""Upsert data into an index.
|
|
1194
1229
|
|
|
1195
1230
|
Handles the upserting of data into a specified vector index.
|
|
1196
1231
|
|
|
1197
|
-
:param
|
|
1232
|
+
:param index_name: str
|
|
1198
1233
|
Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index.
|
|
1199
1234
|
:param inputs_json: str
|
|
1200
1235
|
JSON string representing the data to be upserted.
|
|
@@ -1206,7 +1241,7 @@ class VectorSearchIndexesAPI:
|
|
|
1206
1241
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1207
1242
|
|
|
1208
1243
|
res = self._api.do('POST',
|
|
1209
|
-
f'/api/2.0/vector-search/indexes/{
|
|
1244
|
+
f'/api/2.0/vector-search/indexes/{index_name}/upsert-data',
|
|
1210
1245
|
body=body,
|
|
1211
1246
|
headers=headers)
|
|
1212
1247
|
return UpsertDataVectorIndexResponse.from_dict(res)
|