diff --git a/datahub-graphql-core/src/main/resources/entity.graphql b/datahub-graphql-core/src/main/resources/entity.graphql index d2f43b5bf9..86f833ca11 100644 --- a/datahub-graphql-core/src/main/resources/entity.graphql +++ b/datahub-graphql-core/src/main/resources/entity.graphql @@ -518,7 +518,7 @@ type EntityRelationship { """ Entity that is related via lineage """ - entity: Entity! + entity: Entity """ An AuditStamp corresponding to the last modification of this relationship @@ -563,7 +563,7 @@ type LineageRelationship { """ Entity that is related via lineage """ - entity: Entity! + entity: Entity """ Degree of relationship (number of hops to get to entity) diff --git a/datahub-web-react/src/app/entity/EntityRegistry.tsx b/datahub-web-react/src/app/entity/EntityRegistry.tsx index 331decf93c..75386c7200 100644 --- a/datahub-web-react/src/app/entity/EntityRegistry.tsx +++ b/datahub-web-react/src/app/entity/EntityRegistry.tsx @@ -1,4 +1,4 @@ -import { EntityType, SearchResult } from '../../types.generated'; +import { Entity as EntityInterface, EntityType, SearchResult } from '../../types.generated'; import { FetchedEntity } from '../lineage/types'; import { Entity, IconStyleType, PreviewType } from './Entity'; import { GenericEntityProperties } from './shared/types'; @@ -120,6 +120,18 @@ export default class EntityRegistry { return ( ({ ...entity.getLineageVizConfig?.(data), + downstreamChildren: genericEntityProperties?.downstream?.relationships + ?.filter((relationship) => relationship.entity) + ?.map((relationship) => ({ + entity: relationship.entity as EntityInterface, + type: (relationship.entity as EntityInterface).type, + })), + upstreamChildren: genericEntityProperties?.upstream?.relationships + ?.filter((relationship) => relationship.entity) + ?.map((relationship) => ({ + entity: relationship.entity as EntityInterface, + type: (relationship.entity as EntityInterface).type, + })), status: genericEntityProperties?.status, } as FetchedEntity) || undefined ); diff --git a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx index 06faaf5be5..1ec0a60f80 100644 --- a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx +++ b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx @@ -15,7 +15,6 @@ import { ChartInputsTab } from '../shared/tabs/Entity/ChartInputsTab'; import { ChartDashboardsTab } from '../shared/tabs/Entity/ChartDashboardsTab'; import { getDataForEntityType } from '../shared/containers/profile/utils'; import { capitalizeFirstLetter } from '../../shared/textUtil'; -import { EntityAndType } from '../../lineage/types'; import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection'; /** @@ -180,14 +179,6 @@ export class ChartEntity implements Entity { urn: entity.urn, name: entity.properties?.name || '', type: EntityType.Chart, - // eslint-disable-next-line @typescript-eslint/dot-notation - downstreamChildren: entity?.['downstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), - // eslint-disable-next-line @typescript-eslint/dot-notation - upstreamChildren: entity?.['upstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), icon: entity?.platform?.properties?.logoUrl || '', platform: entity.tool, }; diff --git a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx index fb1135f6b3..5b8dafe76a 100644 --- a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx +++ b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx @@ -6,7 +6,6 @@ import { useUpdateDashboardMutation, } from '../../../graphql/dashboard.generated'; import { Dashboard, EntityType, OwnershipType, PlatformType, SearchResult } from '../../../types.generated'; -import { EntityAndType } from '../../lineage/types'; import { Entity, IconStyleType, PreviewType } from '../Entity'; import { EntityProfile } from '../shared/containers/profile/EntityProfile'; import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection'; @@ -180,14 +179,6 @@ export class DashboardEntity implements Entity { urn: entity.urn, name: entity.properties?.name || '', type: EntityType.Dashboard, - // eslint-disable-next-line @typescript-eslint/dot-notation - downstreamChildren: entity?.['downstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), - // eslint-disable-next-line @typescript-eslint/dot-notation - upstreamChildren: entity?.['upstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), icon: entity?.platform?.properties?.logoUrl || '', platform: entity.tool, }; diff --git a/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx b/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx index 2d66322c80..eb55fa6dce 100644 --- a/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx +++ b/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx @@ -16,7 +16,6 @@ import { DataJobFlowTab } from '../shared/tabs/Entity/DataJobFlowTab'; import { getDataForEntityType } from '../shared/containers/profile/utils'; import { capitalizeFirstLetter } from '../../shared/textUtil'; import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection'; -import { EntityAndType } from '../../lineage/types'; /** * Definition of the DataHub DataJob entity. @@ -178,14 +177,6 @@ export class DataJobEntity implements Entity { name: entity?.properties?.name || '', type: EntityType.DataJob, icon: entity?.dataFlow?.platform?.properties?.logoUrl || '', - // eslint-disable-next-line @typescript-eslint/dot-notation - downstreamChildren: entity?.['downstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), - // eslint-disable-next-line @typescript-eslint/dot-notation - upstreamChildren: entity?.['upstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), platform: entity?.dataFlow?.orchestrator || '', }; }; diff --git a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx index b0b67f3ca6..9010d61b98 100644 --- a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx +++ b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx @@ -23,7 +23,6 @@ import ViewDefinitionTab from '../shared/tabs/Dataset/View/ViewDefinitionTab'; import { SidebarViewDefinitionSection } from '../shared/containers/profile/sidebar/Dataset/View/SidebarViewDefinitionSection'; import { SidebarRecommendationsSection } from '../shared/containers/profile/sidebar/Recommendations/SidebarRecommendationsSection'; import { getDataForEntityType } from '../shared/containers/profile/utils'; -import { EntityAndType } from '../../lineage/types'; import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection'; import { ValidationsTab } from '../shared/tabs/Dataset/Validations/ValidationsTab'; @@ -259,14 +258,6 @@ export class DatasetEntity implements Entity { name: entity.properties?.name || entity.name, type: EntityType.Dataset, subtype: entity.subTypes?.typeNames?.[0] || undefined, - // eslint-disable-next-line @typescript-eslint/dot-notation - downstreamChildren: entity?.['downstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), - // eslint-disable-next-line @typescript-eslint/dot-notation - upstreamChildren: entity?.['upstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), icon: entity?.platform?.properties?.logoUrl || undefined, platform: entity?.platform?.name, }; diff --git a/datahub-web-react/src/app/entity/mlModel/MLModelEntity.tsx b/datahub-web-react/src/app/entity/mlModel/MLModelEntity.tsx index 09a73bafeb..1b2148c42c 100644 --- a/datahub-web-react/src/app/entity/mlModel/MLModelEntity.tsx +++ b/datahub-web-react/src/app/entity/mlModel/MLModelEntity.tsx @@ -5,7 +5,6 @@ import { Preview } from './preview/Preview'; import { MLModelProfile } from './profile/MLModelProfile'; import { Entity, IconStyleType, PreviewType } from '../Entity'; import { getDataForEntityType } from '../shared/containers/profile/utils'; -import { EntityAndType } from '../../lineage/types'; /** * Definition of the DataHub MlModel entity. @@ -62,14 +61,6 @@ export class MLModelEntity implements Entity { urn: entity.urn, name: entity.name, type: EntityType.Mlmodel, - // eslint-disable-next-line @typescript-eslint/dot-notation - downstreamChildren: entity?.['downstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), - // eslint-disable-next-line @typescript-eslint/dot-notation - upstreamChildren: entity?.['upstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), icon: entity.platform?.properties?.logoUrl || undefined, platform: entity.platform?.name, }; diff --git a/datahub-web-react/src/app/entity/mlModelGroup/MLModelGroupEntity.tsx b/datahub-web-react/src/app/entity/mlModelGroup/MLModelGroupEntity.tsx index 62b19879dd..13cad0021b 100644 --- a/datahub-web-react/src/app/entity/mlModelGroup/MLModelGroupEntity.tsx +++ b/datahub-web-react/src/app/entity/mlModelGroup/MLModelGroupEntity.tsx @@ -5,7 +5,6 @@ import { Preview } from './preview/Preview'; import { Entity, IconStyleType, PreviewType } from '../Entity'; import { MLModelGroupProfile } from './profile/MLModelGroupProfile'; import { getDataForEntityType } from '../shared/containers/profile/utils'; -import { EntityAndType } from '../../lineage/types'; /** * Definition of the DataHub MlModelGroup entity. @@ -62,14 +61,6 @@ export class MLModelGroupEntity implements Entity { urn: entity.urn, name: entity.name, type: EntityType.MlmodelGroup, - // eslint-disable-next-line @typescript-eslint/dot-notation - downstreamChildren: entity?.['downstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), - // eslint-disable-next-line @typescript-eslint/dot-notation - upstreamChildren: entity?.['upstream']?.relationships?.map( - (relationship) => ({ entity: relationship.entity, type: relationship.entity.type } as EntityAndType), - ), icon: entity.platform?.properties?.logoUrl || undefined, platform: entity.platform?.name, }; diff --git a/datahub-web-react/src/app/entity/shared/EntityGroups.tsx b/datahub-web-react/src/app/entity/shared/EntityGroups.tsx index 361fcd03a6..fee500d8dc 100644 --- a/datahub-web-react/src/app/entity/shared/EntityGroups.tsx +++ b/datahub-web-react/src/app/entity/shared/EntityGroups.tsx @@ -22,7 +22,8 @@ export default function EntityGroups({ readMore, setReadMore, groupMemberRelatio {groupMemberRelationships?.relationships.length === 0 && } {!readMore && groupMemberRelationships?.relationships.slice(0, 2).map((item) => { - const entityUrn = entityRegistry.getEntityUrl(EntityType.CorpGroup, item.entity.urn); + if (!item?.entity?.urn) return null; + const entityUrn = entityRegistry.getEntityUrl(EntityType.CorpGroup, item?.entity?.urn); return ( @@ -34,6 +35,7 @@ export default function EntityGroups({ readMore, setReadMore, groupMemberRelatio {readMore && groupMemberRelationships?.relationships.length > 2 && groupMemberRelationships?.relationships.map((item) => { + if (!item?.entity?.urn) return null; const entityUrn = entityRegistry.getEntityUrl(EntityType.CorpGroup, item.entity.urn); return ( diff --git a/datahub-web-react/src/app/entity/shared/types.ts b/datahub-web-react/src/app/entity/shared/types.ts index a51dfd3eea..a46929228a 100644 --- a/datahub-web-react/src/app/entity/shared/types.ts +++ b/datahub-web-react/src/app/entity/shared/types.ts @@ -66,8 +66,8 @@ export type GenericEntityProperties = { editableSchemaMetadata?: Maybe; editableProperties?: Maybe; autoRenderAspects?: Maybe>; - upstreams?: Maybe; - downstreams?: Maybe; + upstream?: Maybe; + downstream?: Maybe; subTypes?: Maybe; entityCount?: number; container?: Maybe; diff --git a/metadata-ingestion/examples/mce_files/bootstrap_mce.json b/metadata-ingestion/examples/mce_files/bootstrap_mce.json index a73196d208..8cf6df899d 100644 --- a/metadata-ingestion/examples/mce_files/bootstrap_mce.json +++ b/metadata-ingestion/examples/mce_files/bootstrap_mce.json @@ -811,7 +811,14 @@ "dataset": "urn:li:dataset:(urn:li:dataPlatform:hive,logging_events,PROD)", "type": "TRANSFORMED" } - ] + ], + "fineGrainedLineages": [{ + "upstreamType": "FIELD_SET", + "upstreams": ["urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:hive,logging_events,PROD),event_data)"], + "downstreamType": "FIELD", + "upstreams": ["urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD),user_name)"], + "confidenceScore": 1.0 + }] } }, {