Trigger on scenarios

Hello,
I want to build a dataset using an append mode at the end of each month, triggered by a scenario. For this, I’ve created a custom SQL trigger that checks if the essential tables are updated by returning 0 or 1. However, this SQL code takes around 15 minutes to execute.
To optimize this process, I’d like the trigger to run only during the first 5 days of the month to check for updates (since it uses last-day-of-month logic). Once the check is completed within these 5 days, the trigger shouldn’t execute again until the next month.
How can I configure this to run efficiently and ensure the process is fully autonomous?
Thank you! in advance
Operating system used: Windows
Answers
-
Grixis PartnerApplicant, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 94 ✭✭✭✭✭✭
Hey @Shahbaz ,
I think the most cost effective way for your needs its basically use a custom trigger with python and with its lib like datetime you can simply retrieve the day of the month and iterate over it.
if you are a no coder, you can easily generate these python code snippets with llms. :)
import datetime
today = datetime.datetime.today()
trigger = today.day <= 5
trigger_fire = {
"fire": trigger,
"repeat_job": False
}Best,