
Answer-first summary for fast verification
Answer: The change will only affect the new notebook, leaving the `fetch_details` notebook and others unchanged.
Environment variables in Databricks clusters are defined at the cluster level and can be accessed by any notebook attached to the cluster. However, modifying an environment variable within a notebook only affects that specific notebook's environment. Changes do not propagate to other notebooks or the cluster's properties. Therefore, the `fetch_details` notebook will continue to use the `PROD` environment unless its environment variable is explicitly changed within that notebook.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A Databricks admin sets the environment variable ENV=PROD for a cluster used by the engineering team to fetch data from an S3 bucket in the fetch_details notebook. A new team member needs to access data from the DEV environment instead. They attempt to change the environment variable in a new notebook with the command: import os; os.environ['ENV'] = 'DEV'. What will be the effect of this command?
A
The environment variable’s value will be updated in the cluster properties, affecting all notebooks attached to the cluster.
B
The command will fail, preventing the environment variable from being changed.
C
The change will only affect the new notebook, leaving the fetch_details notebook and others unchanged.
D
The command will execute successfully but the environment variable’s value will remain unchanged.
E
Both the new notebook and the fetch_details notebook will start using the DEV environment.