Skip to content

Commit 891fceb

Browse files
denikIsaac
andcommitted
acc: show only the plan field each rename test is about
Also restores the grants/schemas/change_name golden for the in-place rename. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 235672b commit 891fceb

7 files changed

Lines changed: 24 additions & 90 deletions

File tree

‎acceptance/bundle/resources/catalogs/rename/output.txt‎

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,42 +41,11 @@ Resources: 3 created, 0 changed, 0 deleted, 0 unchanged
4141
=== UC moves the schema and the volume with the catalog, so the plan re-keys them instead of recreating them
4242
>>> [CLI] bundle plan --output json
4343
{
44-
"resources.catalogs.catalog1": {
45-
"action": "update_id",
46-
"changes": {
47-
"name": {
48-
"action": "update_id",
49-
"reason": "id_changes",
50-
"old": "test_catalog_[UNIQUE_NAME]",
51-
"new": "test_catalog_renamed_[UNIQUE_NAME]",
52-
"remote": "test_catalog_[UNIQUE_NAME]"
53-
}
54-
}
55-
},
56-
"resources.schemas.schema1": {
57-
"action": "update_id",
58-
"changes": {
59-
"catalog_name": {
60-
"action": "update_id",
61-
"reason": "parent_renamed",
62-
"old": "test_catalog_[UNIQUE_NAME]",
63-
"new": "test_catalog_renamed_[UNIQUE_NAME]",
64-
"remote": "test_catalog_[UNIQUE_NAME]"
65-
}
66-
}
67-
},
68-
"resources.volumes.volume1": {
69-
"action": "update_id",
70-
"changes": {
71-
"catalog_name": {
72-
"action": "update_id",
73-
"reason": "parent_renamed",
74-
"old": "test_catalog_[UNIQUE_NAME]",
75-
"new": "test_catalog_renamed_[UNIQUE_NAME]",
76-
"remote": "test_catalog_[UNIQUE_NAME]"
77-
}
78-
}
79-
}
44+
"action": "update_id",
45+
"reason": "parent_renamed",
46+
"old": "test_catalog_[UNIQUE_NAME]",
47+
"new": "test_catalog_renamed_[UNIQUE_NAME]",
48+
"remote": "test_catalog_[UNIQUE_NAME]"
8049
}
8150

8251
=== Deploy renames the catalog and updates the schema and the volume at their new paths

‎acceptance/bundle/resources/catalogs/rename/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ title "Rename the catalog"
2121
trace update_file.py databricks.yml test_catalog_ test_catalog_renamed_
2222

2323
title "UC moves the schema and the volume with the catalog, so the plan re-keys them instead of recreating them"
24-
trace $CLI bundle plan --output json | nostamp | jq '.plan | map_values({action, changes: ((.changes // {}) | with_entries(select(.value.action != "skip")))})'
24+
trace $CLI bundle plan --output json | jq '.plan["resources.volumes.volume1"].changes.catalog_name'
2525

2626
title "Deploy renames the catalog and updates the schema and the volume at their new paths"
2727
trace $CLI bundle deploy

‎acceptance/bundle/resources/grants/schemas/change_name/output.txt‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,19 @@ schemas schema1.grants id='schema/main.test-schema-[UNIQUE_NAME]'
5454
=== Deploy moves the schema to the new name and applies the grants there
5555
>>> [CLI] bundle deploy --auto-approve
5656
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
57-
58-
This action will result in the deletion or recreation of the following UC schemas. Any underlying data may be lost:
59-
recreate resources.schemas.schema1
60-
Recreated schemas.schema1
57+
Updated schemas.schema1
6158
Updated schemas.schema1.grants
6259
Files: 1 uploaded, 0 deleted
63-
Resources: 1 created, 1 changed, 1 deleted, 0 unchanged
60+
Resources: 0 created, 2 changed, 0 deleted, 0 unchanged
6461

