Hi @Marta Vicente Sรกnchezโ, You can use scheduled query executions to update your dashboards or enable routine alerts. By default, your queries do not have a schedule.
Note:-
If an alert uses your query, it runs on its refresh schedule and does not use the query schedule.
- To set the schedule: Click the query info tab.
- Click the link to the right of Refresh Schedule to open a picker with scheduled intervals.
The picker scrolls and allows you to choose:
- An interval: 1-30 minutes, 1-12 hours, 1 or 30 days, 1 or 2 weeks
- A time. The time selector displays in the picker only when the interval is greater than one day and the day selection is greater than one week. When you schedule a specific time, Databricks SQL takes input in your computerโs timezone and converts it to UTC. You must adjust the picker by your local offset if you want a query to run at a particular time in UTC. For example, if you want a question to execute at 00:00 UTC each day, but your current timezone is PDT (UTC-7), you should select 17:00 in the selector:
- Your query will run automatically.
- If you experience a scheduled query not executing according to its schedule, you should manually trigger the query to ensure it doesnโt fail. However, you should be aware of the following:
- If you schedule an intervalโfor example, โevery 15 minutesโโthe interval is calculated from the last successful execution. If you manually execute a query, the scheduled query will not be executed until the interval has passed.
- If you schedule a time, Databricks SQL waits for the results to be โoutdated.โ For example, suppose you have a query set to refresh every Thursday and manually execute it on Wednesday. In that case, the results will still be considered โvalidโ by Thursday so that the query wouldnโt be scheduled for a new execution. Thus, for example, when setting a weekly schedule, check the last query execution time and expect the scheduled query to be executed on the selected day after that execution is a week old. Make sure not to execute the query during this time manually.
- If a query execution fails, Databricks SQL retries with a back-off algorithm. The more failures, the further away the next retry will be (which might be beyond the refresh interval).
Query failure reports
If one or more queries fails, Databricks SQL notifies query owners by email once per hour. These emails continue until there are no more failures. Failure report emails run on an independent process from the actual query schedules. It may take up to an hour after a failed query execution before Databricks SQL sends the failure report.
If query owners do not receive emailed failure reports when scheduled queries fail, your administrator has disabled them for your Databricks SQL instance.