QuestionQ165

VerifiedDatabricks Intelligence Platform

A data engineer has a Python notebook in Databricks, but they need to use SQL to accomplish a specific task within a cell. They still want all of the other cells to use Python without making any changes to those cells.

Which of the following describes how the data engineer can use SQL within a cell of their Python notebook?

Explanation

In Databricks notebooks, the %sql magic command at the first line of a cell switches the interpreter for that cell to SQL. This allows seamless use of SQL within a Python notebook without changing the notebook's default language or affecting other cells.

Community Discussion

No comments yet. Be the first to start the discussion!