Skip to main content

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
Where do the icons come from?

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.

Create a relational connection
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)
  1. Retrieve the GUID for the admin role, to use later for defining the roles that can administer the connection.

  2. Build up the minimum request to create a connection.

  3. Provide a human-readable name for your connection, such as production or development.

  4. 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.)

Database

A database requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the database.

Create a relational database
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)
  1. Build up the minimum request to create a database.
  2. Provide a human-readable name for your database.
  3. Provide the qualifiedName of the connection for this database.
  4. (Optional) To make sure the UI displays the correct count of Schema's, set the schemaCount directly on the Database instance.
  5. Actually call Atlan to create the database. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  6. Retrieve the created database for use in subsequent creation calls. (You'd probably want to do some null checking first.)

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.

Create a relational schema
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)
  1. Build up the minimum request to create a schema.
  2. Provide a human-readable name for your schema.
  3. 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, or Database.refByQualifiedName() with the qualifiedName of the database.
  4. (Optional) To make sure the UI displays the correct count of Table's, set the tableCount directly on the Schema instance.
  5. (Optional) To make sure the UI displays the correct count of View's, set the viewCount directly on the Schema instance.
  6. Actually call Atlan to create the schema. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  7. Retrieve the created schema for use in subsequent creation calls. (You'd probably want to do some null checking first.)

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.

Create a relational table
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)
  1. Build up the minimum request to create a table.
  2. Provide a human-readable name for your table.
  3. 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, or Schema.refByQualifiedName() with the qualifiedName of the schema.
  4. (Optional) To make sure the UI displays the correct count of Column's, set the columnCount directly on the Table instance.
  5. Actually call Atlan to create the table. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  6. Retrieve the created table for use in subsequent creation calls. (You'd probably want to do some null checking first.)

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.

Create a relational view
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)
  1. Build up the minimum request to create a view.
  2. Provide a human-readable name for your view.
  3. 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, or Schema.refByQualifiedName() with the qualifiedName of the schema.
  4. (Optional) To make sure the UI displays the correct count of Column's, set the columnCount directly on the View instance.
  5. Actually call Atlan to create the view. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  6. Retrieve the created view for use in subsequent creation calls. (You'd probably want to do some null checking first.)

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.

Create a relational materialized view
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)
  1. Build up the minimum request to create a materialized view.
  2. Provide a human-readable name for your materialized view.
  3. 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, or Schema.refByQualifiedName() with the qualifiedName of the schema.
  4. (Optional) To make sure the UI displays the correct count of Column's, set the columnCount directly on the MaterializedView instance.
  5. Actually call Atlan to create the materialized view. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  6. Retrieve the created materialized view for use in subsequent creation calls. (You'd probably want to do some null checking first.)

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.

Create a relational table partition
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)
  1. Build up the minimum request to create a table partition.
  2. Provide a human-readable name for your table partition.
  3. 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, or Table.refByQualifiedName() with the qualifiedName of the table.
  4. (Optional) To make sure the UI displays the correct count of Column's, set the columnCount directly on the TablePartition instance.
  5. Actually call Atlan to create the table partition.
  6. Retrieve the created table partition for use in subsequent creation calls. (You'd probably want to do some null checking first.)

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.

Create a relational column
Column column = Column.creator( // (1)
"reln_col1", // (2)
table, // (3)
1) // (4)
.build();
AssetMutationResponse response = column.save(client); // (5)
  1. Build up the minimum request to create a column.
  2. Provide a human-readable name for your column.
  3. 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 (or View.refByGuid(), etc), or Table.refByQualifiedName() with the qualifiedName of a table (or View.refByQualifiedName(), etc).
  4. The order (position) of the column within the table.
  5. Actually call Atlan to create the column. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

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:

Create a primary key column
Column column = Column.creator(
"reln_col1",
table,
1)
.isPrimary(true)
.build();
AssetMutationResponse response = column.save(client);

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:

Create a foreign key relationship
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);
  1. Mark the column that whose values are foreign keys pointing to another column.
  2. Use the foreignKeyFrom attribute to specify the other column that this column's values point to.

Footnotes

  1. Although if you want to delete everything in a connection, your better avenue is the packaged connection delete utility in the UI.

Was this page helpful?