mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-29 17:59:24 +00:00
Modify upstream downstream relationships api to use new lineage model
This commit is contained in:
parent
97f08e0b81
commit
c94234a548
@ -19,6 +19,7 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import wherehows.models.view.DatasetView;
|
||||
import wherehows.models.view.LineageView;
|
||||
|
||||
|
||||
public class LineageDao {
|
||||
@ -41,6 +42,26 @@ public class LineageDao {
|
||||
throw new UnsupportedOperationException("Lineage not implemented yet.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get upstream datasets lineage for a certain dataset, similar to upstream datasets but with
|
||||
* lineage data attached
|
||||
* @param datasetUrn String
|
||||
* @return List of LineageView
|
||||
*/
|
||||
public List<LineageView> getUpstreamLineage(@Nonnull String datasetUrn) throws Exception {
|
||||
throw new UnsupportedOperationException("Lineage not implemented yet.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get downstream datasets lineage for a certain dataset, similar to downstream datasets but with
|
||||
* lineage data attached
|
||||
* @param datasetUrn String
|
||||
* @return List of LineageView
|
||||
*/
|
||||
public List<LineageView> getDownstreamLineage(@Nonnull String datasetUrn) throws Exception {
|
||||
throw new UnsupportedOperationException("Lineage not implemented yet.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create lineage dataset that requested the lineage via Kafka lineage event.
|
||||
* @param actorUrn String actor Urn
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright 2015 LinkedIn Corp. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
package wherehows.models.view;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LineageView {
|
||||
private DatasetView dataset;
|
||||
|
||||
private String type;
|
||||
|
||||
private String actor;
|
||||
}
|
||||
@ -47,6 +47,7 @@ import wherehows.models.view.DatasetRetention;
|
||||
import wherehows.models.view.DatasetSchema;
|
||||
import wherehows.models.view.DatasetView;
|
||||
import wherehows.models.view.DsComplianceSuggestion;
|
||||
import wherehows.models.view.LineageView;
|
||||
|
||||
import static controllers.api.v1.Dataset.*;
|
||||
import static utils.Dataset.*;
|
||||
@ -521,9 +522,9 @@ public class Dataset extends Controller {
|
||||
}
|
||||
|
||||
public static Promise<Result> getDatasetUpstreams(@Nonnull String datasetUrn) {
|
||||
final List<DatasetView> upstreams;
|
||||
final List<LineageView> upstreams;
|
||||
try {
|
||||
upstreams = LINEAGE_DAO.getUpstreamDatasets(datasetUrn);
|
||||
upstreams = LINEAGE_DAO.getUpstreamLineage(datasetUrn);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Fetch Dataset upstreams error", e);
|
||||
return Promise.promise(() -> internalServerError(errorResponse(e)));
|
||||
@ -532,9 +533,9 @@ public class Dataset extends Controller {
|
||||
}
|
||||
|
||||
public static Promise<Result> getDatasetDownstreams(@Nonnull String datasetUrn) {
|
||||
final List<DatasetView> downstreams;
|
||||
final List<LineageView> downstreams;
|
||||
try {
|
||||
downstreams = LINEAGE_DAO.getDownstreamDatasets(datasetUrn);
|
||||
downstreams = LINEAGE_DAO.getDownstreamLineage(datasetUrn);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Fetch Dataset upstreams error", e);
|
||||
return Promise.promise(() -> internalServerError(errorResponse(e)));
|
||||
|
||||
@ -15,4 +15,15 @@ type Relationships = Array<IDatasetView>;
|
||||
*/
|
||||
type RelationshipType = IDropDownOption<string>;
|
||||
|
||||
export { Relationships, RelationshipType };
|
||||
/**
|
||||
* Relationship upstream and downstream api will return Array<IDatasetLineage> displaying
|
||||
* the type of dataset, type of lineage, and actor urn that modified that relationship
|
||||
*/
|
||||
interface IDatasetLineage {
|
||||
dataset: IDatasetView;
|
||||
type: string;
|
||||
actor: string;
|
||||
modified: string;
|
||||
}
|
||||
|
||||
export { Relationships, RelationshipType, IDatasetLineage };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user