Implementation:Datahub project Datahub Dashboard Entity
| Knowledge Sources | |
|---|---|
| Domains | Java_SDK, Metadata_Management |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Dashboard is a Java SDK V2 entity class representing a DataHub Dashboard entity, a collection of visualizations and reports in a BI tool such as Looker, Tableau, or PowerBI.
Description
The Dashboard class extends Entity and implements mixin interfaces (HasTags, HasGlossaryTerms, HasOwners, HasDomains, HasSubTypes, HasStructuredProperties) for comprehensive metadata management.
Key characteristics:
- Entity type:
"dashboard" - URN format:
urn:li:dashboard:(tool,dashboardId)viaDashboardUrn - Chart relationships: Supports managing the charts contained in a dashboard via
addChart(),removeChart(),setCharts(), andgetCharts(). These useDashboardInfoPatchBuilderwith chart edge operations. - Dataset lineage: Supports input dataset edges via
addInputDataset(),removeInputDataset(),setInputDatasets(), andgetInputDatasets()to track which datasets a dashboard consumes. - Patch-based mutations: Methods like
addCustomProperty(),removeCustomProperty(),setCustomProperties()use accumulatedDashboardInfoPatchBuilderinstances. - Direct mutation:
setDashboardUrl()andsetLastRefreshed()directly modify theDashboardInfoaspect viagetOrCreateAspect(). - Builder: Requires
toolandid. Iftitle,description, orcustomPropertiesare set, bothtitleanddescriptionbecome required.
Default aspects fetched: Ownership, GlobalTags, GlossaryTerms, Domains, Status, InstitutionalMemory, DashboardInfo, EditableDashboardProperties.
Usage
Use the Dashboard entity when you need to create, update, or read dashboard metadata in DataHub from Java. It models BI dashboards and their relationships to charts and datasets. Construct via its Builder and upsert through EntityClient.upsert(dashboard).
Code Reference
Source Location
- Repository: Datahub_project_Datahub
- File: metadata-integration/java/datahub-client/src/main/java/datahub/client/v2/entity/Dashboard.java
Signature
public class Dashboard extends Entity
implements HasTags<Dashboard>, HasGlossaryTerms<Dashboard>, HasOwners<Dashboard>,
HasDomains<Dashboard>, HasSubTypes<Dashboard>, HasStructuredProperties<Dashboard> {
// Factory
public static Builder builder();
// Identity
public String getEntityType(); // returns "dashboard"
public DashboardUrn getDashboardUrn();
public Dashboard mutable();
// Metadata
public String getTitle();
public String getDescription();
public Dashboard setDashboardUrl(String dashboardUrl);
public String getDashboardUrl();
public Dashboard setLastRefreshed(long lastRefreshedMillis);
public Long getLastRefreshed();
// Custom properties
public Dashboard addCustomProperty(String key, String value);
public Dashboard removeCustomProperty(String key);
public Dashboard setCustomProperties(Map<String, String> properties);
// Dataset lineage
public Dashboard setInputDatasets(List<DatasetUrn> datasetUrns);
public Dashboard addInputDataset(DatasetUrn datasetUrn);
public Dashboard addInputDataset(String datasetUrn);
public Dashboard removeInputDataset(DatasetUrn datasetUrn);
public Dashboard removeInputDataset(String datasetUrn);
public List<DatasetUrn> getInputDatasets();
// Chart relationships
public Dashboard setCharts(List<ChartUrn> chartUrns);
public Dashboard addChart(ChartUrn chartUrn);
public Dashboard addChart(String chartUrn);
public Dashboard removeChart(ChartUrn chartUrn);
public Dashboard removeChart(String chartUrn);
public List<ChartUrn> getCharts();
}
Import
import datahub.client.v2.entity.Dashboard;
I/O Contract
Builder Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
tool |
String |
Yes | BI tool name (e.g., "looker", "tableau", "powerbi") |
id |
String |
Yes | Dashboard identifier within the tool |
title |
String |
Conditional | Dashboard title (required if description/customProperties set) |
description |
String |
Conditional | Dashboard description (required if title/customProperties set) |
customProperties |
Map<String, String> |
No | Custom key-value properties |
Outputs
| Method | Return Type | Description |
|---|---|---|
build() |
Dashboard |
New Dashboard entity with DashboardUrn
|
getCharts() |
List<ChartUrn> |
Charts contained in this dashboard |
getInputDatasets() |
List<DatasetUrn> |
Datasets consumed by this dashboard |
Usage Examples
// Create a dashboard
Dashboard dashboard = Dashboard.builder()
.tool("looker")
.id("sales_dashboard")
.title("Sales Performance Dashboard")
.description("Executive view of sales KPIs")
.build();
// Add charts and datasets
dashboard.addChart("urn:li:chart:(looker,revenue_chart)");
dashboard.addInputDataset("urn:li:dataset:(urn:li:dataPlatform:snowflake,sales.revenue,PROD)");
// Add metadata
dashboard.addTag("executive");
dashboard.addOwner("urn:li:corpuser:vp_sales", OwnershipType.BUSINESS_OWNER);
dashboard.setDomain("urn:li:domain:Sales");
// Upsert to DataHub
client.entities().upsert(dashboard);