
Answer-first summary for fast verification
Answer: Insert `%python` at the start of a cell to explicitly set the language for that cell.
By default, cells in a Databricks notebook use the notebook's default language. However, you can override this for individual cells by using language magic commands at the beginning of the cell. The supported magic commands include `%python`, `%sql`, `%scala`, and `%r`. This allows for flexible language usage within the same notebook without changing the default language setting. Reference: [Databricks Documentation](https://docs.databricks.com/notebooks/notebooks-code.html).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
In a Databricks notebook set to SQL as the default language, how can a data engineer execute Python code within the same notebook?
A
Import the Python module in a cell before writing the code.
B
Change the notebook's default language to Python to enable Python code execution.
C
Rely on Databricks' automatic language detection for cells by writing Python syntax directly.
D
Use the %language magic command at the beginning of a cell to specify the language.
E
Insert %python at the start of a cell to explicitly set the language for that cell.