Use environment variables for the Databricks extension for Visual Studio Code
This article describes how to use environment variables for the Databricks extension for Visual Studio Code. See What is the Databricks extension for Visual Studio Code?
This information assumes that you have already installed and set up the Databricks extension for Visual Studio Code. See Install the Databricks extension for Visual Studio Code.
Visual Studio Code supports environment variable definitions files for Python projects. This enables you to create a file with the extension .env
somewhere on your development machine, and Visual Studio Code will then apply the environment variables within this .env
file at run time. For more information, see Environment variable definitions file in the Visual Studio Code documentation.
To have the Databricks extension for Visual Studio Code use your .env
file, set databricks.python.envFile
within your settings.json file or Extensions > Databricks > Python: Env File within the Settings editor to the absolute path of your .env
file.
Important
If you set settings.json
, do not set python.envFile
to the absolute path of your .env
file as described in the Visual Studio Code documentation, as the Databricks extension for Visual Studio Code must override python.envFile
for its internal use. Be sure to only set databricks.python.envFile
instead.