Skip to content

Commit

Permalink
fix(models): chart schema fields mapping, add dataHubAction entity, t… (
Browse files Browse the repository at this point in the history
  • Loading branch information
shirshanka authored Jul 30, 2024
1 parent d6be56f commit 7d4b645
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.generated.InputField;
import com.linkedin.datahub.graphql.types.dataset.mappers.SchemaFieldMapper;
import java.net.URISyntaxException;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.extern.slf4j.Slf4j;


@Slf4j
public class InputFieldsMapper {

public static final InputFieldsMapper INSTANCE = new InputFieldsMapper();
Expand All @@ -31,13 +35,19 @@ public com.linkedin.datahub.graphql.generated.InputFields apply(
.map(
field -> {
InputField fieldResult = new InputField();
Urn parentUrn = entityUrn;

if (field.hasSchemaField()) {
fieldResult.setSchemaField(
SchemaFieldMapper.map(context, field.getSchemaField(), entityUrn));
}
if (field.hasSchemaFieldUrn()) {
fieldResult.setSchemaFieldUrn(field.getSchemaFieldUrn().toString());
try {
parentUrn = Urn.createFromString(field.getSchemaFieldUrn().getEntityKey().get(0));
} catch (URISyntaxException e) {
log.error("Field urn resolution: failed to extract parentUrn successfully from {}. Falling back to {}", field.getSchemaFieldUrn(), entityUrn, e);
}
}
if (field.hasSchemaField()) {
fieldResult.setSchemaField(
SchemaFieldMapper.map(context, field.getSchemaField(), parentUrn));
}
return fieldResult;
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace com.linkedin.metadata.key

/**
* Key for a DataHub Action Pipeline
*/
@Aspect = {
"name": "dataHubActionKey"
}
record DataHubActionKey {
/**
* A unique id for the Action, either generated or provided
*/
id: string
}
26 changes: 26 additions & 0 deletions metadata-models/src/main/resources/entity-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ entities:
- forms
- subTypes
- incidentsSummary
- testResults
- name: dataFlow
category: core
keyAspect: dataFlowKey
Expand All @@ -96,12 +97,14 @@ entities:
- incidentsSummary
- forms
- subTypes
- testResults
- name: dataProcess
keyAspect: dataProcessKey
aspects:
- dataProcessInfo
- ownership
- status
- testResults
- name: dataProcessInstance
doc: DataProcessInstance represents an instance of a datajob/jobflow run
keyAspect: dataProcessInstanceKey
Expand All @@ -112,6 +115,7 @@ entities:
- dataProcessInstanceRelationships
- dataProcessInstanceRunEvent
- status
- testResults
- name: chart
category: core
keyAspect: chartKey
Expand All @@ -137,6 +141,7 @@ entities:
- structuredProperties
- incidentsSummary
- forms
- testResults
- name: dashboard
keyAspect: dashboardKey
aspects:
Expand All @@ -160,6 +165,7 @@ entities:
- structuredProperties
- incidentsSummary
- forms
- testResults
- name: notebook
doc: Notebook represents a combination of query, text, chart and etc. This is in BETA version
keyAspect: notebookKey
Expand All @@ -177,6 +183,7 @@ entities:
- subTypes
- dataPlatformInstance
- browsePathsV2
- testResults
- name: corpuser
doc: CorpUser represents an identity of a person (or an account) in the enterprise.
keyAspect: corpUserKey
Expand All @@ -194,6 +201,7 @@ entities:
- roleMembership
- structuredProperties
- forms
- testResults
- name: corpGroup
doc: CorpGroup represents an identity of a group of users in the enterprise.
keyAspect: corpGroupKey
Expand All @@ -207,6 +215,7 @@ entities:
- roleMembership
- structuredProperties
- forms
- testResults
- name: domain
doc: A data domain within an organization.
category: core
Expand All @@ -217,6 +226,7 @@ entities:
- ownership
- structuredProperties
- forms
- testResults
- name: container
doc: A container of related data assets.
category: core
Expand All @@ -237,6 +247,7 @@ entities:
- browsePathsV2
- structuredProperties
- forms
- testResults
- name: tag
category: core
keyAspect: tagKey
Expand All @@ -245,6 +256,7 @@ entities:
- ownership
- deprecation
- status
- testResults
- name: glossaryTerm
category: core
keyAspect: glossaryTermKey
Expand All @@ -260,6 +272,7 @@ entities:
- browsePaths
- structuredProperties
- forms
- testResults
- name: glossaryNode
category: core
keyAspect: glossaryNodeKey
Expand All @@ -270,6 +283,7 @@ entities:
- status
- structuredProperties
- forms
- testResults
- name: dataHubIngestionSource
category: internal
keyAspect: dataHubIngestionSourceKey
Expand Down Expand Up @@ -341,6 +355,7 @@ entities:
- browsePathsV2
- structuredProperties
- forms
- testResults
- name: mlModelGroup
category: core
keyAspect: mlModelGroupKey
Expand All @@ -358,6 +373,7 @@ entities:
- browsePathsV2
- structuredProperties
- forms
- testResults
- name: mlModelDeployment
category: core
keyAspect: mlModelDeploymentKey
Expand All @@ -368,6 +384,7 @@ entities:
- deprecation
- globalTags
- dataPlatformInstance
- testResults
- name: mlFeatureTable
category: core
keyAspect: mlFeatureTableKey
Expand All @@ -386,6 +403,7 @@ entities:
- browsePathsV2
- structuredProperties
- forms
- testResults
- name: mlFeature
category: core
keyAspect: mlFeatureKey
Expand All @@ -404,6 +422,7 @@ entities:
- browsePathsV2
- structuredProperties
- forms
- testResults
- name: mlPrimaryKey
category: core
keyAspect: mlPrimaryKeyKey
Expand All @@ -420,6 +439,7 @@ entities:
- dataPlatformInstance
- structuredProperties
- forms
- testResults
- name: telemetry
category: internal
keyAspect: telemetryKey
Expand Down Expand Up @@ -456,6 +476,7 @@ entities:
- forms
- businessAttributes
- documentation
- testResults
- name: globalSettings
doc: Global settings for an the platform
category: internal
Expand Down Expand Up @@ -523,6 +544,7 @@ entities:
- status
- structuredProperties
- forms
- testResults
- name: ownershipType
doc: Ownership Type represents a user-created ownership category for a person or group who is responsible for an asset.
category: core
Expand Down Expand Up @@ -550,6 +572,10 @@ entities:
keyAspect: dataHubPersonaKey
aspects:
- dataHubPersonaInfo
- name: dataHubAction
category: internal
keyAspect: dataHubActionKey
aspects: []
- name: entityType
doc: A type of entity in the DataHub Metadata Model.
category: core
Expand Down
Empty file.
20 changes: 20 additions & 0 deletions smoke-test/tests/schema_fields/queries/get_chart_field.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
query($urn:String!) {
chart(urn: $urn) {
inputFields {
fields {
schemaFieldUrn
schemaField {
schemaFieldEntity {
urn
fieldPath
documentation {
documentations {
documentation
}
}
}
}
}
}
}
}
Loading

0 comments on commit 7d4b645

Please sign in to comment.