Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill sourceInfo mainUrl for all entities #1034

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions metaphor/looker/lookml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
LookerView,
LookerViewDimension,
LookerViewMeasure,
SourceInfo,
SystemTag,
SystemTags,
SystemTagSource,
Expand Down Expand Up @@ -265,6 +266,7 @@ def _build_looker_view(
entity_upstream=(
EntityUpstream(source_entities=source_entities) if source_entities else None
),
source_info=SourceInfo(main_url=url),
)


Expand Down Expand Up @@ -352,6 +354,7 @@ def _build_looker_explore(
structure=_get_model_asset_structure(model, name, explore_view_folder_name),
entity_upstream=EntityUpstream(source_entities=source_entities),
system_tags=SystemTags(tags=tags),
source_info=SourceInfo(main_url=url),
)


Expand Down
1 change: 1 addition & 0 deletions metaphor/power_bi/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ async def map_wi_datasets_to_virtual_views(self, workspace: WorkspaceInfo) -> No
wds.sensitivityLabel.labelId if wds.sensitivityLabel else None
),
),
source_info=SourceInfo(main_url=ds.webUrl),
)

self._extract_pipeline_info(wds, virtual_view)
Expand Down
18 changes: 12 additions & 6 deletions metaphor/tableau/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ def _parse_workbook_query_response(
server, published_source.owner.luid
)

datasource_url = (
f"{self._base_url}/datasources/{published_source.vizportalUrlId}"
)

self._virtual_views[published_source.luid] = VirtualView(
logical_id=VirtualViewLogicalID(
type=VirtualViewType.TABLEAU_DATASOURCE, name=published_source.luid
Expand All @@ -458,7 +462,7 @@ def _parse_workbook_query_response(
source_dataset_account=(
custom_sql_source.account if custom_sql_source else None
),
url=f"{self._base_url}/datasources/{published_source.vizportalUrlId}",
url=datasource_url,
source_datasets=source_datasets or None,
),
entity_upstream=(
Expand All @@ -468,6 +472,7 @@ def _parse_workbook_query_response(
),
system_tags=system_tags,
system_contacts=system_contacts,
source_info=SourceInfo(main_url=datasource_url),
)
source_virtual_views.append(virtual_view_id)
published_datasources.append(published_source.name)
Expand All @@ -492,6 +497,10 @@ def _parse_workbook_query_response(
custom_sql_source.sources if custom_sql_source else None
) or self._parse_upstream_datasets(embedded_source.upstreamTables)

dashboard_url = (
dashboard.source_info.main_url if dashboard.source_info else None
)

self._virtual_views[embedded_source.id] = VirtualView(
logical_id=VirtualViewLogicalID(
type=VirtualViewType.TABLEAU_DATASOURCE, name=embedded_source.id
Expand All @@ -515,18 +524,15 @@ def _parse_workbook_query_response(
custom_sql_source.account if custom_sql_source else None
),
source_datasets=source_datasets or None,
url=(
dashboard.source_info.main_url
if dashboard.source_info
else None
),
url=dashboard_url,
),
entity_upstream=(
EntityUpstream(source_entities=source_datasets)
if source_datasets
else None
),
system_tags=system_tags,
source_info=SourceInfo(main_url=dashboard_url),
)
source_virtual_views.append(virtual_view_id)

Expand Down
5 changes: 4 additions & 1 deletion metaphor/thought_spot/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ def populate_virtual_views(
]
field_mappings.append(field_mapping)

url = f"{self._base_url}/#/data/tables/{table_id}"

view = VirtualView(
logical_id=VirtualViewLogicalID(
name=table_id, type=VirtualViewType.THOUGHT_SPOT_DATA_OBJECT
Expand All @@ -223,13 +225,14 @@ def populate_virtual_views(
name=table_detail.header.name,
description=table_detail.header.description,
type=table_type,
url=f"{self._base_url}/#/data/tables/{table_id}",
url=url,
is_verified=table.metadata_header.isVerified,
),
entity_upstream=EntityUpstream(
field_mappings=field_mappings if field_mappings else None
),
system_tags=self._get_system_tags(table_detail.header.tags),
source_info=SourceInfo(main_url=url),
)
self._virtual_views[table_id] = view

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metaphor-connectors"
version = "0.14.147"
version = "0.14.148"
license = "Apache-2.0"
description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app."
authors = ["Metaphor <[email protected]>"]
Expand Down
Loading
Loading