Global Env. variables in databricks
A really nice feature that you can use in Databricks is to use the Global init scripts functionality to add environment variables to all the clusters that you create in your workspace.
To achieve this you only need to follow these steps:
- From the Admin Console, go to the Global Init Scripts tab.
- From here you can create custom scripts that will be executed when starting any cluster that you create in the workspace.
- In the script, add the variables following this structure:
echo "variable=value" >> /etc/environment
You can check that the value has been added in a few different ways:
- Using the Web Console to access the driver of the cluster:
- From a Notebook: