-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
86 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Acryl Impact Analysis | ||
|
||
Failed to run impact analysis: 'DATAHUB_GMS_HOST' | ||
|
||
See the logs for full details. |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
test: lint | ||
# TODO | ||
venv/bin/pytest tests | ||
|
||
setup: | ||
# Create venv. | ||
|
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,33 @@ | ||
from typing import Optional | ||
|
||
from datahub.utilities.urns.urn import Urn, guess_entity_type | ||
|
||
|
||
def datahub_url_from_urn( | ||
frontend_base_url: str, urn: str, suffix: Optional[str] = None | ||
) -> str: | ||
entity_type = guess_entity_type(urn) | ||
if entity_type == "dataJob": | ||
entity_type = "tasks" | ||
elif entity_type == "dataFlow": | ||
entity_type = "pipelines" | ||
|
||
url = f"{frontend_base_url}/{entity_type}/{Urn.url_encode(urn)}" | ||
if suffix: | ||
url += f"/{suffix}" | ||
return url | ||
|
||
|
||
def format_entity(frontend_base_url: str, downstream: dict) -> str: | ||
platform = downstream["platform"]["name"] | ||
if downstream["platform"].get("properties", {}).get("displayName"): | ||
platform = downstream["platform"]["properties"]["displayName"] | ||
|
||
name = downstream["properties"]["name"] | ||
url = datahub_url_from_urn(frontend_base_url, downstream["urn"]) | ||
|
||
type: str = downstream["type"].capitalize() | ||
if downstream.get("subTypes"): | ||
type = downstream["subTypes"]["typeNames"][0] | ||
|
||
return f"{platform} {type} [{name}]({url})" |
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,7 @@ | ||
import sys | ||
import pathlib | ||
|
||
here = pathlib.Path(__file__).parent | ||
src = here.parent / "src" | ||
|
||
sys.path.insert(0, str(src)) |
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,11 @@ | ||
from rendering import datahub_url_from_urn | ||
|
||
|
||
def test_url_generation(): | ||
assert ( | ||
datahub_url_from_urn( | ||
"https://customer.acryl.io", | ||
"urn:li:dataset:(urn:li:dataPlatform:snowflake,snowflake_sample_data.tpch_sf1000.orders,PROD)", | ||
) | ||
== "https://customer.acryl.io/dataset/urn%3Ali%3Adataset%3A%28urn%3Ali%3AdataPlatform%3Asnowflake%2Csnowflake_sample_data.tpch_sf1000.orders%2CPROD%29" | ||
) |