SDK Entities Reference
The DataHub SDK provides a set of entities that can be used to interact with DataHub’s metadata.
Dataset
Bases: HasPlatformInstance, HasSubtype, HasContainer, HasOwnership, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasStructuredProperties, Entity
Represents a dataset in DataHub.
A dataset represents a collection of data, such as a table, view, or file. This class provides methods for managing dataset metadata including schema, lineage, and various aspects like ownership, tags, and terms.
Automatic View Lineage Parsing
When a view_definition SQL string is provided, the SDK can automatically parse it to extract upstream table references using sqlglot. This behavior is controlled by the parse_view_lineage parameter:
- None (default): Auto-parse in SDK mode, skip in ingestion framework (where SqlParsingAggregator handles lineage more accurately)
- True: Force parsing (even within the ingestion framework)
- False: Never parse automatically
Features:
- Supports all major SQL dialects (Snowflake, BigQuery, Postgres, etc.)
- Filters out CTEs (Common Table Expressions) from upstream tables
- Gracefully handles parse errors without raising exceptions
Limitations:
- Table-level lineage only (no column-level lineage)
- No schema resolution: table names are taken as-is from the SQL. For fully-qualified references, ensure your view definition includes the database and schema (e.g., db.schema.table)
- Best-effort extraction; for production-grade lineage with schema resolution and additional context (e.g., temporary tables), use SqlParsingAggregator
Example:
# Auto-parsing enabled by default
view = Dataset(
platform="snowflake",
name="analytics.reporting.sales_summary",
view_definition="SELECT * FROM analytics.raw.sales WHERE year = 2024",
)
# view.upstreams now contains analytics.raw.sales
# Disable auto-parsing
view = Dataset(
platform="snowflake",
name="analytics.reporting.sales_summary",
view_definition="SELECT * FROM analytics.raw.sales",
parse_view_lineage=False, # Must set upstreams manually
)
- Parameters:
- platform (str)
- name (str)
- platform_instance (Optional [str])
- env (str)
- description (Optional [str])
- display_name (Optional [str])
- qualified_name (Optional [str])
- external_url (Optional [str])
- custom_properties (Optional [Dict[str,str] ])
- created (Optional [datetime])
- last_modified (Optional [datetime])
- view_definition (Optional [ViewDefinitionInputType])
- parent_container (ParentContainerInputType | Unset)
- subtype (Optional [str])
- owners (Optional [OwnersInputType])
- links (Optional [LinksInputType])
- tags (Optional [TagsInputType])
- terms (Optional [TermsInputType])
- domain (Optional [DomainInputType])
- schema (Optional [SchemaFieldsInputType])
- upstreams (Optional [UpstreamLineageInputType])
- structured_properties (Optional [StructuredPropertyInputType])
- extra_aspects (ExtraAspectsType)
- parse_view_lineage (Optional [bool])
property created : datetime | None
Get the creation timestamp of the dataset.
- Returns: The creation timestamp if set, None otherwise.
property custom_properties : Dict[str, str]
Get the custom properties of the dataset.
- Returns: Dictionary of custom properties.
property description : str | None
Get the description of the dataset.
- Returns: The description if set, None otherwise.
property display_name : str | None
Get the display name of the dataset.
- Returns: The display name if set, None otherwise.
property external_url : str | None
Get the external URL of the dataset.
- Returns: The external URL if set, None otherwise.
classmethod get_urn_type()
Get the URN type for datasets.
- Return type:
Type[DatasetUrn] - Returns: The DatasetUrn class.
property last_modified : datetime | None
Get the last modification timestamp of the dataset.
- Returns: The last modification timestamp if set, None otherwise.
property qualified_name : str | None
Get the qualified name of the dataset.
- Returns: The qualified name if set, None otherwise.
property schema : List[SchemaField]
Get the schema fields of the dataset.
- Returns: List of SchemaField objects representing the dataset’s schema.
set_created(created)
Set the creation timestamp of the dataset.
- Parameters:created (
datetime) – The creation timestamp to set. - Return type:
None
set_custom_properties(custom_properties)
Set the custom properties of the dataset.
- Parameters:custom_properties (
Dict[str,str]) – Dictionary of custom properties to set. - Return type:
None
set_description(description)
Set the description of the dataset.
- Parameters:description (
str) – The description to set. - Return type:
None
NOTE
If called during ingestion, this will warn if overwriting a non-ingestion description.
set_display_name(display_name)
Set the display name of the dataset.
- Parameters:display_name (
str) – The display name to set. - Return type:
None
set_external_url(external_url)
Set the external URL of the dataset.
- Parameters:external_url (
str) – The external URL to set. - Return type:
None
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
set_qualified_name(qualified_name)
Set the qualified name of the dataset.
- Parameters:qualified_name (
str) – The qualified name to set. - Return type:
None
set_upstreams(upstreams)
- Parameters:upstreams (
Union[UpstreamLineageClass,List[Union[str,DatasetUrn,UpstreamClass,FineGrainedLineageClass]],Dict[Union[str,DatasetUrn],Dict[str,List[str]]]]) – - Return type:
None
set_view_definition(view_definition, parse=None)
Set the view definition of the dataset.
If you’re setting a view definition, subtype should typically be set to “view”.
If a string is provided, it will be treated as a SQL view definition. To set a custom language or other properties, provide a ViewPropertiesClass object.
By default (parse=None), the SQL will be automatically parsed to extract upstream lineage, unless running inside the ingestion framework (which uses SqlParsingAggregator).
- Parameters:
- view_definition (
Union[str,ViewPropertiesClass]) – The view definition to set. - parse (
Optional[bool]) – Whether to parse the SQL and extract upstream lineage. None (default): auto-parse in SDK mode, skip in ingestion framework. True: force parsing (even in ingestion framework). False: never parse.
- view_definition (
- Return type:
None
property upstreams : UpstreamLineageClass | None
property urn : DatasetUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
property view_definition : ViewPropertiesClass | None
Get the view definition of the dataset.
Under typical usage, this will be present if the subtype is “View”.
- Returns: The view definition if set, None otherwise.
SchemaField
Bases: object
- Parameters:
- parent (
Dataset) – - field_path (
str)
- parent (
add_tag(tag)
- Parameters:tag (
Union[str,TagUrn,TagAssociationClass]) – - Return type:
None
add_term(term)
- Parameters:term (
Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]) – - Return type:
None
property description : str | None
property field_path : str
property mapped_type : SchemaFieldDataTypeClass
property native_type : str
remove_tag(tag)
- Parameters:tag (
Union[str,TagUrn,TagAssociationClass]) – - Return type:
None
remove_term(term)
- Parameters:term (
Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]) – - Return type:
None
set_description(description)
- Parameters:description (
str) - Return type:
None
set_tags(tags)
- Parameters:tags (
Sequence[Union[str,TagUrn,TagAssociationClass]]) – - Return type:
None
set_terms(terms)
- Parameters:terms (
Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]) – - Return type:
None
property tags : List[TagAssociationClass] | None
property terms : List[GlossaryTermAssociationClass] | None
parse_cll_mapping
- Parameters:
- upstream (
Union[str,DatasetUrn]) – - downstream (
Union[str,DatasetUrn]) – - cll_mapping (
Dict[str,List[str]])
- upstream (
- Return type:
List[FineGrainedLineageClass]
Container
Bases: HasPlatformInstance, HasSubtype, HasContainer, HasOwnership, HasInstitutionalMemory, HasStructuredProperties, HasTags, HasTerms, HasDomain, Entity
- Parameters:
- container_key (
ContainerKey) – - display_name (
str) - qualified_name (
Optional[str]) - description (
Optional[str]) - external_url (
Optional[str]) - extra_properties (
Optional[Dict[str,str]]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - parent_container (
Union[Auto,Container,ContainerKey,Sequence[Union[Urn,str]],None]) – - subtype (
Optional[str]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- container_key (
property created : datetime | None
property custom_properties : Dict[str, str] | None
property description : str | None
property display_name : str
property external_url : str | None
classmethod get_urn_type()
Get the URN type for this entity class.
- Return type:
Type[ContainerUrn] - Returns: The URN type class that corresponds to this entity type.
property last_modified : datetime | None
property qualified_name : str | None
set_created(created)
- Parameters:created (
datetime) - Return type:
None
set_custom_properties(custom_properties)
- Parameters:custom_properties (
Dict[str,str]) - Return type:
None
set_description(description)
- Parameters:description (
str) - Return type:
None
set_display_name(value)
- Parameters:value (
str) - Return type:
None
set_external_url(external_url)
- Parameters:external_url (
str) - Return type:
None
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
set_qualified_name(qualified_name)
- Parameters:qualified_name (
str) - Return type:
None
MLModel
Bases: HasPlatformInstance, HasOwnership, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasVersion, HasStructuredProperties, Entity
- Parameters:
- id (
str) - platform (
str) - version (
Optional[str]) - aliases (
Optional[List[str]]) - platform_instance (
Optional[str]) - env (
str) - name (
Optional[str]) - description (
Optional[str]) - training_metrics (
Union[List[MLMetricClass],Dict[str,Optional[str]],None]) – - hyper_params (
Union[List[MLHyperParamClass],Dict[str,Optional[str]],None]) – - external_url (
Optional[str]) - custom_properties (
Optional[Dict[str,str]]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - model_group (
Union[str,MlModelGroupUrn,None]) – - training_jobs (
Optional[Sequence[Union[str,DataProcessInstanceUrn]]]) – - downstream_jobs (
Optional[Sequence[Union[str,DataProcessInstanceUrn]]]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- id (
add_deployment(deployment)
- Parameters:deployment (
str) - Return type:
None
add_downstream_job(downstream_job)
- Parameters:downstream_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
add_hyper_params(params)
- Parameters:params (
Union[List[MLHyperParamClass],Dict[str,Optional[str]]]) – - Return type:
None
add_training_job(training_job)
- Parameters:training_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
add_training_metrics(metrics)
- Parameters:metrics (
Union[List[MLMetricClass],Dict[str,Optional[str]]]) – - Return type:
None
property created : datetime | None
property custom_properties : Dict[str, str] | None
property deployments : List[str] | None
property description : str | None
property downstream_jobs : List[str] | None
property external_url : str | None
classmethod get_urn_type()
Get the URN type for this entity class.
- Return type:
Type[MlModelUrn] - Returns: The URN type class that corresponds to this entity type.
property hyper_params : List[MLHyperParamClass] | None
property last_modified : datetime | None
property model_group : str | None
property name : str | None
remove_deployment(deployment)
- Parameters:deployment (
str) - Return type:
None
remove_downstream_job(downstream_job)
- Parameters:downstream_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
remove_training_job(training_job)
- Parameters:training_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
set_created(created)
- Parameters:created (
datetime) - Return type:
None
set_custom_properties(custom_properties)
- Parameters:custom_properties (
Dict[str,str]) - Return type:
None
set_deployments(deployments)
- Parameters:deployments (
Sequence[str]) - Return type:
None
set_description(description)
- Parameters:description (
str) - Return type:
None
set_downstream_jobs(downstream_jobs)
- Parameters:downstream_jobs (
Sequence[Union[str,DataProcessInstanceUrn]]) – - Return type:
None
set_external_url(external_url)
- Parameters:external_url (
str) - Return type:
None
set_hyper_params(params)
- Parameters:params (
Union[List[MLHyperParamClass],Dict[str,Optional[str]]]) – - Return type:
None
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
set_model_group(group)
- Parameters:group (
Union[str,MlModelGroupUrn]) – - Return type:
None
set_name(name)
- Parameters:name (
str) - Return type:
None
set_training_jobs(training_jobs)
- Parameters:training_jobs (
Sequence[Union[str,DataProcessInstanceUrn]]) – - Return type:
None
set_training_metrics(metrics)
- Parameters:metrics (
Union[List[MLMetricClass],Dict[str,Optional[str]]]) – - Return type:
None
property training_jobs : List[str] | None
property training_metrics : List[MLMetricClass] | None
property urn : MlModelUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
MLModelGroup
Bases: HasPlatformInstance, HasOwnership, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasStructuredProperties, Entity
- Parameters:
- id (
str) - platform (
str) - name (
Optional[str]) - platform_instance (
Optional[str]) - env (
str) - description (
Optional[str]) - display_name (
Optional[str]) - external_url (
Optional[str]) - custom_properties (
Optional[Dict[str,str]]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - training_jobs (
Optional[Sequence[Union[str,DataProcessInstanceUrn]]]) – - downstream_jobs (
Optional[Sequence[Union[str,DataProcessInstanceUrn]]]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- id (
add_downstream_job(downstream_job)
- Parameters:downstream_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
add_training_job(training_job)
- Parameters:training_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
property created : datetime | None
property custom_properties : Dict[str, str] | None
property description : str | None
property downstream_jobs : List[str] | None
property external_url : str | None
classmethod get_urn_type()
Get the URN type for this entity class.
- Return type:
Type[MlModelGroupUrn] - Returns: The URN type class that corresponds to this entity type.
property last_modified : datetime | None
property name : str | None
remove_downstream_job(downstream_job)
- Parameters:downstream_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
remove_training_job(training_job)
- Parameters:training_job (
Union[str,DataProcessInstanceUrn]) – - Return type:
None
set_created(created)
- Parameters:created (
datetime) - Return type:
None
set_custom_properties(custom_properties)
- Parameters:custom_properties (
Dict[str,str]) - Return type:
None
set_description(description)
- Parameters:description (
str) - Return type:
None
set_downstream_jobs(downstream_jobs)
- Parameters:downstream_jobs (
Sequence[Union[str,DataProcessInstanceUrn]]) – - Return type:
None
set_external_url(external_url)
- Parameters:external_url (
str) - Return type:
None
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
set_name(display_name)
- Parameters:display_name (
str) - Return type:
None
set_training_jobs(training_jobs)
- Parameters:training_jobs (
Sequence[Union[str,DataProcessInstanceUrn]]) – - Return type:
None
property training_jobs : List[str] | None
property urn : MlModelGroupUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
Dashboard
Bases: ChangeAuditStampsMixin, HasPlatformInstance, HasSubtype, HasOwnership, HasContainer, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, Entity
Represents a dashboard in DataHub.
- Parameters:
- name (
str) - platform (
Union[str,DataPlatformUrn]) – - display_name (
Optional[str]) - platform_instance (
Union[str,DataPlatformInstanceUrn,None]) – - description (
Optional[str]) - external_url (
Optional[str]) - dashboard_url (
Optional[str]) - custom_properties (
Optional[Dict[str,str]]) - last_modified (
Optional[datetime]) - last_modified_by (
Union[str,CorpUserUrn,CorpGroupUrn,None]) – - created_at (
Optional[datetime]) - created_by (
Union[str,CorpUserUrn,CorpGroupUrn,None]) – - deleted_on (
Optional[datetime]) - deleted_by (
Union[str,CorpUserUrn,CorpGroupUrn,None]) – - last_refreshed (
Optional[datetime]) - input_datasets (
Optional[Sequence[Union[str,DatasetUrn,Dataset]]]) – - charts (
Optional[Sequence[Union[str,ChartUrn,Chart]]]) – - dashboards (
Optional[Sequence[Union[str,DashboardUrn,Dashboard]]]) – - parent_container (
Union[Container,ContainerKey,Sequence[Union[Urn,str]],Unset]) – - subtype (
Optional[str]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- name (
add_chart(chart)
Add a chart to the dashboard.
add_dashboard(dashboard)
Add a dashboard to the dashboard.
- Parameters:dashboard (
Union[str,DashboardUrn,Dashboard]) – - Return type:
None
add_input_dataset(input_dataset)
Add an input dataset to the dashboard.
- Parameters:input_dataset (
Union[str,DatasetUrn,Dataset]) – - Return type:
None
property charts : List[ChartUrn]
Get the charts of the dashboard.
property custom_properties : Dict[str, str]
Get the custom properties of the dashboard.
property dashboard_url : str | None
Get the dashboard URL.
property dashboards : List[DashboardUrn]
Get the dashboards of the dashboard.
property description : str | None
Get the description of the dashboard.
property display_name : str
Get the display name of the dashboard.
property external_url : str | None
Get the external URL of the dashboard.
classmethod get_urn_type()
Get the URN type for dashboards.
:rtype: Type[DashboardUrn]
:returns: The DashboardUrn class.
- Return type:Type[DashboardUrn]
property input_datasets : List[DatasetUrn]
Get the input datasets of the dashboard.
property last_refreshed : datetime | None
Get the last refresh timestamp of the dashboard.
property name : str
Get the name of the dashboard.
remove_chart(chart)
Remove a chart from the dashboard.
remove_input_dataset(input_dataset)
Remove an input dataset from the dashboard.
- Parameters:input_dataset (
Union[str,DatasetUrn,Dataset]) – - Return type:
None
set_charts(charts)
Set the charts of the dashboard.
set_custom_properties(custom_properties)
Set the custom properties of the dashboard.
- Parameters:custom_properties (
Dict[str,str]) - Return type:
None
set_dashboard_url(dashboard_url)
Set the dashboard URL.
- Parameters:dashboard_url (
str) - Return type:
None
set_dashboards(dashboards)
Set the dashboards of the dashboard.
- Parameters:dashboards (
Sequence[Union[str,DashboardUrn,Dashboard]]) – - Return type:
None
set_description(description)
Set the description of the dashboard.
- Parameters:description (
str) - Return type:
None
set_display_name(display_name)
Set the display name of the dashboard.
- Parameters:display_name (
str) - Return type:
None
set_external_url(external_url)
Set the external URL of the dashboard.
- Parameters:external_url (
str) - Return type:
None
set_input_datasets(input_datasets)
Set the input datasets of the dashboard.
- Parameters:input_datasets (
Sequence[Union[str,DatasetUrn,Dataset]]) – - Return type:
None
set_last_refreshed(last_refreshed)
Set the last refresh timestamp of the dashboard.
- Parameters:last_refreshed (
datetime) - Return type:
None
set_title(title)
Set the display name of the dashboard.
Deprecated
Deprecated since version 1.2.0.7: Use set_display_name instead
- Parameters:title (
str) - Return type:
None
property title : str
Get the display name of the dashboard.
Deprecated
Deprecated since version 1.2.0.7: Use display_name instead
property urn : DashboardUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
Chart
Bases: ChangeAuditStampsMixin, HasPlatformInstance, HasSubtype, HasOwnership, HasContainer, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, Entity
Represents a chart in DataHub.
- Parameters:
- name (
str) - platform (
Union[str,DataPlatformUrn]) – - display_name (
Optional[str]) - platform_instance (
Union[str,DataPlatformInstanceUrn,None]) – - description (
Optional[str]) - external_url (
Optional[str]) - chart_url (
Optional[str]) - custom_properties (
Optional[Dict[str,str]]) - last_modified (
Optional[datetime]) - last_modified_by (
Union[str,CorpUserUrn,CorpGroupUrn,None]) – - created_at (
Optional[datetime]) - created_by (
Union[str,CorpUserUrn,CorpGroupUrn,None]) – - deleted_on (
Optional[datetime]) - deleted_by (
Union[str,CorpUserUrn,CorpGroupUrn,None]) – - last_refreshed (
Optional[datetime]) - chart_type (
Union[str,ChartTypeClass,None]) – - access (
Optional[str]) - input_datasets (
Optional[Sequence[Union[str,DatasetUrn,Dataset]]]) – - parent_container (
Union[Container,ContainerKey,Sequence[Union[Urn,str]],Unset]) – - subtype (
Optional[str]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- name (
property access : str | None
Get the access level of the chart as a string.
add_input_dataset(input_dataset)
Add an input to the chart.
- Parameters:input_dataset (
Union[str,DatasetUrn,Dataset]) – - Return type:
None
property chart_type : str | None
Get the type of the chart as a string.
property chart_url : str | None
Get the chart URL.
property custom_properties : Dict[str, str]
Get the custom properties of the chart.
property description : str | None
Get the description of the chart.
property display_name : str
Get the display name of the chart.
property external_url : str | None
Get the external URL of the chart.
classmethod get_urn_type()
Get the URN type for charts.
:rtype: Type[ChartUrn]
:returns: The ChartUrn class.
- Return type:Type[ChartUrn]
property input_datasets : List[DatasetUrn]
Get the input datasets of the chart.
property last_refreshed : datetime | None
Get the last refresh timestamp of the chart.
property name : str
Get the name of the chart.
remove_input_dataset(input_dataset)
Remove an input from the chart.
- Parameters:input_dataset (
Union[str,DatasetUrn,Dataset]) – - Return type:
None
set_access(access)
Set the access level of the chart.
- Parameters:access (
Union[str,AccessLevelClass]) – - Return type:
None
set_chart_type(chart_type)
Set the type of the chart.
- Parameters:chart_type (
Union[str,ChartTypeClass]) – - Return type:
None
set_chart_url(chart_url)
Set the chart URL.
- Parameters:chart_url (
str) - Return type:
None
set_custom_properties(custom_properties)
Set the custom properties of the chart.
- Parameters:custom_properties (
Dict[str,str]) - Return type:
None
set_description(description)
Set the description of the chart.
- Parameters:description (
str) - Return type:
None
set_display_name(display_name)
Set the display name of the chart.
- Parameters:display_name (
str) - Return type:
None
set_external_url(external_url)
Set the external URL of the chart.
- Parameters:external_url (
str) - Return type:
None
set_input_datasets(input_datasets)
Set the input datasets of the chart.
- Parameters:input_datasets (
Sequence[Union[str,DatasetUrn,Dataset]]) – - Return type:
None
set_last_refreshed(last_refreshed)
Set the last refresh timestamp of the chart.
- Parameters:last_refreshed (
datetime) - Return type:
None
set_title(title)
Set the display name of the chart.
Deprecated
Deprecated since version 1.2.0.7: Use set_display_name instead
- Parameters:title (
str) - Return type:
None
property title : str
Get the display name of the chart.
Deprecated
Deprecated since version 1.2.0.7: Use display_name instead
property urn : ChartUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
DataJob
Bases: HasPlatformInstance, HasSubtype, HasContainer, HasOwnership, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasStructuredProperties, Entity
Represents a data job in DataHub. A data job is an executable unit of a data pipeline, such as an Airflow task or a Spark job.
- Parameters:
- name (
str) - flow (
Optional[DataFlow]) – - flow_urn (
Union[str,DataFlowUrn,None]) – - platform_instance (
Optional[str]) - display_name (
Optional[str]) - description (
Optional[str]) - external_url (
Optional[str]) - custom_properties (
Optional[Dict[str,str]]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - subtype (
Optional[str]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - inlets (
Optional[List[Union[str,DatasetUrn]]]) – - outlets (
Optional[List[Union[str,DatasetUrn]]]) – - fine_grained_lineages (
Optional[List[FineGrainedLineageClass]]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- name (
property created : datetime | None
Get the creation timestamp of the data job.
property custom_properties : Dict[str, str]
Get the custom properties of the data job.
property description : str | None
Get the description of the data job.
property display_name : str | None
Get the display name of the data job.
property env : str | None
Get the environment of the data job.
property external_url : str | None
Get the external URL of the data job.
property fine_grained_lineages : List[FineGrainedLineageClass]
property flow_urn : DataFlowUrn
Get the data flow associated with the data job.
classmethod get_urn_type()
Get the URN type for data jobs.
- Return type:
Type[DataJobUrn]
property inlets : List[DatasetUrn]
Get the inlets of the data job.
property last_modified : datetime | None
Get the last modification timestamp of the data job.
property name : str
Get the name of the data job.
property outlets : List[DatasetUrn]
Get the outlets of the data job.
set_created(created)
Set the creation timestamp of the data job.
- Parameters:created (
datetime) - Return type:
None
set_custom_properties(custom_properties)
Set the custom properties of the data job.
- Parameters:custom_properties (
Dict[str,str]) - Return type:
None
set_description(description)
Set the description of the data job.
- Parameters:description (
str) - Return type:
None
set_display_name(display_name)
Set the display name of the data job.
- Parameters:display_name (
str) - Return type:
None
set_external_url(external_url)
Set the external URL of the data job.
- Parameters:external_url (
str) - Return type:
None
set_fine_grained_lineages(lineages)
- Parameters:lineages (
List[FineGrainedLineageClass]) – - Return type:
None
set_inlets(inlets)
Set the inlets of the data job.
- Parameters:inlets (
List[Union[str,DatasetUrn]]) – - Return type:
None
set_last_modified(last_modified)
Set the last modification timestamp of the data job.
- Parameters:last_modified (
datetime) - Return type:
None
set_outlets(outlets)
Set the outlets of the data job.
- Parameters:outlets (
List[Union[str,DatasetUrn]]) – - Return type:
None
property urn : DataJobUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
DataFlow
Bases: HasPlatformInstance, HasSubtype, HasOwnership, HasContainer, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasStructuredProperties, Entity
Represents a dataflow in DataHub. A dataflow represents a collection of data, such as a table, view, or file. This class provides methods for managing dataflow metadata including schema, lineage, and various aspects like ownership, tags, and terms.
- Parameters:
- name (
str) - platform (
str) - display_name (
Optional[str]) - platform_instance (
Optional[str]) - env (
str) - description (
Optional[str]) - external_url (
Optional[str]) - custom_properties (
Optional[Dict[str,str]]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - subtype (
Optional[str]) - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - parent_container (
Union[Container,ContainerKey,Sequence[Union[Urn,str]],Unset]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- name (
property created : datetime | None
Get the creation timestamp of the dataflow. :returns: The creation timestamp if set, None otherwise.
property custom_properties : Dict[str, str]
Get the custom properties of the dataflow. :returns: Dictionary of custom properties.
property description : str | None
Get the description of the dataflow. :returns: The description if set, None otherwise.
property display_name : str | None
Get the display name of the dataflow. :returns: The display name if set, None otherwise.
property env : str | FabricTypeClass | None
Get the environment of the dataflow.
property external_url : str | None
Get the external URL of the dataflow. :returns: The external URL if set, None otherwise.
classmethod get_urn_type()
Get the URN type for dataflows.
:rtype: Type[DataFlowUrn]
:returns: The DataflowUrn class.
- Return type:Type[DataFlowUrn]
property last_modified : datetime | None
Get the last modification timestamp of the dataflow. :returns: The last modification timestamp if set, None otherwise.
property name : str
Get the name of the dataflow. :returns: The name of the dataflow.
set_created(created)
Set the creation timestamp of the dataflow.
:type created: datetime
:param created: The creation timestamp to set.
- Return type:
None - Parameters:created (datetime)
set_custom_properties(custom_properties)
Set the custom properties of the dataflow.
:type custom_properties: Dict[str, str]
:param custom_properties: Dictionary of custom properties to set.
- Return type:
None - Parameters:custom_properties (Dict [str,str])
set_description(description)
Set the description of the dataflow.
:type description: str
:param description: The description to set.
:rtype: None
NOTE
If called during ingestion, this will warn if overwriting a non-ingestion description.
- Parameters:description (str)
- Return type: None
set_display_name(display_name)
Set the display name of the dataflow.
:type display_name: str
:param display_name: The display name to set.
- Return type:
None - Parameters:display_name (str)
set_external_url(external_url)
Set the external URL of the dataflow.
:type external_url: str
:param external_url: The external URL to set.
- Return type:
None - Parameters:external_url (str)
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
property urn : DataFlowUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
AiContextInput
Bases: object
Input container for the first-class aiContext aspect.
The aspect is only emitted when at least one field carries content; an
all-empty AiContextInput produces no aspect.
- Parameters:
- synonyms (
Optional[List[str]]) - instructions (
Optional[str]) - examples (
Optional[List[str]]) - custom_instructions (
Optional[str])
- synonyms (
custom_instructions : Optional[str] = None
examples : Optional[List[str]] = None
instructions : Optional[str] = None
synonyms : Optional[List[str]] = None
DialectExpressionInput
Bases: object
A single (dialect, expression) pair for a metric or field expression.
- Parameters:
- expression (
str) - dialect (
Union[str,DialectClass]) –
- expression (
dialect : Union[str, DialectClass] = 'ANSI_SQL'
expression : str
SemanticFieldInput
Bases: object
A schema field plus its semantic annotation and optional AI context.
expression is required on the emitted semanticFieldAnnotation; when
omitted it is auto-synthesized as f"{alias}.{field_path}" so the field
references its own logical dataset by alias.
- Parameters:
- field_path (
str) - type (
str) - semantic_type (
Union[str,SemanticFieldTypeClass]) – - description (
Optional[str]) - nullable (
bool) - is_part_of_key (
bool) - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - expression (
Union[str,DialectExpressionInput,List[DialectExpressionInput],MetricExpressionClass,None]) – - aggregation_function (
Optional[str]) - is_time_dimension (
bool) - ai_context (
Optional[AiContextInput]) –
- field_path (
aggregation_function : Optional[str] = None
ai_context : Optional[AiContextInput] = None
description : Optional[str] = None
expression : Union[str, DialectExpressionInput, List[DialectExpressionInput], MetricExpressionClass, None] = None
field_path : str
is_part_of_key : bool = False
is_time_dimension : bool = False
nullable : bool = True
semantic_type : Union[str, SemanticFieldTypeClass]
tags : Optional[Sequence[Union[str, TagUrn, TagAssociationClass]]] = None
type : str
SemanticModel
Bases: HasPlatformInstance, HasOwnership, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasStructuredProperties, Entity
A semantic model: a logical grouping of datasets with dimensional context.
The semantic model is the bridge between raw datasets and the business
metrics calculated over them. Each logical dataset it exposes is its own
dataset entity (subtype Semantic Model Dataset) carrying a
semanticModelProperties back-reference; metrics point back at the model
via metricInfo.semanticModel (the ModeledBy lineage edge).
The canonical lineage chain is:
Metric -> SemanticModel -> Logical Dataset -> Physical Dataset
expressed entirely by metricInfo.semanticModel (ModeledBy),
semanticModelInfo.datasets (Contains), and each logical dataset’s own
upstreamLineage. Do not populate metricUpstreams for
semantic-model-backed metrics.
Server compatibility: requires a server build that includes the
semanticModel/metric model (operator’s responsibility — no automatic
check). See datahub.sdk.require_metrics_support() for an opt-in
preflight helper.
- Parameters:
- platform (
str) - path (
str) - id (
str) - platform_instance (
Optional[str]) - name (
Optional[str]) - description (
Optional[str]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - native_definition (
Optional[str]) - datasets (
Optional[Sequence[Union[str,DatasetUrn,SemanticModelDataset]]]) – - relationships (
Optional[Sequence[SemanticModelRelationshipInput]]) – - ai_context (
Optional[AiContextInput]) – - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- platform (
add_dataset(dataset)
Attach a logical dataset to this model.
If dataset is a SemanticModelDataset, its
semanticModelProperties.semanticModel back-reference is reconciled
to this model’s URN (so the caller does not have to set it twice) and
its alias is left as the source of truth for relationship join paths.
Insertion order is preserved across re-emits.
- Parameters:dataset (
Union[str,DatasetUrn,SemanticModelDataset]) – - Return type:
None
add_relationship(relationship)
- Parameters:relationship (
SemanticModelRelationshipInput) – - Return type:
None
property ai_context : AiContextClass | None
as_mcps(change_type='UPSERT')
Convert the entity’s aspects to MetadataChangeProposals.
- Parameters:change_type (
Union[str,ChangeTypeClass]) – The type of change to apply (default: UPSERT). - Return type:
List[MetadataChangeProposalWrapper] - Returns: A list of MetadataChangeProposalWrapper objects.
property created : datetime | None
property datasets : List[str]
property description : str | None
classmethod get_urn_type()
Get the URN type for this entity class.
- Return type:
Type[SemanticModelUrn] - Returns: The URN type class that corresponds to this entity type.
property last_modified : datetime | None
property name : str
property native_definition : str | None
property relationships : List[SemanticModelRelationshipClass] | None
set_ai_context(ai_context)
- Parameters:ai_context (
AiContextInput) – - Return type:
None
set_created(created)
- Parameters:created (
datetime) - Return type:
None
set_datasets(datasets)
- Parameters:datasets (
Sequence[Union[str,DatasetUrn,SemanticModelDataset]]) – - Return type:
None
set_description(description)
- Parameters:description (
str) - Return type:
None
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
set_name(name)
- Parameters:name (
str) - Return type:
None
set_native_definition(native_definition)
- Parameters:native_definition (
str) - Return type:
None
set_relationships(relationships)
- Parameters:relationships (
Sequence[SemanticModelRelationshipInput]) – - Return type:
None
property urn : SemanticModelUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.
SemanticModelDataset
Bases: Dataset
A logical dataset exposed by a SemanticModel.
This is a standard Dataset carrying the Semantic Model Dataset
subtype and a semanticModelProperties back-reference to its owning
semantic model. Per-field semantic metadata (semanticFieldAnnotation)
and per-field AI hints (aiContext) are layered on each field’s
schemaField URN and emitted on serialization alongside the
dataset-anchored aspects.
The dataset name should encode <sm_path>.<sm_id>.<view_name> so
logical datasets stay unique across semantic models.
Per-field semanticFieldAnnotation and field-level aiContext are
create-only: they are field-anchored (on schemaField URNs), not part
of the dataset aspect bag. A logical dataset shares the dataset entity
type, so client.entities.get(...) hydrates it as a base Dataset
and the annotations are not carried back on a read. To update one, rebuild a
fresh SemanticModelDataset and re-attach its fields via the schema
constructor kwarg rather than read-modify-writing the fetched Dataset.
Server compatibility: requires a server build that includes the
semanticModel/metric model (operator’s responsibility — no automatic
check). See datahub.sdk.require_metrics_support() for an opt-in
preflight helper.
- Parameters:
- platform (
str) - name (
str) - semantic_model (
Union[str,SemanticModelUrn]) – - alias (
str) - schema (
Sequence[SemanticFieldInput]) – - platform_instance (
Optional[str]) - env (
str) - description (
Optional[str]) - view_definition (
Optional[str]) - upstreams (
Union[UpstreamLineageClass,List[Union[str,DatasetUrn,UpstreamClass,FineGrainedLineageClass]],Dict[Union[str,DatasetUrn],Dict[str,List[str]]],None]) – - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- platform (
property alias : str
as_mcps(change_type='UPSERT')
Convert the entity’s aspects to MetadataChangeProposals.
- Parameters:change_type (
Union[str,ChangeTypeClass]) – The type of change to apply (default: UPSERT). - Return type:
List[MetadataChangeProposalWrapper] - Returns: A list of MetadataChangeProposalWrapper objects.
SemanticModelRelationshipInput
Bases: object
A join path between two logical datasets in a semantic model.
from_alias/to_alias must match the alias of the corresponding
logical datasets’ semanticModelProperties.
- Parameters:
- from_alias (
str) - from_columns (
List[str]) - to_alias (
str) - to_columns (
List[str]) - name (
Optional[str]) - cardinality (
Optional[str]) - ai_context (
Optional[AiContextInput]) –
- from_alias (
ai_context : Optional[AiContextInput] = None
cardinality : Optional[str] = None
from_alias : str
from_columns : List[str]
name : Optional[str] = None
to_alias : str
to_columns : List[str]
AiContextInput
Bases: object
Input container for the first-class aiContext aspect.
The aspect is only emitted when at least one field carries content; an
all-empty AiContextInput produces no aspect.
- Parameters:
- synonyms (
Optional[List[str]]) - instructions (
Optional[str]) - examples (
Optional[List[str]]) - custom_instructions (
Optional[str])
- synonyms (
custom_instructions : Optional[str] = None
examples : Optional[List[str]] = None
instructions : Optional[str] = None
synonyms : Optional[List[str]] = None
DialectExpressionInput
Bases: object
A single (dialect, expression) pair for a metric or field expression.
- Parameters:
- expression (
str) - dialect (
Union[str,DialectClass]) –
- expression (
dialect : Union[str, DialectClass] = 'ANSI_SQL'
expression : str
Metric
Bases: HasPlatformInstance, HasOwnership, HasInstitutionalMemory, HasTags, HasTerms, HasDomain, HasStructuredProperties, Entity
A metric: a business measure calculated over a semantic model.
A semantic-model-backed metric points at its owning model via
metricInfo.semanticModel (the ModeledBy lineage edge). Its lineage
flows Metric -> SemanticModel -> Logical Dataset -> Physical Dataset;
do not populate metricUpstreams for these metrics.
This builder emits semantic-model-backed metrics; semantic_model is
required. Standalone/metricUpstreams metrics are out of scope for now.
metricRelationships is always emitted (even with empty derivedFrom)
so hasParentMetric indexes as false. metricInfo.expression is
optional and is omitted when not provided.
Server compatibility: requires a server build that includes the
semanticModel/metric model (operator’s responsibility — no automatic
check). See datahub.sdk.require_metrics_support() for an opt-in
preflight helper.
- Parameters:
- platform (
str) - path (
str) - id (
str) - semantic_model (
Union[str,SemanticModelUrn]) – - platform_instance (
Optional[str]) - name (
Optional[str]) - description (
Optional[str]) - created (
Optional[datetime]) - last_modified (
Optional[datetime]) - expression (
Union[str,DialectExpressionInput,List[DialectExpressionInput],MetricExpressionClass,None]) – - derived_from (
Optional[Sequence[Union[str,MetricUrn]]]) – - ai_context (
Optional[AiContextInput]) – - owners (
Optional[Sequence[Union[CorpUserUrn,CorpGroupUrn,Tuple[Union[CorpUserUrn,CorpGroupUrn],Union[str,OwnershipTypeUrn]],OwnerClass]]]) – - links (
Optional[Sequence[Union[str,Tuple[str,str],InstitutionalMemoryMetadataClass]]]) – - tags (
Optional[Sequence[Union[str,TagUrn,TagAssociationClass]]]) – - terms (
Optional[Sequence[Union[str,GlossaryTermUrn,GlossaryTermAssociationClass]]]) – - domain (
Union[str,DomainUrn,None]) – - structured_properties (
Optional[Dict[Union[str,StructuredPropertyUrn],Sequence[Union[str,float,int]]]]) – - extra_aspects (
Optional[List[TypeVar(Aspect, bound=_Aspect)]]) –
- platform (
add_derived_from(metric)
- Parameters:metric (
Union[str,MetricUrn]) – - Return type:
None
property ai_context : AiContextClass | None
property created : datetime | None
property derived_from : List[DerivedMetricInputClass]
property description : str | None
property expression : MetricExpressionClass | None
classmethod get_urn_type()
Get the URN type for this entity class.
- Return type:
Type[MetricUrn] - Returns: The URN type class that corresponds to this entity type.
property last_modified : datetime | None
property name : str
property semantic_model : str | None
set_ai_context(ai_context)
- Parameters:ai_context (
AiContextInput) – - Return type:
None
set_created(created)
- Parameters:created (
datetime) - Return type:
None
set_derived_from(derived_from)
- Parameters:derived_from (
Sequence[Union[str,MetricUrn]]) – - Return type:
None
set_description(description)
- Parameters:description (
str) - Return type:
None
set_expression(expression, *, default_dialect='ANSI_SQL')
- Parameters:
- expression (
Union[str,DialectExpressionInput,List[DialectExpressionInput],MetricExpressionClass]) – - default_dialect (
Union[str,DialectClass]) –
- expression (
- Return type:
None
set_last_modified(last_modified)
- Parameters:last_modified (
datetime) - Return type:
None
set_name(name)
- Parameters:name (
str) - Return type:
None
set_semantic_model(semantic_model)
- Parameters:semantic_model (
Union[str,SemanticModelUrn]) – - Return type:
None
property urn : MetricUrn
Get the entity’s URN.
- Returns: The URN that uniquely identifies this entity.