Skip to content

DemoWorksLab/databricks-apps

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📖 Databricks Apps Cookbook 🍳

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.

Cookbook

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.

Deploy to Databricks

  1. Fork this Git repository to your own GitHub account.
  2. Load the cloned repository as a Databricks Git folder in your Databricks workspace.
  3. In your Databricks workspace, switch to Compute -> Apps.
  4. Choose Create app.
  5. Under Choose how to start, select Custom and choose Next.
  6. Provide a name for your app and choose Create app.
  7. Once your app compute has started, choose Deploy.
  8. 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.

Run locally

  1. 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
  2. Create and activate a Python virtual environment using venv:
    python3 -m venv .venv
    source .venv/bin/activate
  3. Install required packages:
    pip install -r requirements.txt
  4. 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/
  5. Set required environment variables:
    export DATABRICKS_HOST=https://my-workspace.cloud.databricks.com/
  6. 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.

Contributions

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.

Roadmap / recipes wanted

About

Ready-to-use code snippets for building interactive data applications using Databricks Apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%