Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Datahub project Datahub Container Entity

From Leeroopedia


Knowledge Sources
Domains Java_SDK, Metadata_Management
Last Updated 2026-02-10 00:00 GMT

Overview

Container is a Java SDK V2 entity class representing a DataHub Container, a hierarchical grouping of data assets such as databases, schemas, folders, or projects.

Description

The Container class extends Entity and implements mixin interfaces (HasContainer, HasTags, HasGlossaryTerms, HasOwners, HasDomains, HasSubTypes, HasStructuredProperties) to support rich metadata operations on hierarchical data containers.

Key characteristics:

  • Entity type: "container"
  • URN format: urn:li:container:{guid} where the GUID is deterministically generated from properties (platform, database, schema, env, instance) using DataHubGuidGenerator.
  • Hierarchical nesting: Containers can have parent containers via setContainer() (from HasContainer mixin), allowing representation of database-schema-table hierarchies.
  • Patch-based mutations: The setDescription() method uses EditableContainerPropertiesPatchBuilder for patch-based updates.
  • Server compatibility: Includes a static transformPatchToFullAspect() method for backward compatibility with older DataHub servers that lack the EditableContainerPropertiesTemplate, performing a read-modify-write pattern to convert patch MCPs into full aspect replacement MCPs.
  • Builder GUID generation: The builder automatically computes a GUID from platform, database, schema, env, and platformInstance properties. Alternatively, a pre-computed URN can be provided directly.

Default aspects fetched: Ownership, GlobalTags, GlossaryTerms, Domains, Status, InstitutionalMemory, ContainerProperties, EditableContainerProperties.

Usage

Use the Container entity when you need to create or manage hierarchical groupings of data assets in DataHub, such as representing a Snowflake database, a BigQuery dataset, or a file system folder. It is constructed via its Builder and upserted through EntityClient.upsert(container).

Code Reference

Source Location

Signature

public class Container extends Entity
    implements HasContainer<Container>, HasTags<Container>, HasGlossaryTerms<Container>,
               HasOwners<Container>, HasDomains<Container>, HasSubTypes<Container>,
               HasStructuredProperties<Container> {

    // Factory
    public static Builder builder();

    // Identity
    public String getEntityType();           // returns "container"
    public String getContainerUrn();
    public Container mutable();

    // Metadata operations
    public Container setDescription(String description);
    public String getDescription();
    public String getDisplayName();
    public String getQualifiedName();
    public String getExternalUrl();
    public Map<String, String> getCustomProperties();
    public String getParentContainer();

    // Server compatibility
    public static MetadataChangeProposal transformPatchToFullAspect(
        MetadataChangeProposal patch, EntityClient client);
}

Import

import datahub.client.v2.entity.Container;

I/O Contract

Builder Inputs

Parameter Type Required Description
platform String Yes (unless URN set) Platform name (e.g., "snowflake", "bigquery")
displayName String Yes Display name for the container
database String No Database name (used in GUID generation)
schema String No Schema name (used in GUID generation)
env String No Environment, defaults to "PROD"
platformInstance String No Platform instance identifier
description String No Container description
qualifiedName String No Fully qualified name
externalUrl String No External URL for the container
parentContainer String No Parent container URN for nesting
customProperties Map<String, String> No Custom key-value properties
urn Urn No Pre-computed URN (skips GUID generation)

Outputs

Method Return Type Description
build() Container New Container entity with GUID-based URN
getContainerUrn() String The container URN string
getParentContainer() String Parent container URN, or null

Usage Examples

// Create a database container
Container database = Container.builder()
    .platform("snowflake")
    .database("analytics_db")
    .env("PROD")
    .displayName("Analytics Database")
    .description("Central analytics database")
    .build();

// Create a schema container with parent
Container schema = Container.builder()
    .platform("snowflake")
    .database("analytics_db")
    .schema("public")
    .env("PROD")
    .displayName("Public Schema")
    .parentContainer(database.getUrn().toString())
    .build();

// Add metadata
database.addTag("production");
database.addOwner("urn:li:corpuser:dba", OwnershipType.DATA_STEWARD);
database.setDomain("urn:li:domain:Engineering");

// Upsert to DataHub
client.entities().upsert(database);
client.entities().upsert(schema);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment