Databricks Data Engineer Associate Question 108
Select 4You are tasked with creating a table in Databricks using data from two sources: a relational database accessed via JDBC and a CSV file stored in an external location. Which of the following steps are necessary to successfully create the table?
- A
Load the data from the JDBC source into a DataFrame and write it to a Delta table.
- B
Read the CSV file into a DataFrame and write it to the same Delta table as the JDBC data.
- C
Use the
CREATE TABLESQL command to directly read data from the JDBC connection and CSV file into the table. - D
Ensure that the CSV file schema matches the JDBC data's schema before combining them.
- E
Configure the JDBC connection properties (e.g., URL, username, and password) when reading data from the database.
Show answer and explanation
Correct answers: A, B, D, E
Explanation
To create a table using data from both a JDBC source and a CSV file, the data from both sources must first be loaded into DataFrames. Before combining them into the same Delta table, their schemas must match. Additionally, JDBC connection properties are required to establish a connection to the database. Directly using the CREATE TABLE SQL command to combine these sources is not supported in Databricks.
- A. Correct.
Correct. Data from a JDBC source must first be loaded into a DataFrame before it can be written to a Delta table.
- B. Correct.
Correct. Data from the CSV file must also be read into a DataFrame before being written to the Delta table.
- C. Incorrect.
Incorrect. The
CREATE TABLESQL command in Databricks does not support directly combining data from a JDBC source and a CSV file without first loading the data into DataFrames. - D. Correct.
Correct. To successfully combine data from both sources, their schemas must align to avoid errors during the write operation.
- E. Correct.
Correct. JDBC connection properties such as URL, username, and password are required to establish a connection and read data from the relational database.