Skip to content

Commit

Permalink
Merge branch 'datahub-project:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored Jul 2, 2024
2 parents 07bef8d + 40418d9 commit 2bbba5b
Show file tree
Hide file tree
Showing 176 changed files with 5,796 additions and 906 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish-datahub-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,29 @@ jobs:
echo signingKey=$SIGNING_KEY >> gradle.properties
./gradlew -PreleaseVersion=${{ needs.setup.outputs.tag }} :metadata-auth:auth-api:publish
./gradlew :metadata-auth:auth-api:closeAndReleaseRepository --info
- name: publish datahub-custom-plugin-lib snapshot jar
if: ${{ github.event_name != 'release' }}
env:
RELEASE_USERNAME: ${{ secrets.RELEASE_USERNAME }}
RELEASE_PASSWORD: ${{ secrets.RELEASE_PASSWORD }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
echo signingKey=$SIGNING_KEY >> gradle.properties
./gradlew :metadata-integration:java:custom-plugin-lib:printVersion
./gradlew :metadata-integration:java:custom-plugin-lib:publish
- name: release datahub-custom-plugin-lib jar
if: ${{ github.event_name == 'release' }}
env:
RELEASE_USERNAME: ${{ secrets.RELEASE_USERNAME }}
RELEASE_PASSWORD: ${{ secrets.RELEASE_PASSWORD }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
echo signingKey=$SIGNING_KEY >> gradle.properties
./gradlew -PreleaseVersion=${{ needs.setup.outputs.tag }} :metadata-integration:java:custom-plugin-lib:publish
./gradlew :metadata-integration:java:custom-plugin-lib:closeAndReleaseRepository --info
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.linkedin.datahub.graphql;

import com.google.common.collect.ImmutableSet;
import java.util.Set;

/** Constants relating to GraphQL type system & execution. */
public class Constants {

Expand Down Expand Up @@ -28,4 +31,11 @@ private Constants() {}
public static final String BROWSE_PATH_V2_DELIMITER = "␟";
public static final String VERSION_STAMP_FIELD_NAME = "versionStamp";
public static final String ENTITY_FILTER_NAME = "_entityType";

public static final Set<String> DEFAULT_PERSONA_URNS =
ImmutableSet.of(
"urn:li:dataHubPersona:technicalUser",
"urn:li:dataHubPersona:businessUser",
"urn:li:dataHubPersona:dataLeader",
"urn:li:dataHubPersona:dataSteward");
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.linkedin.datahub.graphql.generated.CorpGroup;
import com.linkedin.datahub.graphql.generated.CorpGroupInfo;
import com.linkedin.datahub.graphql.generated.CorpUser;
import com.linkedin.datahub.graphql.generated.CorpUserEditableProperties;
import com.linkedin.datahub.graphql.generated.CorpUserInfo;
import com.linkedin.datahub.graphql.generated.CorpUserViewsSettings;
import com.linkedin.datahub.graphql.generated.Dashboard;
Expand All @@ -53,6 +54,7 @@
import com.linkedin.datahub.graphql.generated.DataHubView;
import com.linkedin.datahub.graphql.generated.DataJob;
import com.linkedin.datahub.graphql.generated.DataJobInputOutput;
import com.linkedin.datahub.graphql.generated.DataPlatform;
import com.linkedin.datahub.graphql.generated.DataPlatformInstance;
import com.linkedin.datahub.graphql.generated.DataQualityContract;
import com.linkedin.datahub.graphql.generated.Dataset;
Expand Down Expand Up @@ -1823,6 +1825,18 @@ private void configureCorpUserResolvers(final RuntimeWiring.Builder builder) {
new LoadableTypeResolver<>(
corpUserType,
(env) -> ((CorpUserInfo) env.getSource()).getManager().getUrn())));
builder.type(
"CorpUserEditableProperties",
typeWiring ->
typeWiring.dataFetcher(
"platforms",
new LoadableTypeBatchResolver<>(
dataPlatformType,
(env) ->
((CorpUserEditableProperties) env.getSource())
.getPlatforms().stream()
.map(DataPlatform::getUrn)
.collect(Collectors.toList()))));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throw
context.getOperationContext(),
assertionUrn,
asserteeUrn,
input.getTimestampMillis(),
assertionResult,
mapContextParameters(input.getProperties()));
input.getTimestampMillis() != null
? input.getTimestampMillis()
: System.currentTimeMillis(),
assertionResult);
return true;
}
throw new AuthorizationException(
Expand All @@ -99,6 +100,9 @@ private AssertionResult mapAssertionResult(AssertionResultInput input) {
if (assertionResult.getType() == AssertionResultType.ERROR && input.getError() != null) {
assertionResult.setError(mapAssertionResultError(input));
}
if (input.getProperties() != null) {
assertionResult.setNativeResults(mapContextParameters(input.getProperties()));
}
return assertionResult;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.linkedin.datahub.graphql.types.corpuser;

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

import com.datahub.authorization.ConjunctivePrivilegeGroup;
import com.datahub.authorization.DisjunctivePrivilegeGroup;
import com.google.common.collect.ImmutableList;
import com.linkedin.common.UrnArray;
import com.linkedin.common.url.Url;
import com.linkedin.common.urn.Urn;
import com.linkedin.common.urn.UrnUtils;
Expand All @@ -14,6 +16,8 @@
import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.authorization.AuthorizationUtils;
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.exception.DataHubGraphQLErrorCode;
import com.linkedin.datahub.graphql.exception.DataHubGraphQLException;
import com.linkedin.datahub.graphql.featureflags.FeatureFlags;
import com.linkedin.datahub.graphql.generated.AutoCompleteResults;
import com.linkedin.datahub.graphql.generated.CorpUser;
Expand Down Expand Up @@ -246,7 +250,20 @@ private RecordTemplate mapCorpUserEditableInfo(
if (input.getEmail() != null) {
result.setEmail(input.getEmail());
}

if (input.getPlatformUrns() != null) {
result.setPlatforms(
new UrnArray(
input.getPlatformUrns().stream().map(UrnUtils::getUrn).collect(Collectors.toList())));
}
if (input.getPersonaUrn() != null) {
if (DEFAULT_PERSONA_URNS.contains(input.getPersonaUrn())) {
result.setPersona(UrnUtils.getUrn(input.getPersonaUrn()));
} else {
throw new DataHubGraphQLException(
String.format("Provided persona urn %s does not exist", input.getPersonaUrn()),
DataHubGraphQLErrorCode.NOT_FOUND);
}
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.generated.CorpUserEditableProperties;
import com.linkedin.datahub.graphql.generated.DataHubPersona;
import com.linkedin.datahub.graphql.generated.DataPlatform;
import com.linkedin.datahub.graphql.types.mappers.ModelMapper;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -38,6 +41,22 @@ public CorpUserEditableProperties apply(
if (info.hasPictureLink()) {
result.setPictureLink(info.getPictureLink().toString());
}
if (info.hasPlatforms()) {
result.setPlatforms(
info.getPlatforms().stream()
.map(
urn -> {
DataPlatform platform = new DataPlatform();
platform.setUrn(urn.toString());
return platform;
})
.collect(Collectors.toList()));
}
if (info.hasPersona()) {
DataHubPersona persona = new DataHubPersona();
persona.setUrn(info.getPersona().toString());
result.setPersona(persona);
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ public CompletableFuture<ERModelRelationship> get(DataFetchingEnvironment enviro
highDataset = source;
}
// The following sequence mimics datahub.emitter.mce_builder.datahub_guid
// Keys have to be in alphabetical order - Destination, ERModelRelationName and Source

String ermodelrelationKey =
"{\"Source\":\""
"{\"Destination\":\""
+ lowDataset
+ "\",\"Destination\":\""
+ highDataset
+ "\",\"ERModelRelationName\":\""
+ ermodelrelationName
+ "\",\"Source\":\""
+ highDataset
+ "\"}";

byte[] mybytes = ermodelrelationKey.getBytes(StandardCharsets.UTF_8);
Expand Down
4 changes: 3 additions & 1 deletion datahub-graphql-core/src/main/resources/assertions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ input AssertionResultInput {
type: AssertionResultType!

"""
Additional key-value pairs representing runtime context
Additional metadata representing about the native results of the assertion.
These will be displayed alongside the result.
It should be used to capture additional context that is useful for the user.
"""
properties: [StringMapEntryInput!]

Expand Down
31 changes: 31 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4139,6 +4139,16 @@ type CorpUserEditableProperties {
Email address for the user
"""
email: String

"""
User persona, if present
"""
persona: DataHubPersona

"""
Platforms commonly used by the user, if present.
"""
platforms: [DataPlatform!]
}

"""
Expand Down Expand Up @@ -4189,6 +4199,16 @@ input CorpUserUpdateInput {
Email address for the user
"""
email: String

"""
The platforms that the user frequently works with
"""
platformUrns: [String!]

"""
The user's persona urn"
"""
personaUrn: String
}

"""
Expand Down Expand Up @@ -12142,6 +12162,7 @@ input CreateDataProductPropertiesInput {
description: String
}


"""
Input properties required for update a DataProduct
"""
Expand Down Expand Up @@ -12307,6 +12328,16 @@ input UpdateOwnershipTypeInput {
description: String
}

"""
A standardized type of a user
"""
type DataHubPersona {
"""
The urn of the persona type
"""
urn: String!
}

"""
Describes a generic filter on a dataset
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public class ReportAssertionResultResolverTest {
.setType(com.linkedin.assertion.AssertionResultErrorType.UNKNOWN_ERROR)
.setProperties(
new StringMap(Map.of("message", "an unknown error occurred"))))
.setExternalUrl(customAssertionUrl))
.setRuntimeContext(new StringMap(Map.of("prop1", "value1")));
.setExternalUrl(customAssertionUrl)
.setNativeResults(new StringMap(Map.of("prop1", "value1"))));

@Test
public void testGetSuccessReportAssertionRunEvent() throws Exception {
Expand Down Expand Up @@ -91,8 +91,7 @@ public void testGetSuccessReportAssertionRunEvent() throws Exception {
Mockito.eq(TEST_ASSERTION_URN),
Mockito.eq(TEST_DATASET_URN),
Mockito.eq(TEST_ASSERTION_RUN_EVENT.getTimestampMillis()),
Mockito.eq(TEST_ASSERTION_RUN_EVENT.getResult()),
Mockito.eq(TEST_ASSERTION_RUN_EVENT.getRuntimeContext()));
Mockito.eq(TEST_ASSERTION_RUN_EVENT.getResult()));
}

@Test
Expand Down Expand Up @@ -126,7 +125,6 @@ public void testGetUpdateAssertionUnauthorized() throws Exception {
Mockito.any(),
Mockito.any(),
Mockito.any(),
Mockito.any(),
Mockito.any());
}

Expand All @@ -146,7 +144,6 @@ public void testGetAssertionServiceException() {
Mockito.any(),
Mockito.any(),
Mockito.any(),
Mockito.any(),
Mockito.any());

ReportAssertionResultResolver resolver = new ReportAssertionResultResolver(mockService);
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"react-router-dom": "^5.3",
"react-syntax-highlighter": "^15.4.4",
"react-visibility-sensor": "^5.1.1",
"reactour": "1.18.7",
"reactour": "^1.19.3",
"remirror": "^2.0.23",
"styled-components": "^5.2.1",
"turndown-plugin-gfm": "^1.0.2",
Expand Down
9 changes: 9 additions & 0 deletions datahub-web-react/src/app/entity/chart/ChartEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { LOOKER_URN } from '../../ingest/source/builder/constants';
import { MatchedFieldList } from '../../search/matches/MatchedFieldList';
import { matchedInputFieldRenderer } from '../../search/matches/matchedInputFieldRenderer';
import { IncidentTab } from '../shared/tabs/Incident/IncidentTab';
import { ChartQueryTab } from './ChartQueryTab';

/**
* Definition of the DataHub Chart entity.
Expand Down Expand Up @@ -110,6 +111,14 @@ export class ChartEntity implements Entity<Chart> {
component: ChartStatsSummarySubHeader,
}}
tabs={[
{
name: 'Query',
component: ChartQueryTab,
display: {
visible: (_, chart: GetChartQuery) => (chart?.chart?.query?.rawQuery && true) || false,
enabled: (_, chart: GetChartQuery) => (chart?.chart?.query?.rawQuery && true) || false,
},
},
{
name: 'Documentation',
component: DocumentationTab,
Expand Down
Loading

0 comments on commit 2bbba5b

Please sign in to comment.