Update custom metadata¶
Custom metadata structure updates are complete replacements
You need to send the entire custom metadata structure (all of its attributes) on each update.
Retrieve existing structure¶
To ensure you have the complete structure, it is easiest to start by retrieving the existing custom metadata structure.
Update the custom metadata structure¶
Now that you have the existing structure, modify the object. You can add or remove as many properties as you want in a single update, but for simplicity the following describe how to add and remove a single property each.
Add a property¶
To add a property:
Add a property to the structure | |
---|---|
4 5 6 7 8 9 10 |
|
- After retrieving the existing custom metadata structure, clone the structure into a mutable one using
toBuilder()
. - You can append a new attribute to its list of attributes by chaining
.attributeDef()
. Use theAttributeDef.of()
factory method to define the attribute with the correct internal settings. - When using the factory method, you need to provide at least a name;
- ...a type;
- ...and whether there can be multiple values for this property (true) or only a single value (false) on a given asset.
- Then build the mutable structure.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
Add a property to the structure | |
---|---|
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
- Create a new list of attributes, starting with the list of existing attributes.
- Add a new attribute to this list of attributes. Use the
AttributeDef.create()
factory method to define the attribute with the correct internal settings. - When using the factory method, you need to provide at least a name and a type.
- Then set the attributes on the custom metadata structure to this revised list.
- And finally call the
.typedef.update()
method sending the revised custom metadata structure to actually submit the changes to Atlan.
Add a property to the structure | |
---|---|
4 5 6 7 8 9 10 |
|
- After retrieving the existing custom metadata structure, clone the structure into a mutable one using
toBuilder()
. - You can append a new attribute to its list of attributes by chaining
.attributeDef()
. Use theAttributeDef.of()
factory method to define the attribute with the correct internal settings. - When using the factory method, you need to provide at least a name;
- ...a type;
- ...and whether there can be multiple values for this property (true) or only a single value (false) on a given asset.
- Then build the mutable structure.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
PUT /api/meta/types/typedefs | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
- You need to specify the entire custom metadata structure, within the
businessMetadataDefs
array. - Include all the details of the custom metadata structure definition as you retrieved it.
- Include all the details of the custom metadata attribute definitions, as you retrieved them.
- Add the new attribute definition to the list of attribute definitions. Note that for the
name
during this update you can use any string you want, as it will be replaced by a system-generated hashed-string during creation of the property. - However, ensure you use the human-readable name you want for the property for the
displayName
of the attribute definition. Also ensure you set all the remaining pieces of the attribute definition according to the nature of the attribute you want to define.
Change a property¶
To change an existing property:
Change the custom metadata definition | |
---|---|
4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
- Create a new (mutable) empty list of attributes.
- Iterate through the existing attributes in the custom metadata structure...
-
...When you get to the attribute you want to change, modify it as-needed.
Some properties must not be changed
Do not change the attribute's
primitiveType
,isEnum
,enumType
,customType
,multiValueSelect
,isArchived
,archivedAt
, orarchivedBy
properties. These should only be set at creation or through archival methods. -
And add all attributes (existing and the modified one) into the list of revised attributes.
- You must then clone the custom metadata structure into a mutable structure, using
toBuilder()
. - You then need to clear the existing attribute definitions (otherwise the next step will only append the same definitions again).
- Then you can set the attributes on the custom metadata structure to this revised list, and build the structure.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
Change the custom metadata definition | |
---|---|
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
- Create a new empty list of attributes.
- Iterate through the existing attributes in the custom metadata structure...
- ...When you get to the attribute you want to change, you can change its
display_name
, but not much else. (You should not change its type, hashed-string name, etc.) - And add all attributes (existing and the modified one) into the list of revised attributes.
- Then set the attributes on the custom metadata structure to this revised list.
- And finally call the
typedef.update()
method sending the revised custom metadata structure to actually submit the changes to Atlan.
Change the custom metadata definition | |
---|---|
4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
- Create a new (mutable) empty list of attributes.
- Iterate through the existing attributes in the custom metadata structure...
-
...When you get to the attribute you want to change, modify it as-needed.
Some properties must not be changed
Do not change the attribute's
primitiveType
,isEnum
,enumType
,customType
,multiValueSelect
,isArchived
,archivedAt
, orarchivedBy
properties. These should only be set at creation or through archival methods. -
And add all attributes (existing and the modified one) into the list of revised attributes.
- You must then clone the custom metadata structure into a mutable structure, using
toBuilder()
. - You then need to clear the existing attribute definitions (otherwise the next step will only append the same definitions again).
- Then you can set the attributes on the custom metadata structure to this revised list, and build the structure.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
PUT /api/meta/types/typedefs | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
- You need to specify the entire custom metadata structure, within the
businessMetadataDefs
array. - Include all the details of the custom metadata structure definition as you retrieved it.
- Include all the details of the custom metadata attribute definitions, as you retrieved them.
- For the attribute you want to modify, include its hashed-string name as with all the other attribute definitions.
- However, for the
displayName
of the attribute you want to modify, change it to the new human-readable name you want to use.
Remove a property¶
To remove a property:
Remove a property from the structure | |
---|---|
4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
- Create a new (mutable) empty list of attributes.
- Iterate through the existing attributes in the custom metadata structure...
- ...When you get to the attribute you want to remove, call the
.archive()
method against it passing the name of the user deleting the attribute. - And add all attributes (existing and the removed one) into the list of revised attributes.
- You must then clone the custom metadata structure into a mutable structure, using
toBuilder()
. - You then need to clear the existing attribute definitions (otherwise the next step will only append the same definitions again).
- Then you can set the attributes on the custom metadata structure to this revised list, and build the structure.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
Change the custom metadata definition | |
---|---|
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
- Create a new empty list of attributes.
- Iterate through the existing attributes in the custom metadata structure...
- ...When you get to the attribute you want to remove, call the
.archive()
method against it passing the name of the user deleting the attribute. - And add all attributes (existing and the archived one) into the list of revised attributes.
- Then set the attributes on the custom metadata structure to this revised list.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
Remove a property from the structure | |
---|---|
4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
- Create a new (mutable) empty list of attributes.
- Iterate through the existing attributes in the custom metadata structure...
- ...When you get to the attribute you want to remove, call the
.archive()
method against it passing the name of the user deleting the attribute. - And add all attributes (existing and the removed one) into the list of revised attributes.
- You must then clone the custom metadata structure into a mutable structure, using
toBuilder()
. - You then need to clear the existing attribute definitions (otherwise the next step will only append the same definitions again).
- Then you can set the attributes on the custom metadata structure to this revised list, and build the structure.
- And finally call the
.update()
method on the revised custom metadata structure to actually submit the changes to Atlan.
PUT /api/meta/types/typedefs | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
- You need to specify the entire custom metadata structure, within the
businessMetadataDefs
array. - Include all the details of the custom metadata structure definition as you retrieved it.
- Include all the details of the custom metadata attribute definitions, as you retrieved them.
- For the attribute you want to remove, include its hashed-string name as with all the other attribute definitions.
- However, for the
displayName
of the attribute you want to remove, append-archived-
and a millisecond epoch for the current system time. - Within the
options
for the attribute definition, setisArchived
totrue
. - Within the
options
for the attribute definition, setarchivedBy
to the name of the user who is deleting the attribute. - Within the
options
for the attribute definition, setarchivedAt
to the millisecond epoch appended to thedisplayName
.
Removed properties are only soft-deleted
Note that removing a property only archives (soft-deletes) it. When retrieving the custom metadata structure again, you will still see the deleted attribute definition in the structure, but its attributeDefs.options.isArchived
property will be set to true
and its displayName
will have been changed to include the time at which it was archived.