Skip to content

Commit 49ef4cb

Browse files
Update SDK API to 64d5b2c102315eef89e9b3b0b3fc960049030d77 (#1177)
This PR updates the SDK to the latest API changes. NO_CHANGELOG=true Co-authored-by: databricks-ci-ghec-1[bot] <184311507+databricks-ci-ghec-1[bot]@users.noreply.github.com>
1 parent c3f1891 commit 49ef4cb

File tree

13 files changed

+52
-82
lines changed

13 files changed

+52
-82
lines changed

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
328f83d70fc606f9d544f7e1d81a04d2473f6dec
1+
64d5b2c102315eef89e9b3b0b3fc960049030d77

docs/account/iam/workspace_assignment.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
4444
a = AccountClient()
4545
46-
workspace_id = os.environ["DUMMY_WORKSPACE_ID"]
46+
workspace_id = os.environ["TEST_WORKSPACE_ID"]
4747
48-
all = a.workspace_assignment.list(workspace_id=workspace_id)
48+
all = a.workspace_assignment.list(list=workspace_id)
4949
5050
Get the permission assignments for the specified Databricks account and Databricks workspace.
5151

docs/account/provisioning/credentials.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
2525
a = AccountClient()
2626
27-
role = a.credentials.create(
27+
creds = a.credentials.create(
2828
credentials_name=f"sdk-{time.time_ns()}",
2929
aws_credentials=provisioning.CreateCredentialAwsCredentials(
30-
sts_role=provisioning.CreateCredentialStsRole(role_arn=os.environ["TEST_CROSSACCOUNT_ARN"])
30+
sts_role=provisioning.CreateCredentialStsRole(role_arn=os.environ["TEST_LOGDELIVERY_ARN"])
3131
),
3232
)
3333
3434
# cleanup
35-
a.credentials.delete(credentials_id=role.credentials_id)
35+
a.credentials.delete(credentials_id=creds.credentials_id)
3636
3737
Creates a Databricks credential configuration that represents cloud cross-account credentials for a
3838
specified account. Databricks uses this to set up network infrastructure properly to host Databricks

docs/account/provisioning/storage.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
2424
a = AccountClient()
2525
26-
storage = a.storage.create(
26+
bucket = a.storage.create(
2727
storage_configuration_name=f"sdk-{time.time_ns()}",
2828
root_bucket_info=provisioning.RootBucketInfo(bucket_name=f"sdk-{time.time_ns()}"),
2929
)
30+
31+
# cleanup
32+
a.storage.delete(storage_configuration_id=bucket.storage_configuration_id)
3033
3134
Creates a Databricks storage configuration for an account.
3235

docs/workspace/catalog/catalogs.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
2525
w = WorkspaceClient()
2626
27-
new_catalog = w.catalogs.create(name=f"sdk-{time.time_ns()}")
27+
created_catalog = w.catalogs.create(name=f"sdk-{time.time_ns()}")
2828
2929
# cleanup
30-
w.catalogs.delete(name=new_catalog.name, force=True)
30+
w.catalogs.delete(name=created_catalog.name, force=True)
3131
3232
Creates a new catalog instance in the parent metastore if the caller is a metastore admin or has the
3333
**CREATE_CATALOG** privilege.
@@ -155,12 +155,13 @@
155155
import time
156156
157157
from databricks.sdk import WorkspaceClient
158+
from databricks.sdk.service import catalog
158159
159160
w = WorkspaceClient()
160161
161162
created = w.catalogs.create(name=f"sdk-{time.time_ns()}")
162163
163-
_ = w.catalogs.update(name=created.name, comment="updated")
164+
_ = w.catalogs.update(name=created.name, isolation_mode=catalog.CatalogIsolationMode.ISOLATED)
164165
165166
# cleanup
166167
w.catalogs.delete(name=created.name, force=True)

docs/workspace/catalog/external_locations.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,22 @@
3030
3131
w = WorkspaceClient()
3232
33-
credential = w.storage_credentials.create(
33+
storage_credential = w.storage_credentials.create(
3434
name=f"sdk-{time.time_ns()}",
35-
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
35+
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
36+
comment="created via SDK",
3637
)
3738
38-
created = w.external_locations.create(
39+
external_location = w.external_locations.create(
3940
name=f"sdk-{time.time_ns()}",
40-
credential_name=credential.name,
41-
url=f's3://{os.environ["TEST_BUCKET"]}/sdk-{time.time_ns()}',
41+
credential_name=storage_credential.name,
42+
comment="created via SDK",
43+
url="s3://" + os.environ["TEST_BUCKET"] + "/" + f"sdk-{time.time_ns()}",
4244
)
4345
4446
# cleanup
45-
w.storage_credentials.delete(delete=credential.name)
46-
w.external_locations.delete(delete=created.name)
47+
w.storage_credentials.delete(name=storage_credential.name)
48+
w.external_locations.delete(name=external_location.name)
4749
4850
Creates a new external location entry in the metastore. The caller must be a metastore admin or have
4951
the **CREATE_EXTERNAL_LOCATION** privilege on both the metastore and the associated storage
@@ -140,11 +142,10 @@
140142
.. code-block::
141143
142144
from databricks.sdk import WorkspaceClient
143-
from databricks.sdk.service import catalog
144145
145146
w = WorkspaceClient()
146147
147-
all = w.external_locations.list(catalog.ListExternalLocationsRequest())
148+
all = w.external_locations.list()
148149
149150
Gets an array of external locations (__ExternalLocationInfo__ objects) from the metastore. The caller
150151
must be a metastore admin, the owner of the external location, or a user that has some privilege on

docs/workspace/catalog/schemas.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
2323
w = WorkspaceClient()
2424
25-
new_catalog = w.catalogs.create(name=f"sdk-{time.time_ns()}")
25+
created_catalog = w.catalogs.create(name=f"sdk-{time.time_ns()}")
2626
27-
created = w.schemas.create(name=f"sdk-{time.time_ns()}", catalog_name=new_catalog.name)
27+
created_schema = w.schemas.create(name=f"sdk-{time.time_ns()}", catalog_name=created_catalog.name)
2828
2929
# cleanup
30-
w.catalogs.delete(name=new_catalog.name, force=True)
31-
w.schemas.delete(full_name=created.full_name)
30+
w.catalogs.delete(name=created_catalog.name, force=True)
31+
w.schemas.delete(full_name=created_schema.full_name)
3232
3333
Creates a new schema for catalog in the Metastore. The caller must be a metastore admin, or have the
3434
**CREATE_SCHEMA** privilege in the parent catalog.

docs/workspace/catalog/storage_credentials.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
3131
w = WorkspaceClient()
3232
33-
credential = w.storage_credentials.create(
33+
storage_credential = w.storage_credentials.create(
3434
name=f"sdk-{time.time_ns()}",
35-
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
35+
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
36+
comment="created via SDK",
3637
)
3738
3839
# cleanup
39-
w.storage_credentials.delete(delete=credential.name)
40+
w.storage_credentials.delete(name=storage_credential.name)
4041
4142
Creates a new storage credential.
4243

@@ -172,17 +173,17 @@
172173
173174
created = w.storage_credentials.create(
174175
name=f"sdk-{time.time_ns()}",
175-
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
176+
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
176177
)
177178
178179
_ = w.storage_credentials.update(
179180
name=created.name,
180181
comment=f"sdk-{time.time_ns()}",
181-
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
182+
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
182183
)
183184
184185
# cleanup
185-
w.storage_credentials.delete(name=created.name)
186+
w.storage_credentials.delete(delete=created.name)
186187
187188
Updates a storage credential on the metastore.
188189

docs/workspace/iam/current_user.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
w = WorkspaceClient()
1919
20-
me2 = w.current_user.me()
20+
me = w.current_user.me()
2121
2222
Get details about the current method caller's identity.
2323

docs/workspace/iam/permissions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
4545
obj = w.workspace.get_status(path=notebook_path)
4646
47-
levels = w.permissions.get_permission_levels(request_object_type="notebooks", request_object_id="%d" % (obj.object_id))
47+
_ = w.permissions.get(request_object_type="notebooks", request_object_id="%d" % (obj.object_id))
4848
4949
Gets the permissions of an object. Objects can inherit permissions from their parent objects or root
5050
object.

0 commit comments

Comments
 (0)