Manage relational assets
You can represent most relational database and data warehousing objects through a common set of relational assets. You can use this structure to create assets for any relational system you like:
In general, these should be:
- Created in top-down order (connection, then database, then schema, and so on)
- Deleted in bottom-up order (columns, then tables, then schema, then database, then connection)1
Atlan will display icons for these assets based on the type of connector you define in the Connection. You can use out-of-the-box types like athena, or API-first types like netsuite and vertica.
However, note that in all cases the same structure (and types) as illustrated above are used—there are no differences in types between these relational assets across different systems.
Asset structure
Connection
A connection requires a name and qualifiedName. As noted above, a specific setting is also required to determine the icons to use for assets in the 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)
"relational-connection", // (3)
AtlanConnectorType.VERTICA, // (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.
Determines the icon
This determines the icon that Atlan will use for all the assets in the connection.
:::
5. 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, or adminUsers must be provided.
6. 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, or adminUsers must be provided.
7. 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, or adminUsers must be provided.
8. Actually call Atlan to create the connection. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
9. 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, Database, Schema, Table, View, MaterialisedView, Column
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="relational-connection", # (4)
connector_type=AtlanConnectorType.VERTICA, # (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.
Determines the icon
This determines the icon that Atlan will use for all the assets in the connection.
:::
6. List the workspace roles that should be able to administer the connection (if any, defaults to 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 admin_roles, admin_groups, or admin_users must be provided.
7. List the group names that can administer this connection (if any, defaults to 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 admin_roles, admin_groups, or admin_users must be provided.
8. List the user names that can administer this connection (if any, defaults to None). Note that the values here are the usernames of the users. At least one of admin_roles, admin_groups, or admin_users must be provided.
9. Actually call Atlan to create the connection.
10. Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
val adminRoleGuid = client.roleCache.getIdForName("\$admin"); // (1)
val connection = Connection.creator( // (2)
"relational-connection", // (3)
AtlanConnectorType.VERTICA, // (4)
listOf(adminRoleGuid), // (5)
listOf("group2"), // (6)
listOf("jsmith")) // (7)
.build()
var 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.
Determines the icon
This determines the icon that Atlan will use for all the assets in the connection.
:::
5. 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, or adminUsers must be provided.
6. 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, or adminUsers must be provided.
7. 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, or adminUsers must be provided.
8. Actually call Atlan to create the connection. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
9. 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": "relational-connection", // (2)
"connectorName": "vertica", // (3)
"qualifiedName": "default/vertica/123456789", // (4)
"category": "warehouse", // (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
connectorNameshould be a known value, such asvertica.Determines the icon
This determines the icon that Atlan will use for all the assets in the connection. If you use a value that's not a known value, you will have a default gear icon instead.
:::
4. The qualifiedName should follow the pattern: default/<connectorName>/<epoch>, where <epoch> is the time in milliseconds at which the connection is being created, and <connectorName> exactly matches the value used for connectorName (above).
5. The category should also be a known value, that defines the kind of relational store. This could for example be warehouse or rdbms.
6. 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, or adminUsers must be provided.
7. 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, or adminUsers must be provided.
8. 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, or adminUsers must 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.
Database
A database requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the database.
- Java
- Python
- Kotlin
- Raw REST API
Database database = Database.creator( // (1)
"reln_db", // (2)
connectionQualifiedName) // (3)
.schemaCount(10) // (4)
.build();
AssetMutationResponse response = database.save(client); // (5)
database = response.getResult(database); // (6)
- Build up the minimum request to create a database.
- Provide a human-readable name for your database.
- Provide the qualifiedName of the connection for this database.
- (Optional) To make sure the UI displays the correct count of
Schema's, set theschemaCountdirectly on theDatabaseinstance. - Actually call Atlan to create the database. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created database for use in subsequent creation calls. (You'd probably want to do some null checking first.)
database = Database.creator( # (1)
name="reln_db", # (2)
connection_qualified_name=connection_qualified_name # (3)
)
database.schema_count = 10 # (4)
response = client.asset.save(database) # (5)
database_qualified_name = response.assets_created(asset_type=Database)[0].qualified_name # (6)
- Build up the minimum request to create a database.
- Provide a human-readable name for your database.
- Provide the qualified_name of the connection for this database.
- (Optional) To make sure the UI displays the correct count of
Schema's, set theschema_countdirectly on theDatabaseinstance. - Actually call Atlan to create the database.
- Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
var database = Database.creator( // (1)
"reln_db", // (2)
connectionQualifiedName) // (3)
.schemaCount(10) // (4)
.build()
var ar = database.save(client) // (5)
database = ar.getResult(database) // (6)
- Build up the minimum request to create a database.
- Provide a human-readable name for your database.
- Provide the qualifiedName of the connection for this database.
- (Optional) To make sure the UI displays the correct count of
Schema's, set theschemaCountdirectly on theDatabaseinstance. - Actually call Atlan to create the database. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created database for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "Database", // (1)
"attributes": {
"name": "reln_db", // (2)
"qualifiedName": "default/vertica/123456789/reln_db", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"schemaCount": 10 // (6)
}
}
]
}
- The
typeNamemust be exactlyDatabase. - Human-readable name for your database.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>, wheredefault/<connectorName>/<epoch>is the qualifiedName of the connection for this database and<db_name>is the name of this database. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this database. - The
connectorNamemust be exactly as used when defining the connection. - (Optional) To make sure the UI displays the correct count of
Schema's, set theschemaCountdirectly on theDatabaseinstance.
Schema
A schema requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the schema, and the names and qualifiedNames of the schema's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
Schema schema = Schema.creator( // (1)
"reln_schema", // (2)
database) // (3)
.tableCount(10) // (4)
.viewCount(10) // (5)
.build();
AssetMutationResponse response = schema.save(client); // (6)
schema = response.getResult(schema); // (7)
- Build up the minimum request to create a schema.
- Provide a human-readable name for your schema.
- Provide the database for this schema. If you didn't already have the object, you could also use
Database.refByGuid()with the GUID of the database, orDatabase.refByQualifiedName()with thequalifiedNameof the database. - (Optional) To make sure the UI displays the correct count of
Table's, set thetableCountdirectly on theSchemainstance. - (Optional) To make sure the UI displays the correct count of
View's, set theviewCountdirectly on theSchemainstance. - Actually call Atlan to create the schema. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created schema for use in subsequent creation calls. (You'd probably want to do some null checking first.)
schema = Schema.creator( # (1)
name="reln_schema", # (2)
database_qualified_name=database_qualified_name # (3)
)
schema.table_count = 10 # (4)
schema.views_count = 10 # (5)
response = client.asset.save(schema) # (6)
schema_qualified_name = response.assets_created(asset_type=Schema)[0].qualified_name # (7)
- Build up the minimum request to create a schema.
- Provide a human-readable name for your schema.
- Provide the qualified_name of the database for this schema.
- (Optional) To make sure the UI displays the correct count of
Table's, set thetable_countdirectly on theSchemainstance. - (Optional) To make sure the UI displays the correct count of
View's, set theviews_countdirectly on theSchemainstance. - Actually call Atlan to create the schema.
- Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
var schema = Schema.creator( // (1)
"reln_schema", // (2)
database) // (3)
.tableCount(10) // (4)
.viewCount(10) // (5)
.build()
ar = schema.save(client) // (6)
schema = ar.getResult(schema) // (7)
- Build up the minimum request to create a schema.
- Provide a human-readable name for your schema.
- Provide the database for this schema. If you didn't already have the object, you could also use
Database.refByGuid()with the GUID of the database, orDatabase.refByQualifiedName()with thequalifiedNameof the database. - (Optional) To make sure the UI displays the correct count of
Table's, set thetableCountdirectly on theSchemainstance. - (Optional) To make sure the UI displays the correct count of
View's, set theviewCountdirectly on theSchemainstance. - Actually call Atlan to create the schema. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created schema for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "Schema", // (1)
"attributes": {
"name": "reln_schema", // (2)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"database": { // (6)
"typeName": "Database", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/vertica/123456789/reln_db"
}
},
"databaseName": "reln_db", // (9)
"databaseQualifiedName": "default/vertica/123456789/reln_db", // (10)
"viewCount": 10 // (11)
}
}
]
}
- The
typeNamemust be exactlySchema. - Human-readable name for your schema.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>/<schema_name>, wheredefault/<connectorName>/<epoch>/<db_name>is the qualifiedName of the database for this schema, and<schema_name>is the name of the schema. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this schema. - The
connectorNamemust be exactly as used when defining the connection. - The database in which this schema exists is embedded in the
databaseattribute. - The
typeNamefor this embedded reference must beDatabase. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the database. Note: the database must already exist in Atlan before creating the schema. - The
databaseNameshould be the human-readable name of the database. - The
databaseQualifiedNameshould be the qualifiedName of the database. - (Optional) To make sure the UI displays the correct count of
View's, set theviewCountdirectly on theSchemainstance.
Table
A table requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the table, and the names and qualifiedNames of the table's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
Table table = Table.creator( // (1)
"reln_table", // (2)
schema) // (3)
.columnCount(10) // (4)
.build();
AssetMutationResponse response = table.save(client); // (5)
table = response.getResult(table).get(0).getQualifiedName(); // (6)
- Build up the minimum request to create a table.
- Provide a human-readable name for your table.
- Provide the schema for this table. If you didn't already have the object, you could also use
Schema.refByGuid()with the GUID of the schema, orSchema.refByQualifiedName()with thequalifiedNameof the schema. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theTableinstance. - Actually call Atlan to create the table. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created table for use in subsequent creation calls. (You'd probably want to do some null checking first.)
table = Table.creator( # (1)
name="reln_table", # (2)
schema_qualified_name=schema_qualified_name # (3)
)
table.column_count = 10 # (4)
response = client.asset.save(table) # (5)
table_qualified_name = response.assets_created(asset_type=Table)[0].qualified_name # (6)
- Build up the minimum request to create a table.
- Provide a human-readable name for your table.
- Provide the qualified_name of the schema for this table.
- (Optional) To make sure the UI displays the correct count of
Column's, set thecolumn_countdirectly on theTableinstance. - Actually call Atlan to create the table.
- Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
var table = Table.creator( // (1)
"reln_table", // (2)
schema) // (3)
.columnCount(10) // (4)
.build()
ar = table.save(client) // (5)
table = ar.getResult(table) // (6)
- Build up the minimum request to create a table.
- Provide a human-readable name for your table.
- Provide the schema for this table. If you didn't already have the object, you could also use
Schema.refByGuid()with the GUID of the schema, orSchema.refByQualifiedName()with thequalifiedNameof the schema. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theTableinstance. - Actually call Atlan to create the table. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created table for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "Table", // (1)
"attributes": {
"name": "reln_table", // (2)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"atlanSchema": { // (6)
"typeName": "Schema", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema"
}
},
"schemaName": "reln_schema", // (9)
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema", // (10)
"databaseName": "reln_db", // (11)
"databaseQualifiedName": "default/vertica/123456789/reln_db", // (12)
"columnCount": 10 // (13)
}
}
]
}
- The
typeNamemust be exactlyTable. - Human-readable name for your table.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>/<schema_name>/<table_name>, wheredefault/<connectorName>/<epoch>/<db_name>/<schema_name>is the qualifiedName of the schema for this table, and<table_name>is the name of the table. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this table. - The
connectorNamemust be exactly as used when defining the connection. - The schema in which this table exists is embedded in the
atlanSchemaattribute. - The
typeNamefor this embedded reference must beSchema. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the schema. Note: the schema must already exist in Atlan before creating the table. - The
schemaNameshould be the human-readable name of the schema. - The
schemaQualifiedNameshould be the qualifiedName of the schema. - The
databaseNameshould be the human-readable name of the database. - The
databaseQualifiedNameshould be the qualifiedName of the database. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theTableinstance.
View
A view requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the view, and the names and qualifiedNames of the view's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
View view = View.creator( // (1)
"reln_view", // (2)
schema) // (3)
.columnCount(10) // (4)
.build();
AssetMutationResponse response = view.save(client); // (5)
view = response.getResult(view); // (6)
- Build up the minimum request to create a view.
- Provide a human-readable name for your view.
- Provide the schema for this table. If you didn't already have the object, you could also use
Schema.refByGuid()with the GUID of the schema, orSchema.refByQualifiedName()with thequalifiedNameof the schema. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theViewinstance. - Actually call Atlan to create the view. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created view for use in subsequent creation calls. (You'd probably want to do some null checking first.)
view = View.creator( # (1)
name="reln_view", # (2)
schema_qualified_name=schema_qualified_name # (3)
)
view.column_count = 10 # (4)
response = client.asset.save(view) # (5)
view_qualified_name = response.assets_created(asset_type=View)[0].qualified_name # (6)
- Build up the minimum request to create a view.
- Provide a human-readable name for your view.
- Provide the qualified_name of the schema for this view.
- (Optional) To make sure the UI displays the correct count of
Column's, set thecolumn_countdirectly on theViewinstance. - Actually call Atlan to create the view.
- Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
var view = View.creator( // (1)
"reln_view", // (2)
schema) // (3)
.columnCount(10) // (4)
.build()
ar = view.save(client) // (5)
view = ar.getResult(view) // (6)
- Build up the minimum request to create a view.
- Provide a human-readable name for your view.
- Provide the schema for this table. If you didn't already have the object, you could also use
Schema.refByGuid()with the GUID of the schema, orSchema.refByQualifiedName()with thequalifiedNameof the schema. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theViewinstance. - Actually call Atlan to create the view. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created view for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "View", // (1)
"attributes": {
"name": "reln_view", // (2)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"atlanSchema": { // (6)
"typeName": "Schema", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema"
}
},
"schemaName": "reln_schema", // (9)
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema", // (10)
"databaseName": "reln_db", // (11)
"databaseQualifiedName": "default/vertica/123456789/reln_db", // (12)
"columnCount": 10 // (13)
}
}
]
}
- The
typeNamemust be exactlyView. - Human-readable name for your view.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>/<schema_name>/<view_name>, wheredefault/<connectorName>/<epoch>/<db_name>/<schema_name>is the qualifiedName of the schema for this view, and<view_name>is the name of the view. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this view. - The
connectorNamemust be exactly as used when defining the connection. - The schema in which this view exists is embedded in the
atlanSchemaattribute. - The
typeNamefor this embedded reference must beSchema. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the schema. Note: the schema must already exist in Atlan before creating the view. - The
schemaNameshould be the human-readable name of the schema. - The
schemaQualifiedNameshould be the qualifiedName of the schema. - The
databaseNameshould be the human-readable name of the database. - The
databaseQualifiedNameshould be the qualifiedName of the database. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theViewinstance.
MaterialisedView
A materialized view requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the materialized view, and the names and qualifiedNames of the materialized view's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
MaterializedView mview = MaterializedView.creator( // (1)
"reln_mat_view", // (2)
schema) // (3)
.columnCount(10) // (4)
.build();
AssetMutationResponse response = mview.save(client); // (5)
mview = response.getResult(mview); // (6)
- Build up the minimum request to create a materialized view.
- Provide a human-readable name for your materialized view.
- Provide the schema for this table. If you didn't already have the object, you could also use
Schema.refByGuid()with the GUID of the schema, orSchema.refByQualifiedName()with thequalifiedNameof the schema. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theMaterializedViewinstance. - Actually call Atlan to create the materialized view. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created materialized view for use in subsequent creation calls. (You'd probably want to do some null checking first.)
mview = MaterialisedView.creator( # (1)
name="reln_mat_view", # (2)
schema_qualified_name=schema_qualified_name # (3)
)
mview.column_count = 10
response = client.asset.save(mview) # (5)
mview_qualified_name = response.assets_created(asset_type=MaterialisedView)[0].qualified_name # (6)
- Build up the minimum request to create a materialized view.
- Provide a human-readable name for your materialized view.
- Provide the qualified_name of the schema for this materialized view.
- (Optional) To make sure the UI displays the correct count of
Column's, set thecolumn_countdirectly on theMaterializedViewinstance. - Actually call Atlan to create the materialized view.
- Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
var mview = MaterializedView.creator( // (1)
"reln_mat_view", // (2)
schema) // (3)
.columnCount(10) // (4)
.build();
ar = mview.save(client) // (5)
mview = ar.getResult(mview) // (6)
- Build up the minimum request to create a materialized view.
- Provide a human-readable name for your materialized view.
- Provide the schema for this table. If you didn't already have the object, you could also use
Schema.refByGuid()with the GUID of the schema, orSchema.refByQualifiedName()with thequalifiedNameof the schema. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theMaterializedViewinstance. - Actually call Atlan to create the materialized view. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant. - Retrieve the created materialized view for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "MaterialisedView", // (1)
"attributes": {
"name": "reln_mat_view", // (2)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_mat_view", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"atlanSchema": { // (6)
"typeName": "Schema", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema"
}
},
"schemaName": "reln_schema", // (9)
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema", // (10)
"databaseName": "reln_db", // (11)
"databaseQualifiedName": "default/vertica/123456789/reln_db", // (12)
"columnCount": 10 // (13)
}
}
]
}
- The
typeNamemust be exactlyMaterialisedView. (Yes, the :flag_gb: spelling, with ansnot az.) - Human-readable name for your materialized view.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>/<schema_name>/<view_name>, wheredefault/<connectorName>/<epoch>/<db_name>/<schema_name>is the qualifiedName of the schema for this materialized view, and<view_name>is the name of the materialized view. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this materialized view. - The
connectorNamemust be exactly as used when defining the connection. - The schema in which this materialized view exists is embedded in the
atlanSchemaattribute. - The
typeNamefor this embedded reference must beSchema. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the schema. Note: the schema must already exist in Atlan before creating the materialized view. - The
schemaNameshould be the human-readable name of the schema. - The
schemaQualifiedNameshould be the qualifiedName of the schema. - The
databaseNameshould be the human-readable name of the database. - The
databaseQualifiedNameshould be the qualifiedName of the database. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theMaterializedViewinstance.
TablePartition
A table partition requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the table partition, and the names and qualifiedNames of the table partition's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
TablePartition tpartition = TablePartition.creator( // (1)
"reln_table_partition", // (2)
table) // (3)
.columnCount(10) // (4)
.build();
AssetMutationResponse response = tpartition.save(); // (5)
tpartition = response.getResult(tpartition); // (6)
- Build up the minimum request to create a table partition.
- Provide a human-readable name for your table partition.
- Provide the table for this table partition. If you didn't already have the object, you could also use
Table.refByGuid()with the GUID of the table, orTable.refByQualifiedName()with thequalifiedNameof the table. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theTablePartitioninstance. - Actually call Atlan to create the table partition.
- Retrieve the created table partition for use in subsequent creation calls. (You'd probably want to do some null checking first.)
tpartition = TablePartition.creator( # (1)
name="reln_table_partition", # (2)
table_qualified_name=table_qualified_name # (3)
)
tpartition.column_count = 10 # (4)
response = client.asset.save(tpartition) # (5)
tpartition_qualified_name = response.assets_created(asset_type=TablePartition)[0].qualified_name # (6)
- Build up the minimum request to create a table partition.
- Provide a human-readable name for your table partition.
- Provide the qualified_name of the table for this table partition.
- (Optional) To make sure the UI displays the correct count of
Column's, set thecolumn_countdirectly on theTablePartitioninstance. - Actually call Atlan to create the table partition.
- Retrieve the qualified_name for use in subsequent creation calls. (You'd probably want to do some checks first.)
var tpartition = TablePartition.creator( // (1)
"reln_table_partition", // (2)
table) // (3)
.columnCount(10) // (4)
.build()
ar = tpartition.save() // (4)
tpartition = ar.getResult(tpartition) // (5)
- Build up the minimum request to create a table partition.
- Provide a human-readable name for your table partition.
- Provide the table for this table partition. If you didn't already have the object, you could also use
Table.refByGuid()with the GUID of the table, orTable.refByQualifiedName()with thequalifiedNameof the table. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theTablePartitioninstance. - Actually call Atlan to create the table partition.
- Retrieve the created table partition for use in subsequent creation calls. (You'd probably want to do some null checking first.)
{
"entities": [
{
"typeName": "TablePartition", // (1)
"attributes": {
"name": "reln_table_partition", // (2)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table_partition", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"schemaName": "reln_schema", // (6)
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema", // (7)
"databaseName": "reln_db", // (8)
"databaseQualifiedName": "default/vertica/123456789/reln_db", // (9)
"tableName": "reln_table",
"tableQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table",
"columnCount": 10 // (12)
}
}
]
}
- The
typeNamemust be exactlyTablePartition. - Human-readable name for your table partition.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>/<schema_name>/<table _partition_name>, wheredefault/<connectorName>/<epoch>/<db_name>/<schema_name>is the qualifiedName of the schema for this table partition, and<table _partition_name>is the name of the table partition. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this table partition. - The
connectorNamemust be exactly as used when defining the connection. - The
schemaNameshould be the human-readable name of the schema. - The
schemaQualifiedNameshould be the qualifiedName of the schema. - The
databaseNameshould be the human-readable name of the database. - The
databaseQualifiedNameshould be the qualifiedName of the database. - The
tableNameshould be the human-readable name of the table. - The
tableQualifiedNameshould be the qualifiedName of the table. - (Optional) To make sure the UI displays the correct count of
Column's, set thecolumnCountdirectly on theTablePartitioninstance.
Column
A column requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the column, the column's order (position) within its parent, and the names and qualifiedNames of the column's ancestors.
- Java
- Python
- Kotlin
- Raw REST API
Column column = Column.creator( // (1)
"reln_col1", // (2)
table, // (3)
1) // (4)
.build();
AssetMutationResponse response = column.save(client); // (5)
- Build up the minimum request to create a column.
- Provide a human-readable name for your column.
- Provide the parent container for this column. If you didn't already have the object, you could also use
Table.refByGuid()with the GUID of a table (orView.refByGuid(), etc), orTable.refByQualifiedName()with thequalifiedNameof a table (orView.refByQualifiedName(), etc). - The order (position) of the column within the table.
- Actually call Atlan to create the column. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant.
column = Column.creator( # (1)
name="reln_col1", # (2)
parent_type=Table, # (3)
parent_qualified_name=table_qualified_name, # (4)
order=1 # (5)
)
response = client.asset.save(column) # (6)
- Build up the minimum request to create a column.
- Provide a human-readable name for your column.
- Specify the type of the parent asset for the column (table, view, or materialized view).
- Provide the qualified_name of the parent asset for this column. In this example you're defining a column in a table, so you can use the
table_qualified_namecreated above. If the parent asset type wereViewyou would want to use theview_qualified_namecreated above. - The order (position) of the column within the table.
- Actually call Atlan to create the column.
val column = Column.creator( // (1)
"reln_col1", // (2)
table, // (3)
1) // (4)
.build()
ar = column.save(client) // (5)
- Build up the minimum request to create a column.
- Provide a human-readable name for your column.
- Provide the parent container for this column. If you didn't already have the object, you could also use
Table.refByGuid()with the GUID of a table (orView.refByGuid(), etc), orTable.refByQualifiedName()with thequalifiedNameof a table (orView.refByQualifiedName(), etc). - The order (position) of the column within the table.
- Actually call Atlan to create the column. Because this operation will persist the asset in Atlan, you must provide it an
AtlanClientthrough which to connect to the tenant.
{
"entities": [
{
"typeName": "Column", // (1)
"attributes": {
"name": "reln_col1", // (2)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table/reln_col1", // (3)
"connectionQualifiedName": "default/vertica/123456789", // (4)
"connectorName": "vertica", // (5)
"table": { // (6)
"typeName": "Table", // (7)
"uniqueAttributes": { // (8)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table"
}
},
"view": { // (9)
"typeName": "View", // (10)
"uniqueAttributes": { // (11)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view"
}
},
"materialisedView": { // (12)
"typeName": "MaterialisedView", // (13)
"uniqueAttributes": { // (14)
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_mat_view"
}
},
"tableName": "reln_table", // (15)
"tableQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table", // (16)
"viewName": "reln_view", // (17)
"viewQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view", // (18)
"schemaName": "reln_schema", // (19)
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema", // (20)
"databaseName": "reln_db", // (21)
"databaseQualifiedName": "default/vertica/123456789/reln_db", // (22)
"order": 1 // (23)
}
}
]
}
- The
typeNamemust be exactlyColumn. - Human-readable name for your column.
- The
qualifiedNameshould follow the pattern:default/<connectorName>/<epoch>/<db_name>/<schema_name>/<parent_name>/<column_name>, wheredefault/<connectorName>/<epoch>/<db_name>/<schema_name>/<parent_name>is the qualifiedName of the parent container (table, view, materialized view) for this column, and<column_name>is the name of the column. - The
connectionQualifiedNamemust be the exact qualifiedName of the connection for this column. - The
connectorNamemust be exactly as used when defining the connection. - If the column exists in a table, the table in which it exists is embedded in the
tableattribute. - The
typeNamefor this embedded reference must beTable. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the table. Note: the table must already exist in Atlan before creating the column. - If the column exists in a view, the view in which it exists is embedded in the
viewattribute. - The
typeNamefor this embedded reference must beView. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the view. Note: the view must already exist in Atlan before creating the column. - If the column exists in a materialized view, the materialized view in which it exists is embedded in the
materialisedViewattribute. - The
typeNamefor this embedded reference must beMaterialisedView. - To complete the reference, you must include a
uniqueAttributesobject with the qualifiedName of the materialized view. Note: the materialized view must already exist in Atlan before creating the column. - If the column exists in a table, the
tableNameshould be the human-readable name of the table. - If the column exists in a table, the
tableQualifiedNameshould be the qualifiedName of the table. - If the column exists in either a view or materialized view, the
viewNameshould be the human-readable name of the (materialized) view. - If the column exists in either a view or materialized view, the
viewQualifiedNameshould be the qualifiedName of the (materialized) view. - The
schemaNameshould be the human-readable name of the schema. - The
schemaQualifiedNameshould be the qualifiedName of the schema. - The
databaseNameshould be the human-readable name of the database. - The
databaseQualifiedNameshould be the qualifiedName of the database. - The order (position) of the column within the table.
Available relationships
Every level of the relational structure is also an Asset, and can therefore be related to the following other assets.
Primary keys
You can define a column as a primary key by setting the isPrimary attribute to true:
- Java
- Python
- Kotlin
- Raw REST API
Column column = Column.creator(
"reln_col1",
table,
1)
.isPrimary(true)
.build();
AssetMutationResponse response = column.save(client);
column = Column.creator(
name="reln_col1",
parent_type=Table,
parent_qualified_name=table_qualified_name,
order=1
)
column.is_primary = True
response = client.asset.save(column)
val column = Column.creator(
"reln_col1",
table,
1)
.isPrimary(true)
.build()
ar = column.save(client)
{
"entities": [
{
"typeName": "Column",
"attributes": {
"name": "reln_col1",
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table/reln_col1",
"connectionQualifiedName": "default/vertica/123456789",
"connectorName": "vertica",
"table": {
"typeName": "Table",
"uniqueAttributes": {
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table"
}
},
"view": {
"typeName": "View",
"uniqueAttributes": {
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view"
}
},
"materialisedView": {
"typeName": "MaterialisedView",
"uniqueAttributes": {
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_mat_view"
}
},
"tableName": "reln_table",
"tableQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table",
"viewName": "reln_view",
"viewQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view",
"schemaName": "reln_schema",
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema",
"databaseName": "reln_db",
"databaseQualifiedName": "default/vertica/123456789/reln_db",
"order": 1,
"isPrimary": true
}
}
]
}
Foreign keys
You can link one column to another, as a foreign key, by setting the isForeign attribute to true and creating a relationship to another column through the foreignKeyFrom attribute:
- Java
- Python
- Kotlin
- Raw REST API
Column column = Column.creator(
"reln_col1",
table,
1)
.isForeign(true) // (1)
.foreignKeyFrom(Column.refByGuid("e31c5cec-54fa-4f99-8157-d845082561e2")) // (2)
.build();
AssetMutationResponse response = column.save(client);
- Mark the column that whose values are foreign keys pointing to another column.
- Use the
foreignKeyFromattribute to specify the other column that this column's values point to.
column = Column.creator(
name="reln_col1",
parent_type=Table,
parent_qualified_name=table_qualified_name,
order=1
)
column.is_foreign = True # (1)
column.foreign_key_from(Column.ref_by_guid("e31c5cec-54fa-4f99-8157-d845082561e2")) # (2)
response = client.asset.save(column)
- Mark the column that whose values are foreign keys pointing to another column.
- Use the
foreign_key_fromattribute to specify the other column that this column's values point to.
val column = Column.creator(
"reln_col1",
table,
1)
.isForeign(true) // (1)
.foreignKeyFrom(Column.refByGuid("e31c5cec-54fa-4f99-8157-d845082561e2")) // (2)
.build()
ar = column.save(client)
- Mark the column that whose values are foreign keys pointing to another column.
- Use the
foreignKeyFromattribute to specify the other column that this column's values point to.
{
"entities": [
{
"typeName": "Column",
"attributes": {
"name": "reln_col1",
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table/reln_col1",
"connectionQualifiedName": "default/vertica/123456789",
"connectorName": "vertica",
"table": {
"typeName": "Table",
"uniqueAttributes": {
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table"
}
},
"view": {
"typeName": "View",
"uniqueAttributes": {
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view"
}
},
"materialisedView": {
"typeName": "MaterialisedView",
"uniqueAttributes": {
"qualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_mat_view"
}
},
"tableName": "reln_table",
"tableQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_table",
"viewName": "reln_view",
"viewQualifiedName": "default/vertica/123456789/reln_db/reln_schema/reln_view",
"schemaName": "reln_schema",
"schemaQualifiedName": "default/vertica/123456789/reln_db/reln_schema",
"databaseName": "reln_db",
"databaseQualifiedName": "default/vertica/123456789/reln_db",
"order": 1,
"isForeign": true, // (1)
"foreignKeyFrom": { // (2)
"typeName": "Column",
"guid": "e31c5cec-54fa-4f99-8157-d845082561e2"
}
}
}
]
}
- Mark the column that whose values are foreign keys pointing to another column.
- Use the
foreignKeyFromattribute to specify the other column that this column's values point to.