mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 15:32:25 +00:00
Fix Superset Owners & Descriptions (#10007)
This commit is contained in:
parent
c7c3d62bae
commit
8c7c21bd54
@ -143,7 +143,7 @@ class SupersetAPISource(SupersetSourceMixin):
|
|||||||
chart = CreateChartRequest(
|
chart = CreateChartRequest(
|
||||||
name=chart_json["id"],
|
name=chart_json["id"],
|
||||||
displayName=chart_json.get("slice_name"),
|
displayName=chart_json.get("slice_name"),
|
||||||
description="",
|
description=chart_json.get("description"),
|
||||||
chartType=get_standard_chart_type(
|
chartType=get_standard_chart_type(
|
||||||
chart_json.get("viz_type", ChartType.Other.value)
|
chart_json.get("viz_type", ChartType.Other.value)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class SupersetDBSource(SupersetSourceMixin):
|
|||||||
chart = CreateChartRequest(
|
chart = CreateChartRequest(
|
||||||
name=chart_json["id"],
|
name=chart_json["id"],
|
||||||
displayName=chart_json.get("slice_name"),
|
displayName=chart_json.get("slice_name"),
|
||||||
description="",
|
description=chart_json.get("description"),
|
||||||
chartType=get_standard_chart_type(
|
chartType=get_standard_chart_type(
|
||||||
chart_json.get("viz_type", ChartType.Other.value)
|
chart_json.get("viz_type", ChartType.Other.value)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -69,11 +69,24 @@ class SupersetSourceMixin(DashboardServiceSource):
|
|||||||
"""
|
"""
|
||||||
return dashboard
|
return dashboard
|
||||||
|
|
||||||
def get_owner_details(self, dashboard_details: dict) -> EntityReference:
|
def _get_user_by_email(self, email: str) -> EntityReference:
|
||||||
if dashboard_details.get("email"):
|
|
||||||
user = self.metadata.get_user_by_email(dashboard_details["email"])
|
if email:
|
||||||
|
user = self.metadata.get_user_by_email(email)
|
||||||
if user:
|
if user:
|
||||||
return EntityReference(id=user.id.__root__, type="user")
|
return EntityReference(id=user.id.__root__, type="user")
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_owner_details(self, dashboard_details: dict) -> EntityReference:
|
||||||
|
for owner in dashboard_details.get("owners", []):
|
||||||
|
user = self._get_user_by_email(owner["email"])
|
||||||
|
if user:
|
||||||
|
return user
|
||||||
|
if dashboard_details.get("email"):
|
||||||
|
user = self._get_user_by_email(dashboard_details["email"])
|
||||||
|
if user:
|
||||||
|
return user
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_charts_of_dashboard(self, dashboard_details: dict) -> List[str]:
|
def _get_charts_of_dashboard(self, dashboard_details: dict) -> List[str]:
|
||||||
|
|||||||
@ -16,6 +16,7 @@ FETCH_ALL_CHARTS = """
|
|||||||
select
|
select
|
||||||
s.id,
|
s.id,
|
||||||
s.slice_name,
|
s.slice_name,
|
||||||
|
s.description,
|
||||||
t.table_name,
|
t.table_name,
|
||||||
t.schema,
|
t.schema,
|
||||||
db.database_name,
|
db.database_name,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user