Skip to content

Retrieve custom metadata

1.0.0 1.0.0

You can retrieve an existing custom metadata structure:

Retrieve existing custom metadata structure
1
2
3
CustomMetadataDef existing = Atlan.getDefaultClient()
    .getCustomMetadataCache()
    .getCustomMetadataDef("RACI"); // (1)
  1. You can retrieve the current custom metadata definition using the custom metadata cache from any client. In most cases you can simply use the default client (Atlan.getDefaultClient()). Pass the human-readable name of the custom metadata structure to the cache.
Retrieve existing custom metadata structure
1
2
3
from pyatlan.cache.custom_metadata_cache import CustomMetadataCache

existing = CustomMetadataCache.get_custom_metadata_def(name="RACI") # (1)
  1. You can retrieve the current custom metadata definition using the CustomMetadataCache.get_custom_metadata_def() method and passing the human-readable name of the custom metadata structure.
Retrieve existing custom metadata structure
1
2
3
val existing = Atlan.getDefaultClient()
    .customMetadataCache
    .getCustomMetadataDef("RACI") // (1)
  1. You can retrieve the current custom metadata definition using the custom metadata cache from any client. In most cases you can simply use the default client (Atlan.getDefaultClient()). Pass the human-readable name of the custom metadata structure to the cache.
GET /api/meta/types/typedefs?type=BUSINESS_METADATA
 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
{
  "businessMetadataDefs": [ // (1)
    {
      "category": "BUSINESS_METADATA", // (2)
      "guid": "917ffec9-fa84-4c59-8e6c-c7b114d04be3",
      "name": "MNJ8mpLsIOaP4OQnLNhRta", // (3)
      "displayName": "RACI", // (4)
      "description": "",
      "typeVersion": "1.0",
      "serviceType": "atlan",
      "attributeDefs": [ // (5)
        {
          "name": "fWMB77RSjRGNYoFeD4FcGi", // (6)
          "displayName": "Responsible", // (7)
          "description": "",
          "typeName": "string", // (8)
          "includeInNotification": false,
          "isIndexable": true,
          "isOptional": true,
          "isUnique": false,
          "indexType": "DEFAULT",
          "searchWeight": -1,
          "cardinality": "SINGLE",
          "valuesMinCount": 0,
          "valuesMaxCount": 1,
          "options": {
            "applicableEntityTypes": "[\"Asset\"]",
            "customApplicableEntityTypes": "[\"Database\",\"Schema\",\"Table\"]\n",
            "maxStrLength": "100000000",
            "isEnum": false,
            "multiValueSelect": false,
            "allowFiltering": true,
            "allowSearch": true,
            "primitiveType": "string",
            "customType": "users" // (9)
          }
        }
      ],
      "createdBy": "jsmith",
      "updatedBy": "jsmith",
      "createTime": 1648852296555,
      "updateTime": 1649172284333,
      "version": 2
    }
  ]
}
  1. Each custom metadata structure will be wrapped in the top-level businessMetadataDefs array.
  2. Each custom metadata structure object will have a category of BUSINESS_METADATA.
  3. The name of a custom metadata structure is a unique hashed-string, but is not human-readable. This is how the custom metadata is uniquely referred to through the raw APIs.
  4. The displayName of a custom metadata structure is the human-readable name you see in the UI.
  5. Each property defined within the custom metadata structure is nested within an attributeDefs array.
  6. As with the overall custom metadata structure, each attribute has a unique hashed-string name that is not human-readable. This is how the custom metadata property is uniquely referred to through the raw APIs.
  7. As with the overall custom metadata structure, each attribute also has a displayName that is the human-readable name you see in the UI.
  8. The type of the custom metadata property is its simple type, but does not include custom types like SQL, users, groups and so on.
  9. For the precise type, you also need to look at the customType within the options, within the attribute definition.