@@ -29,6 +29,7 @@ Resources: 3 created, 0 changed, 0 deleted, 0 unchanged
2929 "path": "/api/2.1/unity-catalog/models",
3030 "body": {
3131 "catalog_name": "test_catalog_[UNIQUE_NAME]",
32+ "comment": "c1",
3233 "name": "mymodel",
3334 "schema_name": "myschema"
3435 }
@@ -64,12 +65,14 @@ Resources: 3 created, 0 changed, 0 deleted, 0 unchanged
6465 "new_state": {
6566 "value": {
6667 "catalog_name": "test_catalog_[UNIQUE_NAME]",
68+ "comment": "c1",
6769 "name": "mymodel2",
6870 "schema_name": "myschema"
6971 }
7072 },
7173 "remote_state": {
7274 "catalog_name": "test_catalog_[UNIQUE_NAME]",
75+ "comment": "c1",
7376 "created_by": "[USERNAME]",
7477 "full_name": "test_catalog_[UNIQUE_NAME].myschema.mymodel",
7578 "name": "mymodel",
@@ -141,7 +144,7 @@ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
141144 "path": "/api/2.1/unity-catalog/models/test_catalog_[UNIQUE_NAME].myschema.mymodel",
142145 "body": {
143146 "catalog_name": "test_catalog_[UNIQUE_NAME]",
144- "comment": "",
147+ "comment": "c1 ",
145148 "new_name": "mymodel2",
146149 "schema_name": "myschema"
147150 }
@@ -180,28 +183,25 @@ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
180183 }
181184 ],
182185 "action": "update_id",
186+ "state_only": true,
183187 "new_state": {
184188 "value": {
185189 "catalog_name": "test_catalog_[UNIQUE_NAME]",
190+ "comment": "c1",
186191 "name": "mymodel2",
187192 "schema_name": "myschema2"
188193 }
189194 },
190195 "remote_state": {
191196 "catalog_name": "test_catalog_[UNIQUE_NAME]",
192- "comment": "",
197+ "comment": "c1 ",
193198 "created_by": "[USERNAME]",
194199 "full_name": "test_catalog_[UNIQUE_NAME].myschema.mymodel2",
195200 "name": "mymodel2",
196201 "owner": "[USERNAME]",
197202 "schema_name": "myschema"
198203 },
199204 "changes": {
200- "comment": {
201- "action": "skip",
202- "reason": "empty",
203- "remote": ""
204- },
205205 "created_by": {
206206 "action": "skip",
207207 "reason": "output_only",
@@ -269,10 +269,9 @@ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
269269
270270>>> [CLI] bundle deploy
271271Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
272- Updated registered_models.model1
273272Updated schemas.schema1
274273Files: 1 uploaded, 0 deleted
275- Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
274+ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
276275
277276>>> print_requests.py //unity-catalog
278277{
@@ -332,16 +331,18 @@ Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
332331 }
333332 ],
334333 "action": "update_id",
334+ "state_only": true,
335335 "new_state": {
336336 "value": {
337337 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
338+ "comment": "c1",
338339 "name": "mymodel2",
339340 "schema_name": "myschema2"
340341 }
341342 },
342343 "remote_state": {
343344 "catalog_name": "test_catalog_[UNIQUE_NAME]",
344- "comment": "",
345+ "comment": "c1 ",
345346 "created_by": "[USERNAME]",
346347 "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mymodel2",
347348 "name": "mymodel2",
@@ -356,11 +357,6 @@ Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
356357 "new": "test_catalog_renamed_[UNIQUE_NAME]",
357358 "remote": "test_catalog_[UNIQUE_NAME]"
358359 },
359- "comment": {
360- "action": "skip",
361- "reason": "empty",
362- "remote": ""
363- },
364360 "created_by": {
365361 "action": "skip",
366362 "reason": "output_only",
@@ -386,6 +382,7 @@ Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
386382 }
387383 ],
388384 "action": "update_id",
385+ "state_only": true,
389386 "new_state": {
390387 "value": {
391388 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
@@ -434,10 +431,8 @@ Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
434431>>> [CLI] bundle deploy
435432Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
436433Updated catalogs.catalog1
437- Updated registered_models.model1
438- Updated schemas.schema1
439434Files: 1 uploaded, 0 deleted
440- Resources: 0 created, 3 changed, 0 deleted, 0 unchanged
435+ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
441436
442437>>> print_requests.py //unity-catalog
443438{
@@ -456,14 +451,44 @@ Resources: 0 created, 3 changed, 0 deleted, 0 unchanged
456451 "created_at": [MODEL_CREATED_AT]
457452}
458453
454+ === Rename the model and change its comment in one deploy: both go in one PATCH
455+ >>> update_file.py databricks.yml name: mymodel2 name: mymodel3
456+
457+ >>> update_file.py databricks.yml comment: c1 comment: c2
458+
459+ >>> [CLI] bundle deploy
460+ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
461+ Updated registered_models.model1
462+ Files: 1 uploaded, 0 deleted
463+ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
464+
465+ >>> print_requests.py //unity-catalog
466+ {
467+ "method": "PATCH",
468+ "path": "/api/2.1/unity-catalog/models/test_catalog_renamed_[UNIQUE_NAME].myschema2.mymodel2",
469+ "body": {
470+ "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
471+ "comment": "c2",
472+ "new_name": "mymodel3",
473+ "schema_name": "myschema2"
474+ }
475+ }
476+
477+ >>> [CLI] registered-models get test_catalog_renamed_[UNIQUE_NAME].myschema2.mymodel3
478+ {
479+ "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mymodel3",
480+ "comment": "c2",
481+ "created_at": [MODEL_CREATED_AT]
482+ }
483+
459484=== The state tracks the new paths and the plan is a no-op
460485>>> [CLI] bundle summary --output json
461486{
462487 "catalogs": {
463488 "catalog1": "test_catalog_renamed_[UNIQUE_NAME]"
464489 },
465490 "registered_models": {
466- "model1": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mymodel2 "
491+ "model1": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mymodel3 "
467492 },
468493 "schemas": {
469494 "schema1": "test_catalog_renamed_[UNIQUE_NAME].myschema2"
0 commit comments