
Databricks Certified Data Engineer - Associate
Get started today
Ultimate access to all questions.
A job scheduled to run daily at 12:00 AM loads data into the orders
table, typically taking 30 minutes to complete. However, on a particular day, it failed after 5 minutes, leaving the table in an inconsistent state. A data engineer noticed the discrepancy between source and target counts the next morning at 8:00 AM and decided to restore the table to its state before the job ran and then re-run the job. Which SQL statement should the engineer use to restore the table?
A job scheduled to run daily at 12:00 AM loads data into the orders
table, typically taking 30 minutes to complete. However, on a particular day, it failed after 5 minutes, leaving the table in an inconsistent state. A data engineer noticed the discrepancy between source and target counts the next morning at 8:00 AM and decided to restore the table to its state before the job ran and then re-run the job. Which SQL statement should the engineer use to restore the table?
Explanation:
The correct syntax for restoring a Delta table to a previous state is RESTORE TABLE table_name TO TIMESTAMP AS OF timestamp_expression
. The timestamp_expression
can be a variety of formats, including current_timestamp() - INTERVAL ‘8‘ HOURS
, which accurately represents the time 8 hours before the current timestamp. This command allows the data engineer to revert the orders
table to its state before the failed job execution. For more details, refer to the RESTORE documentation in Databricks SQL.