|
30 | 30 | |
31 | 31 | w = WorkspaceClient() |
32 | 32 | |
33 | | - credential = w.storage_credentials.create( |
| 33 | + storage_credential = w.storage_credentials.create( |
34 | 34 | 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", |
36 | 37 | ) |
37 | 38 | |
38 | | - created = w.external_locations.create( |
| 39 | + external_location = w.external_locations.create( |
39 | 40 | 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()}", |
42 | 44 | ) |
43 | 45 | |
44 | 46 | # 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) |
47 | 49 |
|
48 | 50 | Creates a new external location entry in the metastore. The caller must be a metastore admin or have |
49 | 51 | the **CREATE_EXTERNAL_LOCATION** privilege on both the metastore and the associated storage |
|
140 | 142 | .. code-block:: |
141 | 143 |
|
142 | 144 | from databricks.sdk import WorkspaceClient |
143 | | - from databricks.sdk.service import catalog |
144 | 145 | |
145 | 146 | w = WorkspaceClient() |
146 | 147 | |
147 | | - all = w.external_locations.list(catalog.ListExternalLocationsRequest()) |
| 148 | + all = w.external_locations.list() |
148 | 149 |
|
149 | 150 | Gets an array of external locations (__ExternalLocationInfo__ objects) from the metastore. The caller |
150 | 151 | must be a metastore admin, the owner of the external location, or a user that has some privilege on |
|
0 commit comments