Tag Databricks notebooks as source

To distinguish Databricks notebooks from regular Python, Scala, and SQL files, Databricks adds the comment “Databricks notebook source” to the top of Python, Scala, and SQL notebooks.

# Databricks notebook source
// Databricks notebook source
-- Databricks notebook source

This comment ensures that Databricks correctly parses the file as a notebook rather than a script file.

Manually tag notebooks

In some scenarios, you must manually add the language-appropriate comment to the top of notebook files to ensure that Databricks parses your notebook correctly. Common scenarios include:

  • If you work with a Python or Scala notebook directly from a source Git repository.

  • If you need to access notebooks from an integrated development environment.

  • If you run a notebook as part of a job and receive the error message Run result unavailable: job failed with error message Notebook not found: path-to-your-notebook.