Skip to content

Commit

Permalink
Merge branch 'master' into snowflake_shares_lineage_siblings
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurinehate authored Aug 14, 2023
2 parents 89a06b1 + b4d4632 commit 4f6035a
Show file tree
Hide file tree
Showing 150 changed files with 2,279 additions and 1,421 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ If you're looking to build & modify datahub please take a look at our [Developme
- [acryldata/datahub-actions](https://github.com/acryldata/datahub-actions): DataHub Actions is a framework for responding to changes to your DataHub Metadata Graph in real time.
- [acryldata/datahub-helm](https://github.com/acryldata/datahub-helm): Repository of helm charts for deploying DataHub on a Kubernetes cluster
- [acryldata/meta-world](https://github.com/acryldata/meta-world): A repository to store recipes, custom sources, transformations and other things to make your DataHub experience magical
- [dbt-impact-action](https://github.com/acryldata/dbt-impact-action) : This repository contains a github action for commenting on your PRs with a summary of the impact of changes within a dbt project
- [datahub-tools](https://github.com/makenotion/datahub-tools) : Additional python tools to interact with the DataHub GraphQL endpoints, built by Notion
- [business-glossary-sync-action](https://github.com/acryldata/business-glossary-sync-action) : This repository contains a github action that opens PRs to update your business glossary yaml file.

## Releases

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private List<AnalyticsChart> getCharts(MetadataAnalyticsInput input, Authenticat
}

SearchResult searchResult = _entityClient.searchAcrossEntities(entities, query, filter, 0, 0,
null, authentication);
null, null, authentication);

List<AggregationMetadata> aggregationMetadataList = searchResult.getMetadata().getAggregations();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import com.datahub.authorization.DisjunctivePrivilegeGroup;
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.resolvers.AuthUtils;
import com.linkedin.datahub.graphql.resolvers.mutate.MutationUtils;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.metadata.Constants;
import com.linkedin.metadata.authorization.PoliciesConfig;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -74,7 +74,7 @@ private boolean isAuthorizedToDeleteAssertion(final QueryContext context, final

// 2. fetch the assertion info
AssertionInfo info =
(AssertionInfo) MutationUtils.getAspectFromEntity(
(AssertionInfo) EntityUtils.getAspectFromEntity(
assertionUrn.toString(), Constants.ASSERTION_INFO_ASPECT_NAME, _entityService, null);

if (info != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public CompletableFuture<SearchResults> get(final DataFetchingEnvironment enviro
start,
count,
null,
null,
context.getAuthentication()
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public CompletableFuture<SearchResults> get(DataFetchingEnvironment environment)
start,
count,
searchFlags,
null,
ResolverUtils.getAuthentication(environment)));
} catch (Exception e) {
log.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.linkedin.entity.client.EntityClient;
import com.linkedin.metadata.authorization.PoliciesConfig;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import com.linkedin.mxe.MetadataChangeProposal;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
Expand All @@ -23,7 +24,7 @@
import lombok.extern.slf4j.Slf4j;

import static com.linkedin.datahub.graphql.resolvers.ResolverUtils.*;
import static com.linkedin.datahub.graphql.resolvers.mutate.MutationUtils.*;
import com.linkedin.datahub.graphql.resolvers.mutate.MutationUtils;
import static com.linkedin.metadata.Constants.*;


Expand Down Expand Up @@ -55,15 +56,15 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw
_entityService
);
try {
Deprecation deprecation = (Deprecation) getAspectFromEntity(
Deprecation deprecation = (Deprecation) EntityUtils.getAspectFromEntity(
entityUrn.toString(),
DEPRECATION_ASPECT_NAME,
_entityService,
new Deprecation());
updateDeprecation(deprecation, input, context);

// Create the Deprecation aspect
final MetadataChangeProposal proposal = buildMetadataChangeProposalWithUrn(entityUrn, DEPRECATION_ASPECT_NAME, deprecation);
final MetadataChangeProposal proposal = MutationUtils.buildMetadataChangeProposalWithUrn(entityUrn, DEPRECATION_ASPECT_NAME, deprecation);
_entityClient.ingestProposal(proposal, context.getAuthentication(), false);
return true;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public CompletableFuture<SearchResults> get(final DataFetchingEnvironment enviro
start,
count,
null,
null,
context.getAuthentication()
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.linkedin.domain.Domains;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import com.linkedin.mxe.MetadataChangeProposal;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
Expand Down Expand Up @@ -47,7 +48,7 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw
_entityService
);
try {
Domains domains = (Domains) getAspectFromEntity(
Domains domains = (Domains) EntityUtils.getAspectFromEntity(
entityUrn.toString(),
DOMAINS_ASPECT_NAME,
_entityService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.linkedin.domain.Domains;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import com.linkedin.mxe.MetadataChangeProposal;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
Expand Down Expand Up @@ -47,7 +48,7 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw
_entityService
);
try {
Domains domains = (Domains) getAspectFromEntity(
Domains domains = (Domains) EntityUtils.getAspectFromEntity(
entityUrn.toString(),
DOMAINS_ASPECT_NAME,
_entityService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.linkedin.datahub.graphql.generated.UpdateEmbedInput;
import com.linkedin.datahub.graphql.resolvers.mutate.util.EmbedUtils;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import com.linkedin.mxe.MetadataChangeProposal;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
Expand Down Expand Up @@ -49,7 +50,7 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw
_entityService
);
try {
final Embed embed = (Embed) getAspectFromEntity(
final Embed embed = (Embed) EntityUtils.getAspectFromEntity(
entityUrn.toString(),
EMBED_ASPECT_NAME,
_entityService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.linkedin.metadata.Constants;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.glossary.GlossaryRelatedTerms;
import com.linkedin.metadata.entity.EntityUtils;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -48,7 +49,7 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw
validateRelatedTermsInput(urn, termUrns);
Urn actor = Urn.createFromString(((QueryContext) context).getActorUrn());

GlossaryRelatedTerms glossaryRelatedTerms = (GlossaryRelatedTerms) getAspectFromEntity(
GlossaryRelatedTerms glossaryRelatedTerms = (GlossaryRelatedTerms) EntityUtils.getAspectFromEntity(
urn.toString(),
Constants.GLOSSARY_RELATED_TERM_ASPECT_NAME,
_entityService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.linkedin.glossary.GlossaryRelatedTerms;
import com.linkedin.metadata.Constants;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import lombok.RequiredArgsConstructor;
Expand All @@ -21,7 +22,6 @@
import java.util.stream.Collectors;

import static com.linkedin.datahub.graphql.resolvers.ResolverUtils.bindArgument;
import static com.linkedin.datahub.graphql.resolvers.mutate.MutationUtils.getAspectFromEntity;
import static com.linkedin.datahub.graphql.resolvers.mutate.MutationUtils.persistAspect;

@Slf4j
Expand Down Expand Up @@ -51,7 +51,7 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw

Urn actor = Urn.createFromString(((QueryContext) context).getActorUrn());

GlossaryRelatedTerms glossaryRelatedTerms = (GlossaryRelatedTerms) getAspectFromEntity(
GlossaryRelatedTerms glossaryRelatedTerms = (GlossaryRelatedTerms) EntityUtils.getAspectFromEntity(
urn.toString(),
Constants.GLOSSARY_RELATED_TERM_ASPECT_NAME,
_entityService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.linkedin.metadata.Constants;
import com.linkedin.metadata.authorization.PoliciesConfig;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.EntityUtils;
import com.linkedin.ml.metadata.EditableMLFeatureProperties;
import com.linkedin.ml.metadata.EditableMLFeatureTableProperties;
import com.linkedin.ml.metadata.EditableMLModelGroupProperties;
Expand All @@ -40,8 +41,6 @@ public class DescriptionUtils {

private DescriptionUtils() { }

public static final String EDITABLE_SCHEMA_METADATA = "editableSchemaMetadata";

public static void updateFieldDescription(
String newDescription,
Urn resourceUrn,
Expand All @@ -50,13 +49,13 @@ public static void updateFieldDescription(
EntityService entityService
) {
EditableSchemaMetadata editableSchemaMetadata =
(EditableSchemaMetadata) getAspectFromEntity(
resourceUrn.toString(), EDITABLE_SCHEMA_METADATA, entityService, new EditableSchemaMetadata());
(EditableSchemaMetadata) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.EDITABLE_SCHEMA_METADATA_ASPECT_NAME, entityService, new EditableSchemaMetadata());
EditableSchemaFieldInfo editableFieldInfo = getFieldInfoFromSchema(editableSchemaMetadata, fieldPath);

editableFieldInfo.setDescription(newDescription);

persistAspect(resourceUrn, EDITABLE_SCHEMA_METADATA, editableSchemaMetadata, actor, entityService);
persistAspect(resourceUrn, Constants.EDITABLE_SCHEMA_METADATA_ASPECT_NAME, editableSchemaMetadata, actor, entityService);
}

public static void updateContainerDescription(
Expand All @@ -66,7 +65,7 @@ public static void updateContainerDescription(
EntityService entityService
) {
EditableContainerProperties containerProperties =
(EditableContainerProperties) getAspectFromEntity(
(EditableContainerProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.CONTAINER_EDITABLE_PROPERTIES_ASPECT_NAME, entityService, new EditableContainerProperties());
containerProperties.setDescription(newDescription);
persistAspect(resourceUrn, Constants.CONTAINER_EDITABLE_PROPERTIES_ASPECT_NAME, containerProperties, actor, entityService);
Expand All @@ -79,7 +78,7 @@ public static void updateDomainDescription(
EntityService entityService
) {
DomainProperties domainProperties =
(DomainProperties) getAspectFromEntity(
(DomainProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.DOMAIN_PROPERTIES_ASPECT_NAME, entityService, null);
if (domainProperties == null) {
// If there are no properties for the domain already, then we should throw since the properties model also requires a name.
Expand All @@ -96,7 +95,7 @@ public static void updateTagDescription(
EntityService entityService
) {
TagProperties tagProperties =
(TagProperties) getAspectFromEntity(
(TagProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.TAG_PROPERTIES_ASPECT_NAME, entityService, null);
if (tagProperties == null) {
// If there are no properties for the tag already, then we should throw since the properties model also requires a name.
Expand All @@ -113,7 +112,7 @@ public static void updateCorpGroupDescription(
EntityService entityService
) {
CorpGroupEditableInfo corpGroupEditableInfo =
(CorpGroupEditableInfo) getAspectFromEntity(
(CorpGroupEditableInfo) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.CORP_GROUP_EDITABLE_INFO_ASPECT_NAME, entityService, new CorpGroupEditableInfo());
if (corpGroupEditableInfo != null) {
corpGroupEditableInfo.setDescription(newDescription);
Expand All @@ -127,7 +126,7 @@ public static void updateGlossaryTermDescription(
Urn actor,
EntityService entityService
) {
GlossaryTermInfo glossaryTermInfo = (GlossaryTermInfo) getAspectFromEntity(
GlossaryTermInfo glossaryTermInfo = (GlossaryTermInfo) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.GLOSSARY_TERM_INFO_ASPECT_NAME, entityService, null);
if (glossaryTermInfo == null) {
// If there are no properties for the term already, then we should throw since the properties model also requires a name.
Expand All @@ -143,7 +142,7 @@ public static void updateGlossaryNodeDescription(
Urn actor,
EntityService entityService
) {
GlossaryNodeInfo glossaryNodeInfo = (GlossaryNodeInfo) getAspectFromEntity(
GlossaryNodeInfo glossaryNodeInfo = (GlossaryNodeInfo) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.GLOSSARY_NODE_INFO_ASPECT_NAME, entityService, null);
if (glossaryNodeInfo == null) {
throw new IllegalArgumentException("Glossary Node does not exist");
Expand All @@ -157,7 +156,7 @@ public static void updateNotebookDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
EditableNotebookProperties notebookProperties = (EditableNotebookProperties) getAspectFromEntity(
EditableNotebookProperties notebookProperties = (EditableNotebookProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.EDITABLE_NOTEBOOK_PROPERTIES_ASPECT_NAME, entityService, null);
if (notebookProperties != null) {
notebookProperties.setDescription(newDescription);
Expand Down Expand Up @@ -293,7 +292,7 @@ public static void updateMlModelDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
EditableMLModelProperties editableProperties = (EditableMLModelProperties) getAspectFromEntity(
EditableMLModelProperties editableProperties = (EditableMLModelProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.ML_MODEL_EDITABLE_PROPERTIES_ASPECT_NAME, entityService, new EditableMLModelProperties());
if (editableProperties != null) {
editableProperties.setDescription(newDescription);
Expand All @@ -306,7 +305,7 @@ public static void updateMlModelGroupDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
EditableMLModelGroupProperties editableProperties = (EditableMLModelGroupProperties) getAspectFromEntity(
EditableMLModelGroupProperties editableProperties = (EditableMLModelGroupProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.ML_MODEL_GROUP_EDITABLE_PROPERTIES_ASPECT_NAME, entityService, new EditableMLModelGroupProperties());
if (editableProperties != null) {
editableProperties.setDescription(newDescription);
Expand All @@ -318,7 +317,7 @@ public static void updateMlFeatureDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
EditableMLFeatureProperties editableProperties = (EditableMLFeatureProperties) getAspectFromEntity(
EditableMLFeatureProperties editableProperties = (EditableMLFeatureProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.ML_FEATURE_EDITABLE_PROPERTIES_ASPECT_NAME, entityService, new EditableMLFeatureProperties());
if (editableProperties != null) {
editableProperties.setDescription(newDescription);
Expand All @@ -331,7 +330,7 @@ public static void updateMlFeatureTableDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
EditableMLFeatureTableProperties editableProperties = (EditableMLFeatureTableProperties) getAspectFromEntity(
EditableMLFeatureTableProperties editableProperties = (EditableMLFeatureTableProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.ML_FEATURE_TABLE_EDITABLE_PROPERTIES_ASPECT_NAME, entityService, new EditableMLFeatureTableProperties());
if (editableProperties != null) {
editableProperties.setDescription(newDescription);
Expand All @@ -344,7 +343,7 @@ public static void updateMlPrimaryKeyDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
EditableMLPrimaryKeyProperties editableProperties = (EditableMLPrimaryKeyProperties) getAspectFromEntity(
EditableMLPrimaryKeyProperties editableProperties = (EditableMLPrimaryKeyProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.ML_PRIMARY_KEY_EDITABLE_PROPERTIES_ASPECT_NAME, entityService, new EditableMLPrimaryKeyProperties());
if (editableProperties != null) {
editableProperties.setDescription(newDescription);
Expand All @@ -357,7 +356,7 @@ public static void updateDataProductDescription(
Urn resourceUrn,
Urn actor,
EntityService entityService) {
DataProductProperties properties = (DataProductProperties) getAspectFromEntity(
DataProductProperties properties = (DataProductProperties) EntityUtils.getAspectFromEntity(
resourceUrn.toString(), Constants.DATA_PRODUCT_PROPERTIES_ASPECT_NAME, entityService, new DataProductProperties());
if (properties != null) {
properties.setDescription(newDescription);
Expand Down
Loading

0 comments on commit 4f6035a

Please sign in to comment.