CERTIFIED-DATA-ENGINEER-PROFESSIONAL · Question #119
What is the first of a Databricks Python notebook when viewed in a text editor?
The correct answer is B. # Databricks notebook source. Databricks notebooks are stored as plain text files, and when viewed in a text editor, the very first line is always # Databricks notebook source. This is a Python-style comment that Databricks uses as a magic header to identify the file as a Databricks notebook and determine how
Question
What is the first of a Databricks Python notebook when viewed in a text editor?
Options
- A%python
- B
Databricks notebook source
- C-- Databricks notebook source
- D// Databricks notebook source
- E
MAGIC %python
How the community answered
(53 responses)- A4% (2)
- B94% (50)
- C2% (1)
Explanation
Databricks notebooks are stored as plain text files, and when viewed in a text editor, the very first line is always # Databricks notebook source. This is a Python-style comment that Databricks uses as a magic header to identify the file as a Databricks notebook and determine how to parse cell boundaries (which are marked by # COMMAND ----------). The language-specific magic commands like %python appear at the top of individual cells, not as the file's first line. This header is present regardless of the notebook's default language.
Topics
Community Discussion
No community discussion yet for this question.