Close

2023-08-11

How To Prepare A SQL-based Report In SuperSet

How To Prepare A SQL-based Report In SuperSet

Apache Superset is a modern, open-source data exploration and visualization platform. To create a report in Superset using your SQL and then schedule it to be sent to a specific email every day, follow these steps:

Connect Your Database:You must connect your MySQL database to Superset if you haven’t already. Go to Sources > Databases and add your MySQL instance.
Create a SQL Lab Query:Navigate to SQL Lab in the Superset UI.
Choose your database and schema.
Enter your SQL query and run it to ensure it works correctly.
Visualize the Result:
After running your SQL in SQL Lab, you’ll see an option called “Explore” or “Visualize” (depending on the version). Click on it.
Choose the type of visualization you want (table, chart, etc.).
Customize the visualization as needed and save it to a dashboard.
Schedule the Report:Navigate to the Reports & Alerts section in Superset.
Click on the + button or “Add” to create a new report.
Fill in the details: Name: A name for your report.
Type: Choose “Report”.
Source Type: Choose “Dashboard” (if you saved your visualization to a dashboard) or “Chart” (if you want to send a specific chart).
Source: Choose the dashboard or chart you created.
Time Schedule: Set it to “Daily” and choose the time you want the report to be generated.
Recipients: Enter the email address where you want to send the report.
Save the report.
Configure Email Settings:Ensure that Superset is configured to send emails. This typically involves setting up the email server configurations in the superset_config.py file. You’ll need to provide details like the SMTP server, port, username, and password.
Start the Report Scheduler:Navigate to the Reports & Alerts section in Superset.
Click on the + button or “Add” to create a new report.
Fill in the details: Name: A name for your report.
Type: Choose “Report”.
Source Type: Choose “Dashboard” (if you saved your visualization to a dashboard) or “Chart” (if you want to send a specific chart).
Source: Choose the dashboard or chart you created.
Time Schedule: Set it to “Daily” and choose the time you want the report generated.
Recipients: Enter the email address where you want to send the report.
Save the report.

Once everything is set up, Superset will generate the report daily and send it to the specified email address. Monitor the system initially to ensure that everything works as expected.