Skip to content

Commit 1399208

Browse files
Update SDK API to 55d22d7e7879e6be815cfe8e3e4cf7130f822c94 (#1471)
This PR updates the SDK to the latest API changes. NO_CHANGELOG=true Co-authored-by: databricks-ci-ghec-2[bot] <184307802+databricks-ci-ghec-2[bot]@users.noreply.github.com>
1 parent 9744f91 commit 1399208

11 files changed

Lines changed: 73 additions & 44 deletions

File tree

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
805d88b51faa37301c51d1848da2db5a2e6ed921
1+
55d22d7e7879e6be815cfe8e3e4cf7130f822c94

NEXT_CHANGELOG.md

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@
4444
* Add `facet_column_count` and `facet_columns` fields for `databricks.sdk.service.vectorsearch.ResultManifest`.
4545
* Add `dangerously_force_discard_all` field for `databricks.sdk.service.workspace.UpdateRepoRequest`.
4646
* [Breaking] Remove `databricks.sdk.service.bundle` package.
47-
* [Breaking] Remove [w.bundle](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/bundle/bundle.html) workspace-level service.
47+
* [Breaking] Remove [w.bundle](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/bundle/bundle.html) workspace-level service.
48+
* Add `accelerated_sync` field for `databricks.sdk.service.database.SyncedTableSpec`.
49+
* Add `accelerated_sync` field for `databricks.sdk.service.postgres.SyncedTableSyncedTableSpec`.

databricks/sdk/service/database.py

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks/sdk/service/postgres.py

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/workspace/catalog/catalogs.rst

Lines changed: 2 additions & 2 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.

docs/workspace/catalog/external_locations.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,20 @@
115115
116116
credential = w.storage_credentials.create(
117117
name=f"sdk-{time.time_ns()}",
118-
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
118+
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
119119
)
120120
121121
created = w.external_locations.create(
122122
name=f"sdk-{time.time_ns()}",
123123
credential_name=credential.name,
124-
url=f's3://{os.environ["TEST_BUCKET"]}/sdk-{time.time_ns()}',
124+
url="s3://%s/%s" % (os.environ["TEST_BUCKET"], f"sdk-{time.time_ns()}"),
125125
)
126126
127-
_ = w.external_locations.get(get=created.name)
127+
_ = w.external_locations.get(name=created.name)
128128
129129
# cleanup
130-
w.storage_credentials.delete(delete=credential.name)
131-
w.external_locations.delete(delete=created.name)
130+
w.storage_credentials.delete(name=credential.name)
131+
w.external_locations.delete(name=created.name)
132132
133133
Gets an external location from the metastore. The caller must be either a metastore admin, the owner
134134
of the external location, or a user that has some privilege on the external location.
@@ -200,24 +200,24 @@
200200
201201
credential = w.storage_credentials.create(
202202
name=f"sdk-{time.time_ns()}",
203-
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
203+
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
204204
)
205205
206206
created = w.external_locations.create(
207207
name=f"sdk-{time.time_ns()}",
208208
credential_name=credential.name,
209-
url=f's3://{os.environ["TEST_BUCKET"]}/sdk-{time.time_ns()}',
209+
url="s3://%s/%s" % (os.environ["TEST_BUCKET"], f"sdk-{time.time_ns()}"),
210210
)
211211
212212
_ = w.external_locations.update(
213213
name=created.name,
214214
credential_name=credential.name,
215-
url=f's3://{os.environ["TEST_BUCKET"]}/sdk-{time.time_ns()}',
215+
url="s3://%s/%s" % (os.environ["TEST_BUCKET"], f"sdk-{time.time_ns()}"),
216216
)
217217
218218
# cleanup
219-
w.storage_credentials.delete(delete=credential.name)
220-
w.external_locations.delete(delete=created.name)
219+
w.storage_credentials.delete(name=credential.name)
220+
w.external_locations.delete(name=created.name)
221221
222222
Updates an external location in the metastore. The caller must be the owner of the external location,
223223
or be a metastore admin. In the second case, the admin can only update the name of the external

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: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
3131
w = WorkspaceClient()
3232
33-
created = w.storage_credentials.create(
33+
storage_credential = w.storage_credentials.create(
3434
name=f"sdk-{time.time_ns()}",
3535
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(name=created.name)
40+
w.storage_credentials.delete(name=storage_credential.name)
4041
4142
Creates a new storage credential.
4243

@@ -98,13 +99,13 @@
9899
99100
created = w.storage_credentials.create(
100101
name=f"sdk-{time.time_ns()}",
101-
aws_iam_role=catalog.AwsIamRole(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
102+
aws_iam_role=catalog.AwsIamRoleRequest(role_arn=os.environ["TEST_METASTORE_DATA_ACCESS_ARN"]),
102103
)
103104
104-
by_name = w.storage_credentials.get(get=created.name)
105+
by_name = w.storage_credentials.get(name=created.name)
105106
106107
# cleanup
107-
w.storage_credentials.delete(delete=created.name)
108+
w.storage_credentials.delete(name=created.name)
108109
109110
Gets a storage credential from the metastore. The caller must be a metastore admin, the owner of the
110111
storage credential, or have some permission on the storage credential.
@@ -123,10 +124,11 @@
123124
.. code-block::
124125
125126
from databricks.sdk import WorkspaceClient
127+
from databricks.sdk.service import catalog
126128
127129
w = WorkspaceClient()
128130
129-
all = w.storage_credentials.list()
131+
all = w.storage_credentials.list(catalog.ListStorageCredentialsRequest())
130132
131133
Gets an array of storage credentials (as __StorageCredentialInfo__ objects). The array is limited to
132134
only those storage credentials the caller has permission to access. If the caller is a metastore

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-
_ = w.permissions.get(request_object_type="notebooks", request_object_id="%d" % (obj.object_id))
47+
levels = w.permissions.get_permission_levels(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.

docs/workspace/ml/model_registry.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
9191
w = WorkspaceClient()
9292
93-
created = w.model_registry.create_model(name=f"sdk-{time.time_ns()}")
93+
model = w.model_registry.create_model(name=f"sdk-{time.time_ns()}")
94+
95+
created = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp")
9496
9597
Creates a new registered model with the name specified in the request body. Throws
9698
`RESOURCE_ALREADY_EXISTS` if a registered model with the given name exists.
@@ -120,7 +122,7 @@
120122
121123
model = w.model_registry.create_model(name=f"sdk-{time.time_ns()}")
122124
123-
mv = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp")
125+
created = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp")
124126
125127
Creates a model version.
126128

@@ -734,14 +736,13 @@
734736
735737
w = WorkspaceClient()
736738
737-
model = w.model_registry.create_model(name=f"sdk-{time.time_ns()}")
739+
created = w.model_registry.create_model(name=f"sdk-{time.time_ns()}")
738740
739-
created = w.model_registry.create_model_version(name=model.registered_model.name, source="dbfs:/tmp")
741+
model = w.model_registry.get_model(name=created.registered_model.name)
740742
741-
w.model_registry.update_model_version(
743+
w.model_registry.update_model(
744+
name=model.registered_model_databricks.name,
742745
description=f"sdk-{time.time_ns()}",
743-
name=created.model_version.name,
744-
version=created.model_version.version,
745746
)
746747
747748
Updates a registered model.

0 commit comments

Comments
 (0)