-
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
5 changed files
with
68 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from typing import List | ||
|
||
from metaphor.models.metadata_change_event import ( | ||
AssetPlatform, | ||
Hierarchy, | ||
HierarchyInfo, | ||
HierarchyLogicalID, | ||
HierarchyType, | ||
) | ||
|
||
|
||
def create_hierarchy( | ||
platform: AssetPlatform, | ||
path: List[str], | ||
name: str = "", | ||
hierarchy_type: HierarchyType = HierarchyType.VIRTUAL_HIERARCHY, | ||
) -> Hierarchy: | ||
""" | ||
Create a hierarchy with name | ||
""" | ||
return Hierarchy( | ||
logical_id=HierarchyLogicalID( | ||
path=[platform.value] + path, | ||
), | ||
hierarchy_info=( | ||
HierarchyInfo( | ||
name=name, | ||
type=hierarchy_type, | ||
) | ||
if name | ||
else None | ||
), | ||
) |
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 |
---|---|---|
@@ -1,26 +1,16 @@ | ||
from typing import List | ||
|
||
from metaphor.models.metadata_change_event import ( | ||
DashboardPlatform, | ||
Hierarchy, | ||
HierarchyInfo, | ||
HierarchyLogicalID, | ||
HierarchyType, | ||
) | ||
from metaphor.common.hierarchy import create_hierarchy | ||
from metaphor.models.metadata_change_event import AssetPlatform, Hierarchy | ||
|
||
DASHBOARD_DIRECTORIES = ["DASHBOARD"] | ||
DATA_SET_DIRECTORIES = ["DATA_SET"] | ||
|
||
|
||
def _create_virtual_hierarchy(name: str, path: List[str]) -> Hierarchy: | ||
return Hierarchy( | ||
logical_id=HierarchyLogicalID(path=[DashboardPlatform.QUICK_SIGHT.name] + path), | ||
hierarchy_info=HierarchyInfo(name=name, type=HierarchyType.VIRTUAL_HIERARCHY), | ||
) | ||
|
||
|
||
def create_top_level_folders() -> List[Hierarchy]: | ||
platform = AssetPlatform.QUICK_SIGHT | ||
|
||
return [ | ||
_create_virtual_hierarchy("Dashboards", DASHBOARD_DIRECTORIES), | ||
_create_virtual_hierarchy("DataSets", DATA_SET_DIRECTORIES), | ||
create_hierarchy(platform, DASHBOARD_DIRECTORIES, "Dashboards"), | ||
create_hierarchy(platform, DATA_SET_DIRECTORIES, "DataSets"), | ||
] |
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