mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-25 01:18:14 +00:00
* Fix looker chart url * Handle array datatype * Handle array datatype
This commit is contained in:
parent
67ffa1cce3
commit
97e08ee25c
@ -96,11 +96,14 @@ def get_columns_from_model(
|
|||||||
columns = []
|
columns = []
|
||||||
all_fields = (model.fields.dimensions or []) + (model.fields.measures or [])
|
all_fields = (model.fields.dimensions or []) + (model.fields.measures or [])
|
||||||
for field in cast(Sequence[LookmlModelExploreField], all_fields):
|
for field in cast(Sequence[LookmlModelExploreField], all_fields):
|
||||||
|
type_ = LOOKER_TYPE_MAP.get(field.type, DataType.UNKNOWN)
|
||||||
columns.append(
|
columns.append(
|
||||||
Column(
|
Column(
|
||||||
name=field.name,
|
name=field.name,
|
||||||
displayName=getattr(field, "label_short", field.label),
|
displayName=getattr(field, "label_short", field.label),
|
||||||
dataType=LOOKER_TYPE_MAP.get(field.type, DataType.UNKNOWN),
|
dataType=type_,
|
||||||
|
# We cannot get the inner type from the sdk of .lkml
|
||||||
|
arrayDataType=DataType.UNKNOWN if type_ == DataType.ARRAY else None,
|
||||||
dataTypeDisplay=field.type,
|
dataTypeDisplay=field.type,
|
||||||
description=field.description,
|
description=field.description,
|
||||||
)
|
)
|
||||||
|
@ -724,7 +724,9 @@ class LookerSource(DashboardServiceSource):
|
|||||||
displayName=chart.title or chart.id,
|
displayName=chart.title or chart.id,
|
||||||
description=self.build_chart_description(chart) or None,
|
description=self.build_chart_description(chart) or None,
|
||||||
chartType=get_standard_chart_type(chart.type).value,
|
chartType=get_standard_chart_type(chart.type).value,
|
||||||
sourceUrl=f"{clean_uri(self.service_connection.hostPort)}/dashboard_elements/{chart.id}",
|
sourceUrl=chart.query.share_url
|
||||||
|
if chart.query is not None
|
||||||
|
else f"{clean_uri(self.service_connection.hostPort)}/merge?mid={chart.merge_result_id}",
|
||||||
service=self.context.dashboard_service.fullyQualifiedName.__root__,
|
service=self.context.dashboard_service.fullyQualifiedName.__root__,
|
||||||
)
|
)
|
||||||
self.status.scanned(chart.id)
|
self.status.scanned(chart.id)
|
||||||
|
@ -100,7 +100,9 @@ MOCK_DASHBOARD_ELEMENTS = [
|
|||||||
body_text="Some body text",
|
body_text="Some body text",
|
||||||
note_text="Some note",
|
note_text="Some note",
|
||||||
type="line",
|
type="line",
|
||||||
query=Query(model="model", view="view"),
|
query=Query(
|
||||||
|
model="model", view="view", share_url="https://my-looker.com/hello"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -365,7 +367,7 @@ class LookerUnitTest(TestCase):
|
|||||||
displayName="chart_title1",
|
displayName="chart_title1",
|
||||||
description="subtitle; Some body text; Some note",
|
description="subtitle; Some body text; Some note",
|
||||||
chartType=ChartType.Line,
|
chartType=ChartType.Line,
|
||||||
sourceUrl="https://my-looker.com/dashboard_elements/chart_id1",
|
sourceUrl="https://my-looker.com/hello",
|
||||||
service=self.looker.context.dashboard_service.fullyQualifiedName.__root__,
|
service=self.looker.context.dashboard_service.fullyQualifiedName.__root__,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user