Databricks Data Engineer Associate Question 358
Select 2You are working on a Databricks notebook and need to load data from a cloud storage location into a Delta table using the COPY INTO command. The data in the source files is in CSV format, and you want to ensure that the command only processes files that have not been previously loaded. Which of the following configurations should you include in the COPY INTO command to achieve this?
- A
Specify the FILES parameter to explicitly list files to be processed.
- B
Use the FORMAT option to specify the file format as 'CSV'.
- C
Set FILEFORMAT_OPTIONS to include 'mergeSchema' for handling schema evolution.
- D
Enable the AUTOLOADER option in the COPY INTO command.
- E
Use the COPY_OPTIONS parameter to include 'mergeSchema' for schema evolution.
- F
Ensure you include the 'overwrite' option to overwrite the Delta table with new data.
Show answer and explanation
Correct answers: A, B
Explanation
The COPY INTO command in Databricks is designed for loading data incrementally into Delta tables. To achieve this, specifying the correct file format using the FORMAT option is essential to parse the data correctly. Additionally, explicitly listing files using the FILES parameter ensures that only new or specific files are loaded, preventing duplication. Other options, such as 'mergeSchema' or 'overwrite', are unrelated to the COPY INTO command, while AUTOLOADER is a separate functionality.
- A. Correct.
Specifying the FILES parameter allows you to explicitly list the files to be processed, ensuring only specific files are loaded. This can help avoid re-processing previously ingested files.
- B. Correct.
The FORMAT option is required to specify the format of the source files. In this case, it should be set to 'CSV' to correctly parse the data.
- C. Incorrect.
The FILEFORMAT_OPTIONS parameter does not exist for the COPY INTO command. Instead, schema evolution is not directly handled within COPY INTO itself.
- D. Incorrect.
AUTOLOADER is a separate mechanism in Databricks for ingesting data incrementally, and it is not used in the COPY INTO command.
- E. Incorrect.
The COPY_OPTIONS parameter does not include 'mergeSchema' since schema evolution is not a feature of COPY INTO.
- F. Incorrect.
The 'overwrite' option is not used in COPY INTO. COPY INTO loads new data incrementally rather than overwriting the Delta table.