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

refactor(redash): emit charts and use id based dashboard API first #4991

Merged
merged 1 commit into from
May 25, 2022
Merged
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
13 changes: 9 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/source/redash.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,14 +566,19 @@ def _emit_dashboard_mces(self) -> Iterable[MetadataWorkUnit]:
continue

# Continue producing MCE
dashboard_slug = dashboard_response["slug"]
try:
dashboard_data = self.client.dashboard(dashboard_slug)
except Exception:
# This is undocumented but checking the Redash source
# the API is id based not slug based
# Tested the same with a Redash instance
dashboard_id = dashboard_response["id"]
dashboard_data = self.client._get(
"api/dashboards/{}".format(dashboard_id)
).json()
except Exception:
# This does not work in our testing but keeping for now because
# people in community are using Redash connector successfully
dashboard_slug = dashboard_response["slug"]
dashboard_data = self.client.dashboard(dashboard_slug)
logger.debug(dashboard_data)
dashboard_snapshot = self._get_dashboard_snapshot(dashboard_data)
mce = MetadataChangeEvent(proposedSnapshot=dashboard_snapshot)
Expand Down Expand Up @@ -708,8 +713,8 @@ def _emit_chart_mces(self) -> Iterable[MetadataWorkUnit]:

def get_workunits(self) -> Iterable[MetadataWorkUnit]:
self.test_connection()
yield from self._emit_dashboard_mces()
yield from self._emit_chart_mces()
yield from self._emit_dashboard_mces()

def get_report(self) -> SourceReport:
return self.report
Expand Down