Ready-to-use code snippets for building interactive data applications using Databricks Apps.
- 10+ recipes for common use cases such as reading and writing to and from tables and volumes, invoking traditional ML models and GenAI, or triggering workflows.
- Try recipes in the Cookbook app and simply copy a code snippet to build your own.
- Description of requirements (permissions, resources, dependencies) for each recipe.
- Deploy to Databricks Apps or run locally.
- Snippets use Streamlit components but can easily be adapted to other Python frameworks.
Warning
This code sample is experimental and not intended for production use. It is a personal project provided by the contributors and not by Databricks.
- Fork this Git repository to your own GitHub account.
- Load the cloned repository as a Databricks Git folder in your Databricks workspace.
- In your Databricks workspace, switch to Compute -> Apps.
- Choose Create app.
- Under Choose how to start, select Custom and choose Next.
- Provide a name for your app and choose Create app.
- Once your app compute has started, choose Deploy.
- Select your new Git folder and choose Deploy.
Important
Check the Requirements tab of each recipe to understand what service principal permissions, Databricks resources, and Python packages are required to use it.
- Clone this repo to your local machine and switch into the
databricks-apps-cookbook
folder:git clone https://github.com/pbv0/databricks-apps-cookbook.git cd databricks-apps-cookbook
- Create and activate a Python virtual environment using
venv
:python3 -m venv .venv source .venv/bin/activate
- Install required packages:
pip install -r requirements.txt
- Install the Databricks CLI and authenticate with your Databricks workspace using OAuth U2M, for example:
databricks auth login --host https://my-workspace.cloud.databricks.com/
- Set required environment variables:
export DATABRICKS_HOST=https://my-workspace.cloud.databricks.com/
- Run the Cookbook app locally:
streamlit run app.py
Important
Make sure you have a working network connection to your Databricks workspace. Some samples may only work when running on Databricks Apps and not locally, e.g., retrieving information from HTTP headers to identify users.
We welcome contributions! Submit a pull request to add or improve recipes. Check out the roadmap below for inspiration. Raise an issue to report a bug or raise a feature request.