-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add column lineage graph endpoint (#2124)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
- Loading branch information
1 parent
b9abb19
commit 496566e
Showing
31 changed files
with
1,405 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.api; | ||
|
||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON; | ||
|
||
import com.codahale.metrics.annotation.ExceptionMetered; | ||
import com.codahale.metrics.annotation.ResponseMetered; | ||
import com.codahale.metrics.annotation.Timed; | ||
import java.time.Instant; | ||
import java.util.concurrent.ExecutionException; | ||
import javax.validation.constraints.NotNull; | ||
import javax.ws.rs.DefaultValue; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.Response; | ||
import lombok.NonNull; | ||
import lombok.extern.slf4j.Slf4j; | ||
import marquez.service.ServiceFactory; | ||
import marquez.service.models.NodeId; | ||
|
||
@Slf4j | ||
@Path("/api/v1/column-lineage") | ||
public class ColumnLineageResource extends BaseResource { | ||
|
||
private static final String DEFAULT_DEPTH = "20"; | ||
|
||
public ColumnLineageResource(@NonNull final ServiceFactory serviceFactory) { | ||
super(serviceFactory); | ||
} | ||
|
||
@Timed | ||
@ResponseMetered | ||
@ExceptionMetered | ||
@GET | ||
@Produces(APPLICATION_JSON) | ||
public Response getLineage( | ||
@QueryParam("nodeId") @NotNull NodeId nodeId, | ||
@QueryParam("depth") @DefaultValue(DEFAULT_DEPTH) int depth) | ||
throws ExecutionException, InterruptedException { | ||
return Response.ok(columnLineageService.lineage(nodeId, depth, Instant.now())).build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
api/src/main/java/marquez/common/models/DatasetFieldId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.common.models; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
/** ID for {@code DatasetField}. */ | ||
@EqualsAndHashCode | ||
@AllArgsConstructor | ||
@ToString | ||
public class DatasetFieldId { | ||
|
||
@Getter private final DatasetId datasetId; | ||
@Getter private final FieldName fieldName; | ||
|
||
public static DatasetFieldId of(String namespace, String datasetName, String field) { | ||
return new DatasetFieldId( | ||
new DatasetId(NamespaceName.of(namespace), DatasetName.of(datasetName)), | ||
FieldName.of(field)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.