cemremengu commented on code in PR #19810:
URL: https://github.com/apache/superset/pull/19810#discussion_r993649747
##########
tests/integration_tests/reports/commands_tests.py:
##########
@@ -339,7 +339,7 @@ def create_report_slack_chart_with_csv():
report_schedule = create_report_notification(
slack_channel="slack_channel",
chart=chart,
- report_format=ReportDataFormat.DATA,
+ report_format=ReportDataFormat.CSV,
Review Comment:
Done.
##########
superset/reports/commands/execute.py:
##########
@@ -333,11 +334,25 @@ def _get_notification_content(self) ->
NotificationContent:
error_text = "Unexpected missing screenshot"
elif (
self._report_schedule.chart
- and self._report_schedule.report_format ==
ReportDataFormat.DATA
+ and self._report_schedule.report_format == ReportDataFormat.CSV
+ ):
+ data = self._get_csv_data()
+ if not data:
+ error_text = "Unexpected missing csv file"
+ elif (
+ self._report_schedule.chart
+ and self._report_schedule.report_format ==
ReportDataFormat.XLSX
):
csv_data = self._get_csv_data()
if not csv_data:
- error_text = "Unexpected missing csv file"
+ error_text = "Unexpected missing csv data for xlsx"
+ else:
+ df = pd.read_csv(BytesIO(csv_data))
+ bio = BytesIO()
+ # pylint: disable=abstract-class-instantiated
+ with pd.ExcelWriter(bio, engine="openpyxl") as writer:
+ df.to_excel(writer, index=False)
+ data = bio.getvalue()
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]