Skip to content

Commit 4f7fd4e

Browse files
denikIsaac
andcommitted
direct: build the re-keyed child's ID from config instead of reading it
Like the other DoUpdateWithID implementations, take the new ID from config, so a child moved by its parent's rename needs no request at all. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 6845544 commit 4f7fd4e

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

‎bundle/direct/dresources/schema.go‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,8 @@ func (r *ResourceSchema) DoUpdateWithID(ctx context.Context, id string, config *
108108
fullName := config.CatalogName + "." + nameFromID
109109

110110
if entry.Changes.OnlyParentRenamed() {
111-
// Nothing to update. Read the schema to record its full name as UC spells it: UC
112-
// lowercases names, config may not.
113-
response, err := r.DoRead(ctx, fullName)
114-
if err != nil {
115-
return "", nil, err
116-
}
117-
return response.FullName, response, nil
111+
// UC already moved the schema with its catalog; only the ID changes.
112+
return fullName, nil, nil
118113
}
119114

120115
response, err := r.client.Schemas.Update(ctx, makeUpdateSchema(fullName, newName, config))

‎bundle/direct/dresources/volume.go‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,8 @@ func (r *ResourceVolume) DoUpdateWithID(ctx context.Context, id string, config *
105105
updateRequest.Name = config.CatalogName + "." + config.SchemaName + "." + nameFromID
106106

107107
if entry.Changes.OnlyParentRenamed() {
108-
// Nothing to update. Read the volume to record its full name as UC spells it: UC
109-
// lowercases names, config may not.
110-
response, err := r.DoRead(ctx, updateRequest.Name)
111-
if err != nil {
112-
return "", nil, err
113-
}
114-
return response.FullName, response, nil
108+
// UC already moved the volume with its parent; only the ID changes.
109+
return updateRequest.Name, nil, nil
115110
}
116111

117112
if config.Name != nameFromID {

0 commit comments

Comments
 (0)