databricks-sdk 0.62.0__py3-none-any.whl → 0.63.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 +15 -2
- databricks/sdk/service/apps.py +0 -4
- databricks/sdk/service/catalog.py +791 -22
- databricks/sdk/service/cleanrooms.py +21 -14
- databricks/sdk/service/compute.py +14 -0
- databricks/sdk/service/database.py +195 -2
- databricks/sdk/service/jobs.py +27 -0
- databricks/sdk/service/ml.py +3 -4
- databricks/sdk/service/serving.py +22 -0
- databricks/sdk/service/settings.py +36 -1
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.62.0.dist-info → databricks_sdk-0.63.0.dist-info}/METADATA +1 -1
- {databricks_sdk-0.62.0.dist-info → databricks_sdk-0.63.0.dist-info}/RECORD +17 -17
- {databricks_sdk-0.62.0.dist-info → databricks_sdk-0.63.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.62.0.dist-info → databricks_sdk-0.63.0.dist-info}/licenses/LICENSE +0 -0
- {databricks_sdk-0.62.0.dist-info → databricks_sdk-0.63.0.dist-info}/licenses/NOTICE +0 -0
- {databricks_sdk-0.62.0.dist-info → databricks_sdk-0.63.0.dist-info}/top_level.txt +0 -0
|
@@ -1138,6 +1138,55 @@ class ColumnMask:
|
|
|
1138
1138
|
return cls(function_name=d.get("function_name", None), using_column_names=d.get("using_column_names", None))
|
|
1139
1139
|
|
|
1140
1140
|
|
|
1141
|
+
@dataclass
|
|
1142
|
+
class ColumnMaskOptions:
|
|
1143
|
+
function_name: str
|
|
1144
|
+
"""The fully qualified name of the column mask function. The function is called on each row of the
|
|
1145
|
+
target table. The function's first argument and its return type should match the type of the
|
|
1146
|
+
masked column. Required on create and update."""
|
|
1147
|
+
|
|
1148
|
+
on_column: str
|
|
1149
|
+
"""The alias of the column to be masked. The alias must refer to one of matched columns. The values
|
|
1150
|
+
of the column is passed to the column mask function as the first argument. Required on create
|
|
1151
|
+
and update."""
|
|
1152
|
+
|
|
1153
|
+
using: Optional[List[FunctionArgument]] = None
|
|
1154
|
+
"""Optional list of column aliases or constant literals to be passed as additional arguments to the
|
|
1155
|
+
column mask function. The type of each column should match the positional argument of the column
|
|
1156
|
+
mask function."""
|
|
1157
|
+
|
|
1158
|
+
def as_dict(self) -> dict:
|
|
1159
|
+
"""Serializes the ColumnMaskOptions into a dictionary suitable for use as a JSON request body."""
|
|
1160
|
+
body = {}
|
|
1161
|
+
if self.function_name is not None:
|
|
1162
|
+
body["function_name"] = self.function_name
|
|
1163
|
+
if self.on_column is not None:
|
|
1164
|
+
body["on_column"] = self.on_column
|
|
1165
|
+
if self.using:
|
|
1166
|
+
body["using"] = [v.as_dict() for v in self.using]
|
|
1167
|
+
return body
|
|
1168
|
+
|
|
1169
|
+
def as_shallow_dict(self) -> dict:
|
|
1170
|
+
"""Serializes the ColumnMaskOptions into a shallow dictionary of its immediate attributes."""
|
|
1171
|
+
body = {}
|
|
1172
|
+
if self.function_name is not None:
|
|
1173
|
+
body["function_name"] = self.function_name
|
|
1174
|
+
if self.on_column is not None:
|
|
1175
|
+
body["on_column"] = self.on_column
|
|
1176
|
+
if self.using:
|
|
1177
|
+
body["using"] = self.using
|
|
1178
|
+
return body
|
|
1179
|
+
|
|
1180
|
+
@classmethod
|
|
1181
|
+
def from_dict(cls, d: Dict[str, Any]) -> ColumnMaskOptions:
|
|
1182
|
+
"""Deserializes the ColumnMaskOptions from a dictionary."""
|
|
1183
|
+
return cls(
|
|
1184
|
+
function_name=d.get("function_name", None),
|
|
1185
|
+
on_column=d.get("on_column", None),
|
|
1186
|
+
using=_repeated_dict(d, "using", FunctionArgument),
|
|
1187
|
+
)
|
|
1188
|
+
|
|
1189
|
+
|
|
1141
1190
|
@dataclass
|
|
1142
1191
|
class ColumnRelationship:
|
|
1143
1192
|
source: Optional[str] = None
|
|
@@ -2378,6 +2427,24 @@ class DeleteMonitorResponse:
|
|
|
2378
2427
|
return cls()
|
|
2379
2428
|
|
|
2380
2429
|
|
|
2430
|
+
@dataclass
|
|
2431
|
+
class DeletePolicyResponse:
|
|
2432
|
+
def as_dict(self) -> dict:
|
|
2433
|
+
"""Serializes the DeletePolicyResponse into a dictionary suitable for use as a JSON request body."""
|
|
2434
|
+
body = {}
|
|
2435
|
+
return body
|
|
2436
|
+
|
|
2437
|
+
def as_shallow_dict(self) -> dict:
|
|
2438
|
+
"""Serializes the DeletePolicyResponse into a shallow dictionary of its immediate attributes."""
|
|
2439
|
+
body = {}
|
|
2440
|
+
return body
|
|
2441
|
+
|
|
2442
|
+
@classmethod
|
|
2443
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeletePolicyResponse:
|
|
2444
|
+
"""Deserializes the DeletePolicyResponse from a dictionary."""
|
|
2445
|
+
return cls()
|
|
2446
|
+
|
|
2447
|
+
|
|
2381
2448
|
@dataclass
|
|
2382
2449
|
class DeleteRequestExternalLineage:
|
|
2383
2450
|
source: ExternalLineageObject
|
|
@@ -3830,6 +3897,38 @@ class ForeignKeyConstraint:
|
|
|
3830
3897
|
)
|
|
3831
3898
|
|
|
3832
3899
|
|
|
3900
|
+
@dataclass
|
|
3901
|
+
class FunctionArgument:
|
|
3902
|
+
alias: Optional[str] = None
|
|
3903
|
+
"""The alias of a matched column."""
|
|
3904
|
+
|
|
3905
|
+
constant: Optional[str] = None
|
|
3906
|
+
"""A constant literal."""
|
|
3907
|
+
|
|
3908
|
+
def as_dict(self) -> dict:
|
|
3909
|
+
"""Serializes the FunctionArgument into a dictionary suitable for use as a JSON request body."""
|
|
3910
|
+
body = {}
|
|
3911
|
+
if self.alias is not None:
|
|
3912
|
+
body["alias"] = self.alias
|
|
3913
|
+
if self.constant is not None:
|
|
3914
|
+
body["constant"] = self.constant
|
|
3915
|
+
return body
|
|
3916
|
+
|
|
3917
|
+
def as_shallow_dict(self) -> dict:
|
|
3918
|
+
"""Serializes the FunctionArgument into a shallow dictionary of its immediate attributes."""
|
|
3919
|
+
body = {}
|
|
3920
|
+
if self.alias is not None:
|
|
3921
|
+
body["alias"] = self.alias
|
|
3922
|
+
if self.constant is not None:
|
|
3923
|
+
body["constant"] = self.constant
|
|
3924
|
+
return body
|
|
3925
|
+
|
|
3926
|
+
@classmethod
|
|
3927
|
+
def from_dict(cls, d: Dict[str, Any]) -> FunctionArgument:
|
|
3928
|
+
"""Deserializes the FunctionArgument from a dictionary."""
|
|
3929
|
+
return cls(alias=d.get("alias", None), constant=d.get("constant", None))
|
|
3930
|
+
|
|
3931
|
+
|
|
3833
3932
|
@dataclass
|
|
3834
3933
|
class FunctionDependency:
|
|
3835
3934
|
"""A function that is dependent on a SQL object."""
|
|
@@ -4362,6 +4461,77 @@ class GcpPubsub:
|
|
|
4362
4461
|
)
|
|
4363
4462
|
|
|
4364
4463
|
|
|
4464
|
+
@dataclass
|
|
4465
|
+
class GenerateTemporaryPathCredentialResponse:
|
|
4466
|
+
aws_temp_credentials: Optional[AwsCredentials] = None
|
|
4467
|
+
|
|
4468
|
+
azure_aad: Optional[AzureActiveDirectoryToken] = None
|
|
4469
|
+
|
|
4470
|
+
azure_user_delegation_sas: Optional[AzureUserDelegationSas] = None
|
|
4471
|
+
|
|
4472
|
+
expiration_time: Optional[int] = None
|
|
4473
|
+
"""Server time when the credential will expire, in epoch milliseconds. The API client is advised to
|
|
4474
|
+
cache the credential given this expiration time."""
|
|
4475
|
+
|
|
4476
|
+
gcp_oauth_token: Optional[GcpOauthToken] = None
|
|
4477
|
+
|
|
4478
|
+
r2_temp_credentials: Optional[R2Credentials] = None
|
|
4479
|
+
|
|
4480
|
+
url: Optional[str] = None
|
|
4481
|
+
"""The URL of the storage path accessible by the temporary credential."""
|
|
4482
|
+
|
|
4483
|
+
def as_dict(self) -> dict:
|
|
4484
|
+
"""Serializes the GenerateTemporaryPathCredentialResponse into a dictionary suitable for use as a JSON request body."""
|
|
4485
|
+
body = {}
|
|
4486
|
+
if self.aws_temp_credentials:
|
|
4487
|
+
body["aws_temp_credentials"] = self.aws_temp_credentials.as_dict()
|
|
4488
|
+
if self.azure_aad:
|
|
4489
|
+
body["azure_aad"] = self.azure_aad.as_dict()
|
|
4490
|
+
if self.azure_user_delegation_sas:
|
|
4491
|
+
body["azure_user_delegation_sas"] = self.azure_user_delegation_sas.as_dict()
|
|
4492
|
+
if self.expiration_time is not None:
|
|
4493
|
+
body["expiration_time"] = self.expiration_time
|
|
4494
|
+
if self.gcp_oauth_token:
|
|
4495
|
+
body["gcp_oauth_token"] = self.gcp_oauth_token.as_dict()
|
|
4496
|
+
if self.r2_temp_credentials:
|
|
4497
|
+
body["r2_temp_credentials"] = self.r2_temp_credentials.as_dict()
|
|
4498
|
+
if self.url is not None:
|
|
4499
|
+
body["url"] = self.url
|
|
4500
|
+
return body
|
|
4501
|
+
|
|
4502
|
+
def as_shallow_dict(self) -> dict:
|
|
4503
|
+
"""Serializes the GenerateTemporaryPathCredentialResponse into a shallow dictionary of its immediate attributes."""
|
|
4504
|
+
body = {}
|
|
4505
|
+
if self.aws_temp_credentials:
|
|
4506
|
+
body["aws_temp_credentials"] = self.aws_temp_credentials
|
|
4507
|
+
if self.azure_aad:
|
|
4508
|
+
body["azure_aad"] = self.azure_aad
|
|
4509
|
+
if self.azure_user_delegation_sas:
|
|
4510
|
+
body["azure_user_delegation_sas"] = self.azure_user_delegation_sas
|
|
4511
|
+
if self.expiration_time is not None:
|
|
4512
|
+
body["expiration_time"] = self.expiration_time
|
|
4513
|
+
if self.gcp_oauth_token:
|
|
4514
|
+
body["gcp_oauth_token"] = self.gcp_oauth_token
|
|
4515
|
+
if self.r2_temp_credentials:
|
|
4516
|
+
body["r2_temp_credentials"] = self.r2_temp_credentials
|
|
4517
|
+
if self.url is not None:
|
|
4518
|
+
body["url"] = self.url
|
|
4519
|
+
return body
|
|
4520
|
+
|
|
4521
|
+
@classmethod
|
|
4522
|
+
def from_dict(cls, d: Dict[str, Any]) -> GenerateTemporaryPathCredentialResponse:
|
|
4523
|
+
"""Deserializes the GenerateTemporaryPathCredentialResponse from a dictionary."""
|
|
4524
|
+
return cls(
|
|
4525
|
+
aws_temp_credentials=_from_dict(d, "aws_temp_credentials", AwsCredentials),
|
|
4526
|
+
azure_aad=_from_dict(d, "azure_aad", AzureActiveDirectoryToken),
|
|
4527
|
+
azure_user_delegation_sas=_from_dict(d, "azure_user_delegation_sas", AzureUserDelegationSas),
|
|
4528
|
+
expiration_time=d.get("expiration_time", None),
|
|
4529
|
+
gcp_oauth_token=_from_dict(d, "gcp_oauth_token", GcpOauthToken),
|
|
4530
|
+
r2_temp_credentials=_from_dict(d, "r2_temp_credentials", R2Credentials),
|
|
4531
|
+
url=d.get("url", None),
|
|
4532
|
+
)
|
|
4533
|
+
|
|
4534
|
+
|
|
4365
4535
|
@dataclass
|
|
4366
4536
|
class GenerateTemporaryServiceCredentialAzureOptions:
|
|
4367
4537
|
"""The Azure cloud options to customize the requested temporary credential"""
|
|
@@ -5162,6 +5332,39 @@ class ListModelVersionsResponse:
|
|
|
5162
5332
|
)
|
|
5163
5333
|
|
|
5164
5334
|
|
|
5335
|
+
@dataclass
|
|
5336
|
+
class ListPoliciesResponse:
|
|
5337
|
+
next_page_token: Optional[str] = None
|
|
5338
|
+
"""Optional opaque token for continuing pagination. `page_token` should be set to this value for
|
|
5339
|
+
the next request to retrieve the next page of results."""
|
|
5340
|
+
|
|
5341
|
+
policies: Optional[List[PolicyInfo]] = None
|
|
5342
|
+
"""The list of retrieved policies."""
|
|
5343
|
+
|
|
5344
|
+
def as_dict(self) -> dict:
|
|
5345
|
+
"""Serializes the ListPoliciesResponse into a dictionary suitable for use as a JSON request body."""
|
|
5346
|
+
body = {}
|
|
5347
|
+
if self.next_page_token is not None:
|
|
5348
|
+
body["next_page_token"] = self.next_page_token
|
|
5349
|
+
if self.policies:
|
|
5350
|
+
body["policies"] = [v.as_dict() for v in self.policies]
|
|
5351
|
+
return body
|
|
5352
|
+
|
|
5353
|
+
def as_shallow_dict(self) -> dict:
|
|
5354
|
+
"""Serializes the ListPoliciesResponse into a shallow dictionary of its immediate attributes."""
|
|
5355
|
+
body = {}
|
|
5356
|
+
if self.next_page_token is not None:
|
|
5357
|
+
body["next_page_token"] = self.next_page_token
|
|
5358
|
+
if self.policies:
|
|
5359
|
+
body["policies"] = self.policies
|
|
5360
|
+
return body
|
|
5361
|
+
|
|
5362
|
+
@classmethod
|
|
5363
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListPoliciesResponse:
|
|
5364
|
+
"""Deserializes the ListPoliciesResponse from a dictionary."""
|
|
5365
|
+
return cls(next_page_token=d.get("next_page_token", None), policies=_repeated_dict(d, "policies", PolicyInfo))
|
|
5366
|
+
|
|
5367
|
+
|
|
5165
5368
|
@dataclass
|
|
5166
5369
|
class ListQuotasResponse:
|
|
5167
5370
|
next_page_token: Optional[str] = None
|
|
@@ -5432,6 +5635,38 @@ class ListVolumesResponseContent:
|
|
|
5432
5635
|
return cls(next_page_token=d.get("next_page_token", None), volumes=_repeated_dict(d, "volumes", VolumeInfo))
|
|
5433
5636
|
|
|
5434
5637
|
|
|
5638
|
+
@dataclass
|
|
5639
|
+
class MatchColumn:
|
|
5640
|
+
alias: Optional[str] = None
|
|
5641
|
+
"""Optional alias of the matched column."""
|
|
5642
|
+
|
|
5643
|
+
condition: Optional[str] = None
|
|
5644
|
+
"""The condition expression used to match a table column."""
|
|
5645
|
+
|
|
5646
|
+
def as_dict(self) -> dict:
|
|
5647
|
+
"""Serializes the MatchColumn into a dictionary suitable for use as a JSON request body."""
|
|
5648
|
+
body = {}
|
|
5649
|
+
if self.alias is not None:
|
|
5650
|
+
body["alias"] = self.alias
|
|
5651
|
+
if self.condition is not None:
|
|
5652
|
+
body["condition"] = self.condition
|
|
5653
|
+
return body
|
|
5654
|
+
|
|
5655
|
+
def as_shallow_dict(self) -> dict:
|
|
5656
|
+
"""Serializes the MatchColumn into a shallow dictionary of its immediate attributes."""
|
|
5657
|
+
body = {}
|
|
5658
|
+
if self.alias is not None:
|
|
5659
|
+
body["alias"] = self.alias
|
|
5660
|
+
if self.condition is not None:
|
|
5661
|
+
body["condition"] = self.condition
|
|
5662
|
+
return body
|
|
5663
|
+
|
|
5664
|
+
@classmethod
|
|
5665
|
+
def from_dict(cls, d: Dict[str, Any]) -> MatchColumn:
|
|
5666
|
+
"""Deserializes the MatchColumn from a dictionary."""
|
|
5667
|
+
return cls(alias=d.get("alias", None), condition=d.get("condition", None))
|
|
5668
|
+
|
|
5669
|
+
|
|
5435
5670
|
class MatchType(Enum):
|
|
5436
5671
|
"""The artifact pattern matching type"""
|
|
5437
5672
|
|
|
@@ -6954,6 +7189,13 @@ class OptionSpecOptionType(Enum):
|
|
|
6954
7189
|
OPTION_STRING = "OPTION_STRING"
|
|
6955
7190
|
|
|
6956
7191
|
|
|
7192
|
+
class PathOperation(Enum):
|
|
7193
|
+
|
|
7194
|
+
PATH_CREATE_TABLE = "PATH_CREATE_TABLE"
|
|
7195
|
+
PATH_READ = "PATH_READ"
|
|
7196
|
+
PATH_READ_WRITE = "PATH_READ_WRITE"
|
|
7197
|
+
|
|
7198
|
+
|
|
6957
7199
|
@dataclass
|
|
6958
7200
|
class PermissionsChange:
|
|
6959
7201
|
add: Optional[List[Privilege]] = None
|
|
@@ -7060,6 +7302,178 @@ class PipelineProgress:
|
|
|
7060
7302
|
)
|
|
7061
7303
|
|
|
7062
7304
|
|
|
7305
|
+
@dataclass
|
|
7306
|
+
class PolicyInfo:
|
|
7307
|
+
to_principals: List[str]
|
|
7308
|
+
"""List of user or group names that the policy applies to. Required on create and optional on
|
|
7309
|
+
update."""
|
|
7310
|
+
|
|
7311
|
+
for_securable_type: SecurableType
|
|
7312
|
+
"""Type of securables that the policy should take effect on. Only `table` is supported at this
|
|
7313
|
+
moment. Required on create and optional on update."""
|
|
7314
|
+
|
|
7315
|
+
policy_type: PolicyType
|
|
7316
|
+
"""Type of the policy. Required on create and ignored on update."""
|
|
7317
|
+
|
|
7318
|
+
column_mask: Optional[ColumnMaskOptions] = None
|
|
7319
|
+
"""Options for column mask policies. Valid only if `policy_type` is `POLICY_TYPE_COLUMN_MASK`.
|
|
7320
|
+
Required on create and optional on update. When specified on update, the new options will
|
|
7321
|
+
replace the existing options as a whole."""
|
|
7322
|
+
|
|
7323
|
+
comment: Optional[str] = None
|
|
7324
|
+
"""Optional description of the policy."""
|
|
7325
|
+
|
|
7326
|
+
created_at: Optional[int] = None
|
|
7327
|
+
"""Time at which the policy was created, in epoch milliseconds. Output only."""
|
|
7328
|
+
|
|
7329
|
+
created_by: Optional[str] = None
|
|
7330
|
+
"""Username of the user who created the policy. Output only."""
|
|
7331
|
+
|
|
7332
|
+
except_principals: Optional[List[str]] = None
|
|
7333
|
+
"""Optional list of user or group names that should be excluded from the policy."""
|
|
7334
|
+
|
|
7335
|
+
id: Optional[str] = None
|
|
7336
|
+
"""Unique identifier of the policy. This field is output only and is generated by the system."""
|
|
7337
|
+
|
|
7338
|
+
match_columns: Optional[List[MatchColumn]] = None
|
|
7339
|
+
"""Optional list of condition expressions used to match table columns. Only valid when
|
|
7340
|
+
`for_securable_type` is `table`. When specified, the policy only applies to tables whose columns
|
|
7341
|
+
satisfy all match conditions."""
|
|
7342
|
+
|
|
7343
|
+
name: Optional[str] = None
|
|
7344
|
+
"""Name of the policy. Required on create and ignored on update. To update the name, use the
|
|
7345
|
+
`new_name` field."""
|
|
7346
|
+
|
|
7347
|
+
on_securable_fullname: Optional[str] = None
|
|
7348
|
+
"""Full name of the securable on which the policy is defined. Required on create and ignored on
|
|
7349
|
+
update."""
|
|
7350
|
+
|
|
7351
|
+
on_securable_type: Optional[SecurableType] = None
|
|
7352
|
+
"""Type of the securable on which the policy is defined. Only `catalog`, `schema` and `table` are
|
|
7353
|
+
supported at this moment. Required on create and ignored on update."""
|
|
7354
|
+
|
|
7355
|
+
row_filter: Optional[RowFilterOptions] = None
|
|
7356
|
+
"""Options for row filter policies. Valid only if `policy_type` is `POLICY_TYPE_ROW_FILTER`.
|
|
7357
|
+
Required on create and optional on update. When specified on update, the new options will
|
|
7358
|
+
replace the existing options as a whole."""
|
|
7359
|
+
|
|
7360
|
+
updated_at: Optional[int] = None
|
|
7361
|
+
"""Time at which the policy was last modified, in epoch milliseconds. Output only."""
|
|
7362
|
+
|
|
7363
|
+
updated_by: Optional[str] = None
|
|
7364
|
+
"""Username of the user who last modified the policy. Output only."""
|
|
7365
|
+
|
|
7366
|
+
when_condition: Optional[str] = None
|
|
7367
|
+
"""Optional condition when the policy should take effect."""
|
|
7368
|
+
|
|
7369
|
+
def as_dict(self) -> dict:
|
|
7370
|
+
"""Serializes the PolicyInfo into a dictionary suitable for use as a JSON request body."""
|
|
7371
|
+
body = {}
|
|
7372
|
+
if self.column_mask:
|
|
7373
|
+
body["column_mask"] = self.column_mask.as_dict()
|
|
7374
|
+
if self.comment is not None:
|
|
7375
|
+
body["comment"] = self.comment
|
|
7376
|
+
if self.created_at is not None:
|
|
7377
|
+
body["created_at"] = self.created_at
|
|
7378
|
+
if self.created_by is not None:
|
|
7379
|
+
body["created_by"] = self.created_by
|
|
7380
|
+
if self.except_principals:
|
|
7381
|
+
body["except_principals"] = [v for v in self.except_principals]
|
|
7382
|
+
if self.for_securable_type is not None:
|
|
7383
|
+
body["for_securable_type"] = self.for_securable_type.value
|
|
7384
|
+
if self.id is not None:
|
|
7385
|
+
body["id"] = self.id
|
|
7386
|
+
if self.match_columns:
|
|
7387
|
+
body["match_columns"] = [v.as_dict() for v in self.match_columns]
|
|
7388
|
+
if self.name is not None:
|
|
7389
|
+
body["name"] = self.name
|
|
7390
|
+
if self.on_securable_fullname is not None:
|
|
7391
|
+
body["on_securable_fullname"] = self.on_securable_fullname
|
|
7392
|
+
if self.on_securable_type is not None:
|
|
7393
|
+
body["on_securable_type"] = self.on_securable_type.value
|
|
7394
|
+
if self.policy_type is not None:
|
|
7395
|
+
body["policy_type"] = self.policy_type.value
|
|
7396
|
+
if self.row_filter:
|
|
7397
|
+
body["row_filter"] = self.row_filter.as_dict()
|
|
7398
|
+
if self.to_principals:
|
|
7399
|
+
body["to_principals"] = [v for v in self.to_principals]
|
|
7400
|
+
if self.updated_at is not None:
|
|
7401
|
+
body["updated_at"] = self.updated_at
|
|
7402
|
+
if self.updated_by is not None:
|
|
7403
|
+
body["updated_by"] = self.updated_by
|
|
7404
|
+
if self.when_condition is not None:
|
|
7405
|
+
body["when_condition"] = self.when_condition
|
|
7406
|
+
return body
|
|
7407
|
+
|
|
7408
|
+
def as_shallow_dict(self) -> dict:
|
|
7409
|
+
"""Serializes the PolicyInfo into a shallow dictionary of its immediate attributes."""
|
|
7410
|
+
body = {}
|
|
7411
|
+
if self.column_mask:
|
|
7412
|
+
body["column_mask"] = self.column_mask
|
|
7413
|
+
if self.comment is not None:
|
|
7414
|
+
body["comment"] = self.comment
|
|
7415
|
+
if self.created_at is not None:
|
|
7416
|
+
body["created_at"] = self.created_at
|
|
7417
|
+
if self.created_by is not None:
|
|
7418
|
+
body["created_by"] = self.created_by
|
|
7419
|
+
if self.except_principals:
|
|
7420
|
+
body["except_principals"] = self.except_principals
|
|
7421
|
+
if self.for_securable_type is not None:
|
|
7422
|
+
body["for_securable_type"] = self.for_securable_type
|
|
7423
|
+
if self.id is not None:
|
|
7424
|
+
body["id"] = self.id
|
|
7425
|
+
if self.match_columns:
|
|
7426
|
+
body["match_columns"] = self.match_columns
|
|
7427
|
+
if self.name is not None:
|
|
7428
|
+
body["name"] = self.name
|
|
7429
|
+
if self.on_securable_fullname is not None:
|
|
7430
|
+
body["on_securable_fullname"] = self.on_securable_fullname
|
|
7431
|
+
if self.on_securable_type is not None:
|
|
7432
|
+
body["on_securable_type"] = self.on_securable_type
|
|
7433
|
+
if self.policy_type is not None:
|
|
7434
|
+
body["policy_type"] = self.policy_type
|
|
7435
|
+
if self.row_filter:
|
|
7436
|
+
body["row_filter"] = self.row_filter
|
|
7437
|
+
if self.to_principals:
|
|
7438
|
+
body["to_principals"] = self.to_principals
|
|
7439
|
+
if self.updated_at is not None:
|
|
7440
|
+
body["updated_at"] = self.updated_at
|
|
7441
|
+
if self.updated_by is not None:
|
|
7442
|
+
body["updated_by"] = self.updated_by
|
|
7443
|
+
if self.when_condition is not None:
|
|
7444
|
+
body["when_condition"] = self.when_condition
|
|
7445
|
+
return body
|
|
7446
|
+
|
|
7447
|
+
@classmethod
|
|
7448
|
+
def from_dict(cls, d: Dict[str, Any]) -> PolicyInfo:
|
|
7449
|
+
"""Deserializes the PolicyInfo from a dictionary."""
|
|
7450
|
+
return cls(
|
|
7451
|
+
column_mask=_from_dict(d, "column_mask", ColumnMaskOptions),
|
|
7452
|
+
comment=d.get("comment", None),
|
|
7453
|
+
created_at=d.get("created_at", None),
|
|
7454
|
+
created_by=d.get("created_by", None),
|
|
7455
|
+
except_principals=d.get("except_principals", None),
|
|
7456
|
+
for_securable_type=_enum(d, "for_securable_type", SecurableType),
|
|
7457
|
+
id=d.get("id", None),
|
|
7458
|
+
match_columns=_repeated_dict(d, "match_columns", MatchColumn),
|
|
7459
|
+
name=d.get("name", None),
|
|
7460
|
+
on_securable_fullname=d.get("on_securable_fullname", None),
|
|
7461
|
+
on_securable_type=_enum(d, "on_securable_type", SecurableType),
|
|
7462
|
+
policy_type=_enum(d, "policy_type", PolicyType),
|
|
7463
|
+
row_filter=_from_dict(d, "row_filter", RowFilterOptions),
|
|
7464
|
+
to_principals=d.get("to_principals", None),
|
|
7465
|
+
updated_at=d.get("updated_at", None),
|
|
7466
|
+
updated_by=d.get("updated_by", None),
|
|
7467
|
+
when_condition=d.get("when_condition", None),
|
|
7468
|
+
)
|
|
7469
|
+
|
|
7470
|
+
|
|
7471
|
+
class PolicyType(Enum):
|
|
7472
|
+
|
|
7473
|
+
POLICY_TYPE_COLUMN_MASK = "POLICY_TYPE_COLUMN_MASK"
|
|
7474
|
+
POLICY_TYPE_ROW_FILTER = "POLICY_TYPE_ROW_FILTER"
|
|
7475
|
+
|
|
7476
|
+
|
|
7063
7477
|
@dataclass
|
|
7064
7478
|
class PrimaryKeyConstraint:
|
|
7065
7479
|
name: str
|
|
@@ -7573,6 +7987,42 @@ class RegisteredModelInfo:
|
|
|
7573
7987
|
)
|
|
7574
7988
|
|
|
7575
7989
|
|
|
7990
|
+
@dataclass
|
|
7991
|
+
class RowFilterOptions:
|
|
7992
|
+
function_name: str
|
|
7993
|
+
"""The fully qualified name of the row filter function. The function is called on each row of the
|
|
7994
|
+
target table. It should return a boolean value indicating whether the row should be visible to
|
|
7995
|
+
the user. Required on create and update."""
|
|
7996
|
+
|
|
7997
|
+
using: Optional[List[FunctionArgument]] = None
|
|
7998
|
+
"""Optional list of column aliases or constant literals to be passed as arguments to the row filter
|
|
7999
|
+
function. The type of each column should match the positional argument of the row filter
|
|
8000
|
+
function."""
|
|
8001
|
+
|
|
8002
|
+
def as_dict(self) -> dict:
|
|
8003
|
+
"""Serializes the RowFilterOptions into a dictionary suitable for use as a JSON request body."""
|
|
8004
|
+
body = {}
|
|
8005
|
+
if self.function_name is not None:
|
|
8006
|
+
body["function_name"] = self.function_name
|
|
8007
|
+
if self.using:
|
|
8008
|
+
body["using"] = [v.as_dict() for v in self.using]
|
|
8009
|
+
return body
|
|
8010
|
+
|
|
8011
|
+
def as_shallow_dict(self) -> dict:
|
|
8012
|
+
"""Serializes the RowFilterOptions into a shallow dictionary of its immediate attributes."""
|
|
8013
|
+
body = {}
|
|
8014
|
+
if self.function_name is not None:
|
|
8015
|
+
body["function_name"] = self.function_name
|
|
8016
|
+
if self.using:
|
|
8017
|
+
body["using"] = self.using
|
|
8018
|
+
return body
|
|
8019
|
+
|
|
8020
|
+
@classmethod
|
|
8021
|
+
def from_dict(cls, d: Dict[str, Any]) -> RowFilterOptions:
|
|
8022
|
+
"""Deserializes the RowFilterOptions from a dictionary."""
|
|
8023
|
+
return cls(function_name=d.get("function_name", None), using=_repeated_dict(d, "using", FunctionArgument))
|
|
8024
|
+
|
|
8025
|
+
|
|
7576
8026
|
@dataclass
|
|
7577
8027
|
class SchemaInfo:
|
|
7578
8028
|
"""Next ID: 40"""
|
|
@@ -8113,7 +8563,7 @@ class SystemSchemaInfo:
|
|
|
8113
8563
|
state: str
|
|
8114
8564
|
"""The current state of enablement for the system schema. An empty string means the system schema
|
|
8115
8565
|
is available and ready for opt-in. Possible values: AVAILABLE | ENABLE_INITIALIZED |
|
|
8116
|
-
ENABLE_COMPLETED | DISABLE_INITIALIZED | UNAVAILABLE"""
|
|
8566
|
+
ENABLE_COMPLETED | DISABLE_INITIALIZED | UNAVAILABLE | MANAGED"""
|
|
8117
8567
|
|
|
8118
8568
|
def as_dict(self) -> dict:
|
|
8119
8569
|
"""Serializes the SystemSchemaInfo into a dictionary suitable for use as a JSON request body."""
|
|
@@ -12175,6 +12625,185 @@ class OnlineTablesAPI:
|
|
|
12175
12625
|
return OnlineTable.from_dict(res)
|
|
12176
12626
|
|
|
12177
12627
|
|
|
12628
|
+
class PoliciesAPI:
|
|
12629
|
+
"""Attribute-Based Access Control (ABAC) provides high leverage governance for enforcing compliance policies
|
|
12630
|
+
in Unity Catalog. With ABAC policies, access is controlled in a hierarchical and scalable manner, based on
|
|
12631
|
+
data attributes rather than specific resources, enabling more flexible and comprehensive access control.
|
|
12632
|
+
ABAC policies in Unity Catalog support conditions on securable properties, governance tags, and
|
|
12633
|
+
environment contexts. Callers must have the `MANAGE` privilege on a securable to view, create, update, or
|
|
12634
|
+
delete ABAC policies."""
|
|
12635
|
+
|
|
12636
|
+
def __init__(self, api_client):
|
|
12637
|
+
self._api = api_client
|
|
12638
|
+
|
|
12639
|
+
def create_policy(self, policy_info: PolicyInfo) -> PolicyInfo:
|
|
12640
|
+
"""Creates a new policy on a securable. The new policy applies to the securable and all its descendants.
|
|
12641
|
+
|
|
12642
|
+
:param policy_info: :class:`PolicyInfo`
|
|
12643
|
+
Required. The policy to create.
|
|
12644
|
+
|
|
12645
|
+
:returns: :class:`PolicyInfo`
|
|
12646
|
+
"""
|
|
12647
|
+
body = policy_info.as_dict()
|
|
12648
|
+
headers = {
|
|
12649
|
+
"Accept": "application/json",
|
|
12650
|
+
"Content-Type": "application/json",
|
|
12651
|
+
}
|
|
12652
|
+
|
|
12653
|
+
res = self._api.do("POST", "/api/2.1/unity-catalog/policies", body=body, headers=headers)
|
|
12654
|
+
return PolicyInfo.from_dict(res)
|
|
12655
|
+
|
|
12656
|
+
def delete_policy(self, on_securable_type: str, on_securable_fullname: str, name: str) -> DeletePolicyResponse:
|
|
12657
|
+
"""Delete an ABAC policy defined on a securable.
|
|
12658
|
+
|
|
12659
|
+
:param on_securable_type: str
|
|
12660
|
+
Required. The type of the securable to delete the policy from.
|
|
12661
|
+
:param on_securable_fullname: str
|
|
12662
|
+
Required. The fully qualified name of the securable to delete the policy from.
|
|
12663
|
+
:param name: str
|
|
12664
|
+
Required. The name of the policy to delete
|
|
12665
|
+
|
|
12666
|
+
:returns: :class:`DeletePolicyResponse`
|
|
12667
|
+
"""
|
|
12668
|
+
|
|
12669
|
+
headers = {
|
|
12670
|
+
"Accept": "application/json",
|
|
12671
|
+
}
|
|
12672
|
+
|
|
12673
|
+
res = self._api.do(
|
|
12674
|
+
"DELETE",
|
|
12675
|
+
f"/api/2.1/unity-catalog/policies/{on_securable_type}/{on_securable_fullname}/{name}",
|
|
12676
|
+
headers=headers,
|
|
12677
|
+
)
|
|
12678
|
+
return DeletePolicyResponse.from_dict(res)
|
|
12679
|
+
|
|
12680
|
+
def get_policy(self, on_securable_type: str, on_securable_fullname: str, name: str) -> PolicyInfo:
|
|
12681
|
+
"""Get the policy definition on a securable
|
|
12682
|
+
|
|
12683
|
+
:param on_securable_type: str
|
|
12684
|
+
Required. The type of the securable to retrieve the policy for.
|
|
12685
|
+
:param on_securable_fullname: str
|
|
12686
|
+
Required. The fully qualified name of securable to retrieve policy for.
|
|
12687
|
+
:param name: str
|
|
12688
|
+
Required. The name of the policy to retrieve.
|
|
12689
|
+
|
|
12690
|
+
:returns: :class:`PolicyInfo`
|
|
12691
|
+
"""
|
|
12692
|
+
|
|
12693
|
+
headers = {
|
|
12694
|
+
"Accept": "application/json",
|
|
12695
|
+
}
|
|
12696
|
+
|
|
12697
|
+
res = self._api.do(
|
|
12698
|
+
"GET",
|
|
12699
|
+
f"/api/2.1/unity-catalog/policies/{on_securable_type}/{on_securable_fullname}/{name}",
|
|
12700
|
+
headers=headers,
|
|
12701
|
+
)
|
|
12702
|
+
return PolicyInfo.from_dict(res)
|
|
12703
|
+
|
|
12704
|
+
def list_policies(
|
|
12705
|
+
self,
|
|
12706
|
+
on_securable_type: str,
|
|
12707
|
+
on_securable_fullname: str,
|
|
12708
|
+
*,
|
|
12709
|
+
include_inherited: Optional[bool] = None,
|
|
12710
|
+
max_results: Optional[int] = None,
|
|
12711
|
+
page_token: Optional[str] = None,
|
|
12712
|
+
) -> Iterator[PolicyInfo]:
|
|
12713
|
+
"""List all policies defined on a securable. Optionally, the list can include inherited policies defined
|
|
12714
|
+
on the securable's parent schema or catalog.
|
|
12715
|
+
|
|
12716
|
+
:param on_securable_type: str
|
|
12717
|
+
Required. The type of the securable to list policies for.
|
|
12718
|
+
:param on_securable_fullname: str
|
|
12719
|
+
Required. The fully qualified name of securable to list policies for.
|
|
12720
|
+
:param include_inherited: bool (optional)
|
|
12721
|
+
Optional. Whether to include policies defined on parent securables. By default, the inherited
|
|
12722
|
+
policies are not included.
|
|
12723
|
+
:param max_results: int (optional)
|
|
12724
|
+
Optional. Maximum number of policies to return on a single page (page length). - When not set or set
|
|
12725
|
+
to 0, the page length is set to a server configured value (recommended); - When set to a value
|
|
12726
|
+
greater than 0, the page length is the minimum of this value and a server configured value;
|
|
12727
|
+
:param page_token: str (optional)
|
|
12728
|
+
Optional. Opaque pagination token to go to next page based on previous query.
|
|
12729
|
+
|
|
12730
|
+
:returns: Iterator over :class:`PolicyInfo`
|
|
12731
|
+
"""
|
|
12732
|
+
|
|
12733
|
+
query = {}
|
|
12734
|
+
if include_inherited is not None:
|
|
12735
|
+
query["include_inherited"] = include_inherited
|
|
12736
|
+
if max_results is not None:
|
|
12737
|
+
query["max_results"] = max_results
|
|
12738
|
+
if page_token is not None:
|
|
12739
|
+
query["page_token"] = page_token
|
|
12740
|
+
headers = {
|
|
12741
|
+
"Accept": "application/json",
|
|
12742
|
+
}
|
|
12743
|
+
|
|
12744
|
+
while True:
|
|
12745
|
+
json = self._api.do(
|
|
12746
|
+
"GET",
|
|
12747
|
+
f"/api/2.1/unity-catalog/policies/{on_securable_type}/{on_securable_fullname}",
|
|
12748
|
+
query=query,
|
|
12749
|
+
headers=headers,
|
|
12750
|
+
)
|
|
12751
|
+
if "policies" in json:
|
|
12752
|
+
for v in json["policies"]:
|
|
12753
|
+
yield PolicyInfo.from_dict(v)
|
|
12754
|
+
if "next_page_token" not in json or not json["next_page_token"]:
|
|
12755
|
+
return
|
|
12756
|
+
query["page_token"] = json["next_page_token"]
|
|
12757
|
+
|
|
12758
|
+
def update_policy(
|
|
12759
|
+
self,
|
|
12760
|
+
on_securable_type: str,
|
|
12761
|
+
on_securable_fullname: str,
|
|
12762
|
+
name: str,
|
|
12763
|
+
policy_info: PolicyInfo,
|
|
12764
|
+
*,
|
|
12765
|
+
update_mask: Optional[str] = None,
|
|
12766
|
+
) -> PolicyInfo:
|
|
12767
|
+
"""Update an ABAC policy on a securable.
|
|
12768
|
+
|
|
12769
|
+
:param on_securable_type: str
|
|
12770
|
+
Required. The type of the securable to update the policy for.
|
|
12771
|
+
:param on_securable_fullname: str
|
|
12772
|
+
Required. The fully qualified name of the securable to update the policy for.
|
|
12773
|
+
:param name: str
|
|
12774
|
+
Required. The name of the policy to update.
|
|
12775
|
+
:param policy_info: :class:`PolicyInfo`
|
|
12776
|
+
Optional fields to update. This is the request body for updating a policy. Use `update_mask` field
|
|
12777
|
+
to specify which fields in the request is to be updated. - If `update_mask` is empty or "*", all
|
|
12778
|
+
specified fields will be updated. - If `update_mask` is specified, only the fields specified in the
|
|
12779
|
+
`update_mask` will be updated. If a field is specified in `update_mask` and not set in the request,
|
|
12780
|
+
the field will be cleared. Users can use the update mask to explicitly unset optional fields such as
|
|
12781
|
+
`exception_principals` and `when_condition`.
|
|
12782
|
+
:param update_mask: str (optional)
|
|
12783
|
+
Optional. The update mask field for specifying user intentions on which fields to update in the
|
|
12784
|
+
request.
|
|
12785
|
+
|
|
12786
|
+
:returns: :class:`PolicyInfo`
|
|
12787
|
+
"""
|
|
12788
|
+
body = policy_info.as_dict()
|
|
12789
|
+
query = {}
|
|
12790
|
+
if update_mask is not None:
|
|
12791
|
+
query["update_mask"] = update_mask
|
|
12792
|
+
headers = {
|
|
12793
|
+
"Accept": "application/json",
|
|
12794
|
+
"Content-Type": "application/json",
|
|
12795
|
+
}
|
|
12796
|
+
|
|
12797
|
+
res = self._api.do(
|
|
12798
|
+
"PATCH",
|
|
12799
|
+
f"/api/2.1/unity-catalog/policies/{on_securable_type}/{on_securable_fullname}/{name}",
|
|
12800
|
+
query=query,
|
|
12801
|
+
body=body,
|
|
12802
|
+
headers=headers,
|
|
12803
|
+
)
|
|
12804
|
+
return PolicyInfo.from_dict(res)
|
|
12805
|
+
|
|
12806
|
+
|
|
12178
12807
|
class QualityMonitorsAPI:
|
|
12179
12808
|
"""A monitor computes and monitors data or model quality metrics for a table over time. It generates metrics
|
|
12180
12809
|
tables and a dashboard that you can use to monitor table health and set alerts. Most write operations
|
|
@@ -12960,7 +13589,7 @@ class SchemasAPI:
|
|
|
12960
13589
|
properties: Optional[Dict[str, str]] = None,
|
|
12961
13590
|
storage_root: Optional[str] = None,
|
|
12962
13591
|
) -> SchemaInfo:
|
|
12963
|
-
"""Creates a new schema for catalog in the
|
|
13592
|
+
"""Creates a new schema for catalog in the Metastore. The caller must be a metastore admin, or have the
|
|
12964
13593
|
**CREATE_SCHEMA** privilege in the parent catalog.
|
|
12965
13594
|
|
|
12966
13595
|
:param name: str
|
|
@@ -13642,6 +14271,79 @@ class TablesAPI:
|
|
|
13642
14271
|
def __init__(self, api_client):
|
|
13643
14272
|
self._api = api_client
|
|
13644
14273
|
|
|
14274
|
+
def create(
|
|
14275
|
+
self,
|
|
14276
|
+
name: str,
|
|
14277
|
+
catalog_name: str,
|
|
14278
|
+
schema_name: str,
|
|
14279
|
+
table_type: TableType,
|
|
14280
|
+
data_source_format: DataSourceFormat,
|
|
14281
|
+
storage_location: str,
|
|
14282
|
+
*,
|
|
14283
|
+
columns: Optional[List[ColumnInfo]] = None,
|
|
14284
|
+
properties: Optional[Dict[str, str]] = None,
|
|
14285
|
+
) -> TableInfo:
|
|
14286
|
+
"""Creates a new table in the specified catalog and schema.
|
|
14287
|
+
|
|
14288
|
+
To create an external delta table, the caller must have the **EXTERNAL_USE_SCHEMA** privilege on the
|
|
14289
|
+
parent schema and the **EXTERNAL_USE_LOCATION** privilege on the external location. These privileges
|
|
14290
|
+
must always be granted explicitly, and cannot be inherited through ownership or **ALL_PRIVILEGES**.
|
|
14291
|
+
|
|
14292
|
+
Standard UC permissions needed to create tables still apply: **USE_CATALOG** on the parent catalog (or
|
|
14293
|
+
ownership of the parent catalog), **CREATE_TABLE** and **USE_SCHEMA** on the parent schema (or
|
|
14294
|
+
ownership of the parent schema), and **CREATE_EXTERNAL_TABLE** on external location.
|
|
14295
|
+
|
|
14296
|
+
The **columns** field needs to be in a Spark compatible format, so we recommend you use Spark to
|
|
14297
|
+
create these tables. The API itself does not validate the correctness of the column spec. If the spec
|
|
14298
|
+
is not Spark compatible, the tables may not be readable by Databricks Runtime.
|
|
14299
|
+
|
|
14300
|
+
NOTE: The Create Table API for external clients only supports creating **external delta tables**. The
|
|
14301
|
+
values shown in the respective enums are all values supported by Databricks, however for this specific
|
|
14302
|
+
Create Table API, only **table_type** **EXTERNAL** and **data_source_format** **DELTA** are supported.
|
|
14303
|
+
Additionally, column masks are not supported when creating tables through this API.
|
|
14304
|
+
|
|
14305
|
+
:param name: str
|
|
14306
|
+
Name of table, relative to parent schema.
|
|
14307
|
+
:param catalog_name: str
|
|
14308
|
+
Name of parent catalog.
|
|
14309
|
+
:param schema_name: str
|
|
14310
|
+
Name of parent schema relative to its parent catalog.
|
|
14311
|
+
:param table_type: :class:`TableType`
|
|
14312
|
+
:param data_source_format: :class:`DataSourceFormat`
|
|
14313
|
+
:param storage_location: str
|
|
14314
|
+
Storage root URL for table (for **MANAGED**, **EXTERNAL** tables).
|
|
14315
|
+
:param columns: List[:class:`ColumnInfo`] (optional)
|
|
14316
|
+
The array of __ColumnInfo__ definitions of the table's columns.
|
|
14317
|
+
:param properties: Dict[str,str] (optional)
|
|
14318
|
+
A map of key-value properties attached to the securable.
|
|
14319
|
+
|
|
14320
|
+
:returns: :class:`TableInfo`
|
|
14321
|
+
"""
|
|
14322
|
+
body = {}
|
|
14323
|
+
if catalog_name is not None:
|
|
14324
|
+
body["catalog_name"] = catalog_name
|
|
14325
|
+
if columns is not None:
|
|
14326
|
+
body["columns"] = [v.as_dict() for v in columns]
|
|
14327
|
+
if data_source_format is not None:
|
|
14328
|
+
body["data_source_format"] = data_source_format.value
|
|
14329
|
+
if name is not None:
|
|
14330
|
+
body["name"] = name
|
|
14331
|
+
if properties is not None:
|
|
14332
|
+
body["properties"] = properties
|
|
14333
|
+
if schema_name is not None:
|
|
14334
|
+
body["schema_name"] = schema_name
|
|
14335
|
+
if storage_location is not None:
|
|
14336
|
+
body["storage_location"] = storage_location
|
|
14337
|
+
if table_type is not None:
|
|
14338
|
+
body["table_type"] = table_type.value
|
|
14339
|
+
headers = {
|
|
14340
|
+
"Accept": "application/json",
|
|
14341
|
+
"Content-Type": "application/json",
|
|
14342
|
+
}
|
|
14343
|
+
|
|
14344
|
+
res = self._api.do("POST", "/api/2.1/unity-catalog/tables", body=body, headers=headers)
|
|
14345
|
+
return TableInfo.from_dict(res)
|
|
14346
|
+
|
|
13645
14347
|
def delete(self, full_name: str):
|
|
13646
14348
|
"""Deletes a table from the specified parent catalog and schema. The caller must be the owner of the
|
|
13647
14349
|
parent catalog, have the **USE_CATALOG** privilege on the parent catalog and be the owner of the
|
|
@@ -13663,10 +14365,10 @@ class TablesAPI:
|
|
|
13663
14365
|
def exists(self, full_name: str) -> TableExistsResponse:
|
|
13664
14366
|
"""Gets if a table exists in the metastore for a specific catalog and schema. The caller must satisfy one
|
|
13665
14367
|
of the following requirements: * Be a metastore admin * Be the owner of the parent catalog * Be the
|
|
13666
|
-
owner of the parent schema and have the USE_CATALOG privilege on the parent catalog * Have the
|
|
14368
|
+
owner of the parent schema and have the **USE_CATALOG** privilege on the parent catalog * Have the
|
|
13667
14369
|
**USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema,
|
|
13668
|
-
and either be the table owner or have the SELECT privilege on the table. * Have BROWSE
|
|
13669
|
-
the parent catalog * Have BROWSE privilege on the parent schema
|
|
14370
|
+
and either be the table owner or have the **SELECT** privilege on the table. * Have **BROWSE**
|
|
14371
|
+
privilege on the parent catalog * Have **BROWSE** privilege on the parent schema
|
|
13670
14372
|
|
|
13671
14373
|
:param full_name: str
|
|
13672
14374
|
Full name of the table.
|
|
@@ -13691,9 +14393,9 @@ class TablesAPI:
|
|
|
13691
14393
|
) -> TableInfo:
|
|
13692
14394
|
"""Gets a table from the metastore for a specific catalog and schema. The caller must satisfy one of the
|
|
13693
14395
|
following requirements: * Be a metastore admin * Be the owner of the parent catalog * Be the owner of
|
|
13694
|
-
the parent schema and have the USE_CATALOG privilege on the parent catalog * Have the
|
|
13695
|
-
privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema,
|
|
13696
|
-
the table owner or have the SELECT privilege on the table.
|
|
14396
|
+
the parent schema and have the **USE_CATALOG** privilege on the parent catalog * Have the
|
|
14397
|
+
**USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema,
|
|
14398
|
+
and either be the table owner or have the **SELECT** privilege on the table.
|
|
13697
14399
|
|
|
13698
14400
|
:param full_name: str
|
|
13699
14401
|
Full name of the table.
|
|
@@ -13891,19 +14593,86 @@ class TablesAPI:
|
|
|
13891
14593
|
self._api.do("PATCH", f"/api/2.1/unity-catalog/tables/{full_name}", body=body, headers=headers)
|
|
13892
14594
|
|
|
13893
14595
|
|
|
14596
|
+
class TemporaryPathCredentialsAPI:
|
|
14597
|
+
"""Temporary Path Credentials refer to short-lived, downscoped credentials used to access external cloud
|
|
14598
|
+
storage locations registered in Databricks. These credentials are employed to provide secure and
|
|
14599
|
+
time-limited access to data in cloud environments such as AWS, Azure, and Google Cloud. Each cloud
|
|
14600
|
+
provider has its own type of credentials: AWS uses temporary session tokens via AWS Security Token Service
|
|
14601
|
+
(STS), Azure utilizes Shared Access Signatures (SAS) for its data storage services, and Google Cloud
|
|
14602
|
+
supports temporary credentials through OAuth 2.0.
|
|
14603
|
+
|
|
14604
|
+
Temporary path credentials ensure that data access is limited in scope and duration, reducing the risk of
|
|
14605
|
+
unauthorized access or misuse. To use the temporary path credentials API, a metastore admin needs to
|
|
14606
|
+
enable the external_access_enabled flag (off by default) at the metastore level. A user needs to be
|
|
14607
|
+
granted the EXTERNAL USE LOCATION permission by external location owner. For requests on existing external
|
|
14608
|
+
tables, user also needs to be granted the EXTERNAL USE SCHEMA permission at the schema level by catalog
|
|
14609
|
+
admin.
|
|
14610
|
+
|
|
14611
|
+
Note that EXTERNAL USE SCHEMA is a schema level permission that can only be granted by catalog admin
|
|
14612
|
+
explicitly and is not included in schema ownership or ALL PRIVILEGES on the schema for security reasons.
|
|
14613
|
+
Similarly, EXTERNAL USE LOCATION is an external location level permission that can only be granted by
|
|
14614
|
+
external location owner explicitly and is not included in external location ownership or ALL PRIVILEGES on
|
|
14615
|
+
the external location for security reasons.
|
|
14616
|
+
|
|
14617
|
+
This API only supports temporary path credentials for external locations and external tables, and volumes
|
|
14618
|
+
will be supported in the future."""
|
|
14619
|
+
|
|
14620
|
+
def __init__(self, api_client):
|
|
14621
|
+
self._api = api_client
|
|
14622
|
+
|
|
14623
|
+
def generate_temporary_path_credentials(
|
|
14624
|
+
self, url: str, operation: PathOperation, *, dry_run: Optional[bool] = None
|
|
14625
|
+
) -> GenerateTemporaryPathCredentialResponse:
|
|
14626
|
+
"""Get a short-lived credential for directly accessing cloud storage locations registered in Databricks.
|
|
14627
|
+
The Generate Temporary Path Credentials API is only supported for external storage paths, specifically
|
|
14628
|
+
external locations and external tables. Managed tables are not supported by this API. The metastore
|
|
14629
|
+
must have **external_access_enabled** flag set to true (default false). The caller must have the
|
|
14630
|
+
**EXTERNAL_USE_LOCATION** privilege on the external location; this privilege can only be granted by
|
|
14631
|
+
external location owners. For requests on existing external tables, the caller must also have the
|
|
14632
|
+
**EXTERNAL_USE_SCHEMA** privilege on the parent schema; this privilege can only be granted by catalog
|
|
14633
|
+
owners.
|
|
14634
|
+
|
|
14635
|
+
:param url: str
|
|
14636
|
+
URL for path-based access.
|
|
14637
|
+
:param operation: :class:`PathOperation`
|
|
14638
|
+
The operation being performed on the path.
|
|
14639
|
+
:param dry_run: bool (optional)
|
|
14640
|
+
Optional. When set to true, the service will not validate that the generated credentials can perform
|
|
14641
|
+
write operations, therefore no new paths will be created and the response will not contain valid
|
|
14642
|
+
credentials. Defaults to false.
|
|
14643
|
+
|
|
14644
|
+
:returns: :class:`GenerateTemporaryPathCredentialResponse`
|
|
14645
|
+
"""
|
|
14646
|
+
body = {}
|
|
14647
|
+
if dry_run is not None:
|
|
14648
|
+
body["dry_run"] = dry_run
|
|
14649
|
+
if operation is not None:
|
|
14650
|
+
body["operation"] = operation.value
|
|
14651
|
+
if url is not None:
|
|
14652
|
+
body["url"] = url
|
|
14653
|
+
headers = {
|
|
14654
|
+
"Accept": "application/json",
|
|
14655
|
+
"Content-Type": "application/json",
|
|
14656
|
+
}
|
|
14657
|
+
|
|
14658
|
+
res = self._api.do("POST", "/api/2.0/unity-catalog/temporary-path-credentials", body=body, headers=headers)
|
|
14659
|
+
return GenerateTemporaryPathCredentialResponse.from_dict(res)
|
|
14660
|
+
|
|
14661
|
+
|
|
13894
14662
|
class TemporaryTableCredentialsAPI:
|
|
13895
14663
|
"""Temporary Table Credentials refer to short-lived, downscoped credentials used to access cloud storage
|
|
13896
|
-
|
|
13897
|
-
time-
|
|
13898
|
-
has its own
|
|
13899
|
-
Azure
|
|
13900
|
-
temporary
|
|
13901
|
-
|
|
13902
|
-
credentials
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
14664
|
+
locations where table data is stored in Databricks. These credentials are employed to provide secure and
|
|
14665
|
+
time-limited access to data in cloud environments such as AWS, Azure, and Google Cloud. Each cloud
|
|
14666
|
+
provider has its own type of credentials: AWS uses temporary session tokens via AWS Security Token Service
|
|
14667
|
+
(STS), Azure utilizes Shared Access Signatures (SAS) for its data storage services, and Google Cloud
|
|
14668
|
+
supports temporary credentials through OAuth 2.0.
|
|
14669
|
+
|
|
14670
|
+
Temporary table credentials ensure that data access is limited in scope and duration, reducing the risk of
|
|
14671
|
+
unauthorized access or misuse. To use the temporary table credentials API, a metastore admin needs to
|
|
14672
|
+
enable the external_access_enabled flag (off by default) at the metastore level, and user needs to be
|
|
14673
|
+
granted the EXTERNAL USE SCHEMA permission at the schema level by catalog admin. Note that EXTERNAL USE
|
|
14674
|
+
SCHEMA is a schema level permission that can only be granted by catalog admin explicitly and is not
|
|
14675
|
+
included in schema ownership or ALL PRIVILEGES on the schema for security reasons."""
|
|
13907
14676
|
|
|
13908
14677
|
def __init__(self, api_client):
|
|
13909
14678
|
self._api = api_client
|
|
@@ -13912,9 +14681,9 @@ class TemporaryTableCredentialsAPI:
|
|
|
13912
14681
|
self, *, operation: Optional[TableOperation] = None, table_id: Optional[str] = None
|
|
13913
14682
|
) -> GenerateTemporaryTableCredentialResponse:
|
|
13914
14683
|
"""Get a short-lived credential for directly accessing the table data on cloud storage. The metastore
|
|
13915
|
-
must have external_access_enabled flag set to true (default false). The caller must have
|
|
13916
|
-
EXTERNAL_USE_SCHEMA privilege on the parent schema and this privilege can only be granted by
|
|
13917
|
-
owners.
|
|
14684
|
+
must have **external_access_enabled** flag set to true (default false). The caller must have the
|
|
14685
|
+
**EXTERNAL_USE_SCHEMA** privilege on the parent schema and this privilege can only be granted by
|
|
14686
|
+
catalog owners.
|
|
13918
14687
|
|
|
13919
14688
|
:param operation: :class:`TableOperation` (optional)
|
|
13920
14689
|
The operation performed against the table data, either READ or READ_WRITE. If READ_WRITE is
|