Alert output
4 0
Read Time:1 Minute, 33 Second

Snowflake Dynamic Table and Alerts: This use case addresses automating customer accessory purchase monitoring in Snowflake to provide the marketing team with timely insights for personalized promotions. Imagine you’re a Data Engineer/Data Governance developer for an online retail store. You ensure the marketing team receives insights on customer accessory purchases to offer targeted promotions. You have separate tables for accessory purchases and customer data (demographics and purchase history).

Create a dynamic table in Snowflake that monitors customer accessory purchases. If a customer purchases more than a specific number of accessories within the last month, the table should generate a promotional offer for that customer. Absolutely, the continuation of the use case covers notification integration and alert creation. In this use case, notifications and alerts play a crucial role in ensuring the marketing team receives timely updates on customer promotional offers:

Technical Implementation:

  • Create a dynamic table CUSTOMER_PROMOTIONAL_OFFERS that refreshes daily.
  • Create Notification Integration: A notification integration acts as a bridge between Snowflake and an external communication channel (email in this case).
  • Develop Stored Procedure for Sending Email, that constructs the HTML email content.
  • Create Alerts for Promotional Offers:
    • The alert_customer_promotional_offers alert is configured to run daily (SCHEDULE = ‘1 DAY’).
  • It checks the CUSTOMER_PROMOTIONAL_OFFERS table for new entries with a PROMOTION_DATE matching the current day.
    • If new entries exist (indicating new promotional offers), the alert triggers the SYSTEM$SEND_EMAIL

Dynamic Table:

Dynamic Table

Stored Procedure:

Stored Procedure

Notification Integration:

CREATE NOTIFICATION INTEGRATION IF NOT EXISTS
DT_PROMO_NOTIFY
TYPE = EMAIL
ENABLED = TRUE
ALLOWED_RECIPIENTS = ('sachin.mittal04@gmail.com');

Alert:

Alert

Final mail after ALERT Execution:

Alert output

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *