Manage Preset assets
Operations on Preset assets (connections, workspaces, collections, charts, datasets).
In general, these should be:
- Created in top-down order (connection, then workspace, then collection, then charts and datasets)
- Deleted in bottom-up order (charts and datasets, then collections, then workspaces, then connections)1
Asset structure
Connection
A Preset connection requires a name and qualifiedName. For creation, specific settings are also required to distinguish it as a Preset connection rather than another type of connection. In addition, at least one of adminRoles, adminGroups, or adminUsers must be provided.
- Java
- Python
- Kotlin
- Raw REST API
String adminRoleGuid = client.getRoleCache().getIdForName("$admin"); // (1)
Connection connection = Connection.creator( // (2)
"preset-connection", // (3)
AtlanConnectorType.PRESET, // (4)
List.of(adminRoleGuid), // (5)
List.of("group2"), // (6)
List.of("jsmith")) // (7)
.build();
AssetMutationResponse response = connection.save(client); // (8)
String connectionQualifiedName = response.getCreatedAssets().get(0).getQualifiedName(); // (9)
- Retrieve the GUID for the admin role, to use later for defining the roles that can administer the connection.
- Build up the minimum request to create a connection.
- Provide a human-readable name for your connection, such as
productionordevelopment. - Set the type of connection to Preset.
- List the workspace roles that should be able to administer the connection (or null if none). All users with that workspace role (current and future) will be administrators of the connection. Note that the values here need to be the GUIDs of the workspace roles. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - List the group names that can administer this connection (or null if none). All users within that group (current and future) will be administrators of the connection. Note that the values here are the names of the groups. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - List the user names that can administer this connection (or null if none). Note that the values here are the usernames of the users. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - Actually call Atlan to create the connection. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the qualifiedName for use in subsequent creation calls. (You'd probably want to do some null checking first.)
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Connection, PresetWorkspace, PresetDashboard, PresetChart, PresetDataset
from pyatlan.model.enums import AtlanConnectorType
client = AtlanClient()
admin_role_guid = client.role_cache.get_id_for_name("$admin") # (1)
connection = Connection.creator( # (2)
client=client, # (3)
name="preset-connection", # (4)
connector_type=AtlanConnectorType.PRESET, # (5)
admin_roles=[admin_role_guid], # (6)
admin_groups=["group2"], # (7)
admin_users=["jsmith"] # (8)
)
response = client.asset.save(connection) # (9)
connection_qualified_name = response.assets_created(asset_type=Connection)[0].qualified_name # (10)
- Retrieve the GUID for the admin role, to use later for defining the roles that can administer the connection.
- Build up the minimum request to create a connection.
- You must provide a client instance.
- Provide a human-readable name for your connection, such as
productionordevelopment. - Set the type of connection to Preset.
- List the workspace roles that should be able to administer the connection (or
Noneif none). All users with that workspace role (current and future) will be administrators of the connection. Note that the values here need to be the GUIDs of the workspace roles. At least one ofadmin_roles,admin_groups, oradmin_usersmust be provided. - List the group names that can administer this connection (or
Noneif none). All users within that group (current and future) will be administrators of the connection. Note that the values here are the names of the groups. At least one ofadmin_roles,admin_groups, oradmin_usersmust be provided. - List the user names that can administer this connection (or
Noneif none). Note that the values here are the usernames of the users. At least one ofadmin_roles,admin_groups, oradmin_usersmust be provided. - Actually call Atlan to create the connection.
- Retrieve the
qualified_namefor use in subsequent creation calls. (You'd probably want to do some null checking first.)
val adminRoleGuid = client.roleCache.getIdForName("\$admin") // (1)
val connection = Connection.creator( // (2)
"preset-connection", // (3)
AtlanConnectorType.PRESET, // (4)
listOf(adminRoleGuid), // (5)
listOf("group2"), // (6)
listOf("jsmith")) // (7)
.build()
val response = connection.save(client) // (8)
val connectionQualifiedName = response.createdAssets[0].qualifiedName // (9)
- Retrieve the GUID for the admin role, to use later for defining the roles that can administer the connection.
- Build up the minimum request to create a connection.
- Provide a human-readable name for your connection, such as
productionordevelopment. - Set the type of connection to Preset.
- List the workspace roles that should be able to administer the connection (or null if none). All users with that workspace role (current and future) will be administrators of the connection. Note that the values here need to be the GUIDs of the workspace roles. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - List the group names that can administer this connection (or null if none). All users within that group (current and future) will be administrators of the connection. Note that the values here are the names of the groups. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - List the user names that can administer this connection (or null if none). Note that the values here are the usernames of the users. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - Actually call Atlan to create the connection. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the qualifiedName for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "Connection", // (1)
"attributes": {
"name": "preset-connection", // (2)
"connectorName": "preset", // (3)
"qualifiedName": "default/preset/123456789", // (4)
"category": "bi", // (5)
"adminRoles": [ // (6)
"e7ae0295-c60a-469a-bd2c-fb903943aa02"
],
"adminGroups": [ // (7)
"group2"
],
"adminUsers": [ // (8)
"jsmith"
]
}
}
]
}
- The
typeNamemust be exactlyConnection. - Human-readable name for your connection, such as
productionordevelopment. - The
connectorNamemust be exactlypreset. - The
qualifiedNameshould follow the pattern:default/preset/<epoch>, where<epoch>is the time in milliseconds at which the connection is being created. - The
categorymust bebi. - List any workspace roles that can administer this connection. All users with that workspace role (current and future) will be administrators of the connection. Note that the values here need to be the GUIDs of the workspace roles. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - List any groups that can administer this connection. All users within that group (current and future) will be administrators of the connection. Note that the values here are the names of the groups. At least one of
adminRoles,adminGroups, oradminUsersmust be provided. - List any users that can administer this connection. Note that the values here are the usernames of the users. At least one of
adminRoles,adminGroups, oradminUsersmust be provided.
Atlan creates the policies that grant access to a connection, including the ability to retrieve the connection and to create assets within it, asynchronously. It can take several seconds (even up to approximately 30 seconds) before these are in place after creating the connection.
You may therefore need to wait before you'll be able to create the assets below within the connection.
To confirm access, retrieve the connection after it has been created. The SDKs' retry loops will automatically retry until the connection can be successfully retrieved. At that point, your API token has permission to create the other assets.
Note: if you are reusing an existing connection rather than creating one via your API token, you must give your API token a persona that has access to that connection. Otherwise all attempts to create, read, update, or delete assets within that connection will fail due to a lack of permissions.
PresetWorkspace
A Preset workspace requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the workspace.
- Java
- Python
- Kotlin
- Raw REST API
PresetWorkspace workspace = PresetWorkspace.creator( // (1)
"ps-workspace", // (2)
connectionQualifiedName) // (3)
.build();
AssetMutationResponse response = workspace.save(client); // (4)
workspace = response.getResult(workspace); // (5)
- Build up the minimum request to create a workspace.
- Provide a human-readable name for your workspace.
- Provide the qualifiedName of the connection for this workspace.
- Actually call Atlan to create the workspace. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created workspace for use in subsequent creation calls. (You'd probably want to do some null checking first.)
workspace = PresetWorkspace.creator( # (1)
name = "ps-workspace", # (2)
connection_qualified_name = connection_qualified_name # (3)
)
response = client.asset.save(workspace) # (4)
preset_workspace_qualified_name = response.assets_created(asset_type=PresetWorkspace)[0].qualified_name # (5)
- Build up the minimum request to create a workspace.
- Provide a human-readable name for your workspace.
- Provide the
qualified_nameof the connection for this workspace. - Actually call Atlan to create the workspace.
- Retrieve the created workspace for use in subsequent creation calls. (You'd probably want to do some null checking first.)
var workspace = PresetWorkspace.creator( // (1)
"ps-workspace", // (2)
connectionQualifiedName) // (3)
.build()
val response = workspace.save(client) // (4)
workspace = response.getResult(workspace) // (5)
- Build up the minimum request to create a workspace.
- Provide a human-readable name for your workspace.
- Provide the qualifiedName of the connection for this workspace.
- Actually call Atlan to create the workspace. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created workspace for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "PresetWorkspace", // (1)
"attributes": {
"name": "ps-workspace", // (2)
"qualifiedName": "default/preset/123456789/ps-workspace", // (3)
"connectionQualifiedName": "default/preset/123456789", // (4)
"connectorName": "preset" // (5)
}
}
]
}
- The
typeNamemust be exactlyPresetWorkspace. - Human-readable name for your workspace.
- The
qualifiedNameshould follow the pattern:default/preset/<epoch>/<workspace_name>, wheredefault/preset/<epoch>is the qualifiedName of the connection for this workspace and<workspace_name>is the name of the workspace. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this workspace. - The
connectorNamemust be exactlypreset.
PresetDashboard
A Preset collection requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the collection, and the names and qualifiedNames of the collection's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
PresetDashboard collection = PresetDashboard.creator( // (1)
"ps-collection", // (2)
workspace) // (3)
.build();
AssetMutationResponse response = collection.save(client); // (4)
collection = response.getResult(collection); // (5)
- Build up the minimum request to create a collection.
- Provide a human-readable name for your collection.
- Provide the workspace for this collection. If you didn't already have the object, you could also use
PresetWorkspace.refByGuid()with the GUID of the workspace, orPresetWorkspace.refByQualifiedName()with thequalifiedNameof the workspace. - Actually call Atlan to create the collection. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created collection for use in subsequent creation calls. (You'd probably want to do some null checking first.)
collection = PresetDashboard.creator( # (1)
name = "ps-collection", # (2)
preset_workspace_qualified_name = preset_workspace_qualified_name # (3)
)
response = client.asset.save(collection) # (4)
preset_dashboard_qualified_name = response.assets_created(asset_type=PresetDashboard)[0].qualified_name # (5)
- Build up the minimum request to create a collection.
- Provide a human-readable name for your collection.
- Provide the
qualified_nameof the Preset workspace for this collection. - Actually call Atlan to create the collection.
- Retrieve the created collection for use in subsequent creation calls. (You'd probably want to do some null checking first.)
var collection = PresetDashboard.creator( // (1)
"ps-collection", // (2)
workspace) // (3)
.build()
val response = collection.save(client) // (4)
collection = response.getResult(collection) // (5)
- Build up the minimum request to create a collection.
- Provide a human-readable name for your collection.
- Provide the workspace for this collection. If you didn't already have the object, you could also use
PresetWorkspace.refByGuid()with the GUID of the workspace, orPresetWorkspace.refByQualifiedName()with thequalifiedNameof the workspace. - Actually call Atlan to create the collection. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created collection for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "PresetDashboard", // (1)
"attributes": {
"name": "ps-collection", // (2)
"qualifiedName": "default/preset/123456789/ps-workspace/ps-collection", // (3)
"connectionQualifiedName": "default/preset/123456789", // (4)
"connectorName": "preset", // (5)
"presetWorkspace": { // (6)
"typeName": "PresetWorkspace", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/preset/123456789/ps-workspace"
}
},
"presetWorkspaceQualifiedName": "default/preset/123456789/ps-workspace" // (9)
}
}
]
}
- The
typeNamemust be exactlyPresetDashboard. - Human-readable name for your collection.
- The
qualifiedNameshould follow the pattern:default/preset/<epoch>/<workspace_name>/<collection_name>, wheredefault/preset/<epoch>/<workspace_name>is the qualifiedName of the workspace for this collection and<collection_name>is the name for this collection. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this collection. - The
connectorNamemust be exactlypreset. - The workspace in which this collection exists is embedded in the
presetWorkspaceattribute. - The
typeNamefor this embedded reference must bePresetWorkspace. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the workspace. Note: the workspace must already exist in Atlan before creating the collection. - The
presetWorkspaceQualifiedNameshould be the qualifiedName of the workspace.
PresetChart
A Preset chart requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the chart, and the names and qualifiedNames of the chart's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
PresetChart chart = PresetChart.creator( // (1)
"ps-chart", // (2)
collection) // (3)
.build();
AssetMutationResponse response = chart.save(client); // (4)
- Build up the minimum request to create a chart.
- Provide a human-readable name for your chart.
- Provide the collection for this chart.
- Actually call Atlan to create the chart. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant.
chart = PresetChart.creator( # (1)
name = "ps-chart ", # (2)
preset_dashboard_qualified_name = preset_dashboard_qualified_name # (3)
)
response = client.asset.save(chart) # (4)
- Build up the minimum request to create a chart.
- Provide a human-readable name for your chart.
- Provide the
qualified_nameof the collection. - Actually call Atlan to create the chart.
val chart = PresetChart.creator( // (1)
"ps-chart", // (2)
collection) // (3)
.build()
val response = chart.save(client) // (4)
- Build up the minimum request to create a chart.
- Provide a human-readable name for your chart.
- Provide the collection for this chart.
- Actually call Atlan to create the chart. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant.
{
"entities": [
{
"typeName": "PresetChart", // (1)
"attributes": {
"name": "ps-chart", // (2)
"qualifiedName": "default/preset/123456789/ps-workspace/ps-collection/ps-chart", // (3)
"connectionQualifiedName": "default/preset/123456789", // (4)
"connectorName": "preset", // (5)
"presetDashboard": { // (6)
"typeName": "PresetDashboard", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/preset/123456789/ps-workspace/ps-collection"
}
},
"presetDashboardQualifiedName": "default/preset/123456789/ps-workspace/ps-collection", // (9)
"presetWorkspaceQualifiedName": "default/preset/123456789/ps-workspace" // (10)
}
}
]
}
- The
typeNamemust be exactlyPresetChart. - Human-readable name for your chart.
- The
qualifiedNameshould follow the pattern:default/preset/<epoch>/<workspace_name>/<collection_name>/<chart_name>, wheredefault/preset/<epoch>/<workspace_name>/<collection_name>is the qualifiedName of the collection for this chart and<chart_name>is the name for this chart. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this chart. - The
connectorNamemust be exactlypreset. - The collection in which this chart exists is embedded in the
presetDashboardattribute. - The
typeNamefor this embedded reference must bePresetDashboard. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the collection. Note: the collection must already exist in Atlan before creating the chart. - The
presetDashboardQualifiedNameshould be the qualifiedName of the collection. - The
presetWorkspaceQualifiedNameshould be the qualifiedName of the workspace.
PresetDataset
A Preset dataset requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the dataset, and the names and qualifiedNames of the dataset's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
PresetDataset dataset = PresetDataset.creator( // (1)
"ps-dataset", // (2)
collection) // (3)
.build();
AssetMutationResponse response = dataset.save(client); // (4)
- Build up the minimum request to create a dataset.
- Provide a human-readable name for your dataset.
- Provide the collection for this dataset.
- Actually call Atlan to create the dataset. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant.
dataset = PresetDataset.creator( # (1)
name = "ps-dataset ", # (2)
preset_dashboard_qualified_name = preset_dashboard_qualified_name # (3)
)
response = client.asset.save(dataset) # (4)
- Build up the minimum request to create a dataset.
- Provide a human-readable name for your dataset.
- Provide the
qualified_nameof the collection. - Actually call Atlan to create the dataset.
val dataset = PresetDataset.creator( // (1)
"ps-dataset", // (2)
collection) // (3)
.build()
val response = dataset.save(client) // (4)
- Build up the minimum request to create a dataset.
- Provide a human-readable name for your dataset.
- Provide the collection for this dataset.
- Actually call Atlan to create the dataset. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant.
{
"entities": [
{
"typeName": "PresetDataset", // (1)
"attributes": {
"name": "ps-dataset", // (2)
"qualifiedName": "default/preset/123456789/ps-workspace/ps-collection/ps-dataset", // (3)
"connectionQualifiedName": "default/preset/123456789", // (4)
"connectorName": "preset", // (5)
"presetDashboard": { // (6)
"typeName": "PresetDashboard", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/preset/123456789/ps-workspace/ps-collection"
}
},
"presetDashboardQualifiedName": "default/preset/123456789/ps-workspace/ps-collection", // (9)
"presetWorkspaceQualifiedName": "default/preset/123456789/ps-workspace" // (10)
}
}
]
}
- The
typeNamemust be exactlyPresetDataset. - Human-readable name for your dataset.
- The
qualifiedNameshould follow the pattern:default/preset/<epoch>/<workspace_name>/<collection_name>/<dataset_name>, wheredefault/preset/<epoch>/<workspace_name>/<collection_name>is the qualifiedName of the collection for this dataset and<dataset_name>is the name for this dataset. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this dataset. - The
connectorNamemust be exactlypreset. - The collection in which this dataset exists is embedded in the
presetDashboardattribute. - The
typeNamefor this embedded reference must bePresetDashboard. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the collection. Note: the collection must already exist in Atlan before creating the dataset. - The
presetDashboardQualifiedNameshould be the qualifiedName of the collection. - The
presetWorkspaceQualifiedNameshould be the qualifiedName of the workspace.
Available relationships
Every level of the business intelligence structure is an Asset, and can therefore be related to the following other assets.