Databricks Data Engineer Associate Question 445
Single answerYou are tasked with scheduling a Databricks notebook to run at midnight every day as part of an ETL pipeline. Which of the following CRON expressions would you use to achieve this?
- A
0 0 * * *
- B
0 12 * * *
- C
0 0 0 * *
- D
0 * * * *
Show answer and explanation
Correct answer: A
Explanation
CRON expressions are used to define schedules for automated tasks. The correct CRON expression for scheduling a task at midnight every day is '0 0 * * *'. Each field in the CRON expression corresponds to a time unit (minute, hour, day of month, month, day of week). The first two fields '0 0' indicate 0 minutes past 0 hours, which is midnight.
- A. Correct.
This CRON expression is correct. It specifies that the task should run at 0 minutes past 0 hours (midnight) every day.
- B. Incorrect.
This CRON expression is incorrect because it schedules the task at 12 PM (noon) every day, not midnight.
- C. Incorrect.
This CRON expression is incorrect because it is improperly formatted. CRON expressions use 5 fields, not 6.
- D. Incorrect.
This CRON expression is incorrect because it schedules the task to run every minute, not specifically at midnight.