This script creates a stored procedure that will send email alerts for cache refresh and timed subscription events in PowerBI Report Server.
- Python3
- venv (recommended)
- Install dependencies:
python3 -m venv env
.\env\Scripts\activate
pip install requirements.txt
Go to the ODBC data sources program in Windows to create a new data source.
Modify the config.json
file to set
- DSN name (e.g. mydatasource)
- Email account for sending
- Email recepients
Parameters for email recepients:
Parameter | Values | Description |
---|---|---|
event_type | RefreshCache , TimedSubscription |
|
recepient_list | Valid email address | |
last_status_type_like | succeeded , failed |
|
email_profile_name | String | |
email_template | relative filepath to HTML file | |
date_add | datetime |
python main.py
This will install the stored procedure for the first time and also make updates if the configuration has changed.
-
The script will replace all rows in the
EmailRecepients
table based on the JSON config. -
If a new email account is configured, it will be added to the current list of email accounts in the database.
-
Tables created during setup will not be overrided and will just be ignored.
- When email needs to be sent, run the stored procedure in the database
- Alternatively, create scheduled job to run the stored procedure through SSMS
- To do a full reset, run
EmailerDrop.sql
in your database.