22 Oct 2025 01:00 PM
Hi everyone,
We have a need to run a specific SQL query once a day, wait a few minutes, and then run the same query again. If the two results are identical, it indicates that something isn’t working as expected, and we need to trigger an alert to a team.
Example workflow:
Run the query at 8:00 AM
Wait 5 minutes
Run it again at 8:05 AM
If both results are the same, send an alert
Then do nothing until the next day
I was thinking of doing this with Python and storing the first result in a variable and then using time.sleep() wait, running the query again, and comparing the results.
Would that approach make sense, or is there a better / more Dynatrace-native way to handle this kind of scheduled comparison and alerting?
Thanks in advance for any suggestions!
30 Oct 2025 11:59 AM
I'm not the best to help you but I do have some ideas for that. If you already have this "SQL" data on Dynatrace you could create an Anomaly Detection with the Davis AI, in my opinion if your data is only important to check if they're different or not, a good way is using only the result of the comparison with binary sending only the 0, 1 (custom.db.query.compare_flag) and then you let Davis makes his work, of course tell him the threshold if needed.
Again, it's just an idea.
Maximiliano Lopes