6562
>>> print_requests.py //unity-catalog
6663
{
67-
"method": "DELETE",
64+
"method": "PATCH",
6865
"path": "/api/2.1/unity-catalog/schemas/main.test-schema-[UNIQUE_NAME]",
69-
"q": {
70-
"force": "true"
71-
}
72-
}
73-
{
74-
"method": "POST",
75-
"path": "/api/2.1/unity-catalog/schemas",
7666
"body": {
77-
"catalog_name": "main",
78-
"name": "test-schema-renamed-[UNIQUE_NAME]"
67+
"comment": "",
68+
"custom_max_retention_hours": 0,
69+
"new_name": "test-schema-renamed-[UNIQUE_NAME]"
7970
}
8071
}
8172
{

‎acceptance/bundle/resources/schemas/rename/output.txt‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,11 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
2323
=== The plan renames the schema in place instead of recreating it
2424
>>> [CLI] bundle plan --output json
2525
{
26-
"resources.schemas.schema1": {
27-
"action": "update_id",
28-
"changes": {
29-
"name": {
30-
"action": "update_id",
31-
"reason": "id_changes",
32-
"old": "test-schema-[UNIQUE_NAME]",
33-
"new": "test-schema-renamed-[UNIQUE_NAME]",
34-
"remote": "test-schema-[UNIQUE_NAME]"
35-
}
36-
}
37-
}
26+
"action": "update_id",
27+
"reason": "id_changes",
28+
"old": "test-schema-[UNIQUE_NAME]",
29+
"new": "test-schema-renamed-[UNIQUE_NAME]",
30+
"remote": "test-schema-[UNIQUE_NAME]"
3831
}
3932

4033
=== Deploy renames the schema without a deletion prompt

‎acceptance/bundle/resources/schemas/rename/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ title "Rename the schema"
2020
trace update_file.py databricks.yml test-schema- test-schema-renamed-
2121

2222
title "The plan renames the schema in place instead of recreating it"
23-
trace $CLI bundle plan --output json | nostamp | jq '.plan | map_values({action, changes: ((.changes // {}) | with_entries(select(.value.action != "skip")))})'
23+
trace $CLI bundle plan --output json | jq '.plan["resources.schemas.schema1"].changes.name'
2424

2525
title "Deploy renames the schema without a deletion prompt"
2626
trace $CLI bundle deploy

‎acceptance/bundle/resources/schemas/rename_with_volume/output.txt‎

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,11 @@ Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
3333
=== UC moves the volume with the schema, so the plan re-keys the volume instead of recreating it
3434
>>> [CLI] bundle plan --output json
3535
{
36-
"resources.schemas.schema1": {
37-
"action": "update_id",
38-
"changes": {
39-
"name": {
40-
"action": "update_id",
41-
"reason": "id_changes",
42-
"old": "test-schema-[UNIQUE_NAME]",
43-
"new": "test-schema-renamed-[UNIQUE_NAME]",
44-
"remote": "test-schema-[UNIQUE_NAME]"
45-
}
46-
}
47-
},
48-
"resources.volumes.volume1": {
49-
"action": "update_id",
50-
"changes": {
51-
"schema_name": {
52-
"action": "update_id",
53-
"reason": "parent_renamed",
54-
"old": "test-schema-[UNIQUE_NAME]",
55-
"new": "test-schema-renamed-[UNIQUE_NAME]",
56-
"remote": "test-schema-[UNIQUE_NAME]"
57-
}
58-
}
59-
}
36+
"action": "update_id",
37+
"reason": "parent_renamed",
38+
"old": "test-schema-[UNIQUE_NAME]",
39+
"new": "test-schema-renamed-[UNIQUE_NAME]",
40+
"remote": "test-schema-[UNIQUE_NAME]"
6041
}
6142

6243
=== Deploy renames the schema and updates the volume at its new path

‎acceptance/bundle/resources/schemas/rename_with_volume/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ title "Rename the schema"
2121
trace update_file.py databricks.yml test-schema- test-schema-renamed-
2222

2323
title "UC moves the volume with the schema, so the plan re-keys the volume instead of recreating it"
24-
trace $CLI bundle plan --output json | nostamp | jq '.plan | map_values({action, changes: ((.changes // {}) | with_entries(select(.value.action != "skip")))})'
24+
trace $CLI bundle plan --output json | jq '.plan["resources.volumes.volume1"].changes.schema_name'
2525

2626
title "Deploy renames the schema and updates the volume at its new path"
2727
trace $CLI bundle deploy

0 commit comments

Comments
 (0)