Databricks Certified Data Engineer Associate · Free Practice Question Medium

Question 28

A data science team is collaborating on a Databricks notebook. The data engineer prefers to use SQL for data extraction, while the data scientist wants to use Python for machine learning. How should they proceed within the same notebook?
  • A Create separate notebooks for SQL and Python code and link them together.
  • B Merge all code into Python for consistency across the notebook.
  • C Convert SQL queries to Python pandas queries for uniformity.
  • D

    Use %sql for data extraction cells and %python for machine learning cells.

Reveal correct answer

Correct answer: D

Explanation

Databricks notebooks support the use of multiple programming languages in the same notebook. By using %sql for data extraction and %python for machine learning, teams can collaborate efficiently without needing to convert code or split it into multiple notebooks. This flexibility enhances productivity and keeps the code organized according to the strengths of each language.

A. Creating separate notebooks for SQL and Python code and linking them together may lead to a fragmented workflow and make collaboration more challenging. It is more efficient to keep the code within the same notebook for easier access and collaboration.

B. Merging all code into Python for consistency across the notebook may limit the data engineer's ability to efficiently extract data using SQL. It is important to leverage the strengths of each language for their respective tasks to ensure optimal performance and maintainability.

C. Converting SQL queries to Python pandas queries for uniformity may require additional effort and may not be the most efficient approach. It is better to use the built-in %sql and %python magic commands provided by Databricks to seamlessly integrate SQL and Python code within the same notebook.

D.

Using %sql for data extraction cells and %python For machine learning cells, the data engineer can use SQL for data extraction, and the data scientist can use Python for machine learning within the same notebook. This approach maintains clarity and organization while accommodating the preferences of both team members.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need