mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-29 04:09:54 +00:00
Fix superset owner issue for db (#13451)
This commit is contained in:
parent
518fedd3fd
commit
2986d616b7
@ -349,16 +349,17 @@ class DashboardServiceSource(TopologyRunnerMixin, Source, ABC):
|
||||
|
||||
def process_owner(self, dashboard_details):
|
||||
try:
|
||||
owner = self.get_owner_details( # pylint: disable=assignment-from-none
|
||||
dashboard_details=dashboard_details
|
||||
)
|
||||
if owner and self.source_config.includeOwners:
|
||||
self.metadata.patch_owner(
|
||||
entity=Dashboard,
|
||||
source=self.context.dashboard,
|
||||
owner=owner,
|
||||
force=False,
|
||||
if self.source_config.includeOwners:
|
||||
owner = self.get_owner_details( # pylint: disable=assignment-from-none
|
||||
dashboard_details=dashboard_details
|
||||
)
|
||||
if owner:
|
||||
self.metadata.patch_owner(
|
||||
entity=Dashboard,
|
||||
source=self.context.dashboard,
|
||||
owner=owner,
|
||||
force=False,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.debug(traceback.format_exc())
|
||||
logger.warning(f"Error processing owner for {dashboard_details}: {exc}")
|
||||
|
@ -92,9 +92,7 @@ class SupersetSourceMixin(DashboardServiceSource):
|
||||
"""
|
||||
return dashboard
|
||||
|
||||
def _get_user_by_email(
|
||||
self, email: Union[FetchDashboard, DashboardResult]
|
||||
) -> EntityReference:
|
||||
def _get_user_by_email(self, email: Optional[str]) -> Optional[EntityReference]:
|
||||
if email:
|
||||
user = self.metadata.get_user_by_email(email)
|
||||
if user:
|
||||
@ -105,11 +103,12 @@ class SupersetSourceMixin(DashboardServiceSource):
|
||||
def get_owner_details(
|
||||
self, dashboard_details: Union[DashboardResult, FetchDashboard]
|
||||
) -> EntityReference:
|
||||
for owner in dashboard_details.owners:
|
||||
if owner.email:
|
||||
user = self._get_user_by_email(owner.email)
|
||||
if user:
|
||||
return user
|
||||
if hasattr(dashboard_details, "owner"):
|
||||
for owner in dashboard_details.owners or []:
|
||||
if owner.email:
|
||||
user = self._get_user_by_email(owner.email)
|
||||
if user:
|
||||
return user
|
||||
if dashboard_details.email:
|
||||
user = self._get_user_by_email(dashboard_details.email)
|
||||
if user:
|
||||
@ -204,7 +203,7 @@ class SupersetSourceMixin(DashboardServiceSource):
|
||||
return None
|
||||
|
||||
def get_column_info(
|
||||
self, data_source: Union[DataSourceResult, FetchColumn]
|
||||
self, data_source: List[Union[DataSourceResult, FetchColumn]]
|
||||
) -> Optional[List[Column]]:
|
||||
"""
|
||||
Args:
|
||||
|
Loading…
x
Reference in New Issue
Block a user