DEV Community

Danny C.
Danny C.

Posted on

Introducing Databricks Apps: Build and Deploy Secure Data & AI Apps

Introducing Databricks Apps: Build and Deploy Secure Data & AI Apps

  • Specialist Sessions
  • Apps
  • SSAs

Presenters

  • Matt Slack (Presenter)
  • Sr. Specialist Solutions Architect

What are they?

  • L300/400 one-to-many sessions with our users on a variety of important topics within the ecosystem.
  • Topics are chosen using data from recent specialist engagements to proactively provide guidance to our users.
  • The sessions represent a point-in-time snapshot of the topic, as we discuss roadmap and preview at the time of presentation. This program will update and re-run sessions over time.
  • These are expected to run once per month. Scheduling may change according to demand.

How this differs from other enablement content:

  • Showcases deeper technical best practices from projects running successfully at scale.
  • Provides an opportunity for your team to ask Specialist Architects technical questions about real projects of theirs.
  • Provides an opportunity for feedback at the end of the session to help drive future sessions and feature development.

Target Audience & Session Outcomes

Specialist Sessions: Apps

You Are:

  • Someone who actively uses the platform to build platforms
  • Someone with a working knowledge of the current feature set
  • Someone who has an interest in building Data and AI Apps on the platform, or moving them from other technologies, or:
  • Someone who wants to implement functionality using data that is not easily supported in dashboards or notebooks
  • New to Application Development
  • You are experienced with Application Development but new to the platform
  • You have experience with both above but not up to date with the latest developments

You Will Get:

  • A practitioner's understanding of implementing Data and AI Apps using the platform
  • An overview of the possible frameworks that can be used
  • Introduction to some approaches that can accelerate or simplify building Apps
  • Field developed, battle-hardened tips on what to look out for
  • An introduction to Application Development with the platform
  • Understanding how to best use Apps for your organisation
  • Practical knowledge and tips on how to develop with Apps
  • Future direction and longer-term vision for Apps

Agenda

Specialist Sessions: Data Warehouse Migrations

  • Introduction to Apps (10 mins)
  • Developing Apps (25 mins)
  • Architecture & Security (10 mins)
  • Product Roadmap (5 mins)
  • Summary / Q&A (5 mins)

Introduction to Apps

  • An application (aka app) is an interactive program that puts data and custom tools in the hands of (mainly) non-technical users.
  • More specifically, "Data & AI applications focus on exploiting big datasets for analytical purposes, as well as driving critical business decisions using AI.
  • Apps enable interactive, flexible, and customizable data & AI user interaction
  • Notebooks: great for technical audience, but not so great for non-technical users
  • Dashboards: great for visualization, but limited data interactions and lacks flexibility

Traditional Application Development Challenges

Complex

  • Apps are bottlenecked around specialized DevOps resources, which slows the pace of development and makes them hard to maintain over time.

Time-consuming

  • Apps take longer to deploy due to increased reviews and iterations, often delaying the app's time to market. Infrastructure is extremely complex to deploy fast.

Vulnerable

  • Governing apps separately from underlying data is cumbersome and error-prone, resulting in poorly governed and insecure apps.

Full Stack Developer

  • Step by step guide to becoming a modern full stack developer in 2025
  • Roadmap, Projects soon, 0% DONE 0 of 37 Done, What is Full Stack Development?
  • Frontend, Backend, DevOps
  • Target audience for this roadmap is absolute beginners wanting to get into full-stack development.
  • Key topics to learn, Project ideas and suggestions
  • CSS, JavaScript, Static Webpages, Interactivity, npm, Collaborative Work, External Packages, GitHub, Git
  • Start Backend Development, Backend Starts here, Node.js, Redis, JWT Auth, RESTful APIs, Complete App
  • Route53, SES, EC2, VPC, S3, Basic AWS Services, Deployment, CI/CD, Monitoring, Ansible, GitHub Actions, Terraform, Infrastructure

Platform Value Proposition & Capabilities

Quickly Build Secure Data & AI Applications using the Data Intelligence Platform

Simple to build

  • Simplified app development with the technologies developers already know makes it easy to build, instead of being bogged down in learning other technologies.

Production-Ready

  • Apps does not require engineers to build additional infrastructure. Apps runs on automatically provisioned serverless compute, allowing deployment with ease.

Built-in Governance

  • Data applications are inherently secure and well-governed, leading to greater data security and trust.

Any web framework

  • Anything that can be served on the web, can be launched on Apps

Easy to host

  • Click to deploy to managed serverless compute in a secured environment within a few minutes. In addition, new code deploys within a few seconds

Easy to share

  • Share with non-workspace users via SCIM sync

Easy to secure

  • Built-in OAuth, run as a dedicated SP* with access to Unity Catalog
  • * Credential passthrough is coming soon, see roadmap

Use Cases & Customer Stories

  • Built by data scientists and data teams - and software engineers!
  • Used by sales, marketing, finance, and other non-technical teams
  • Feedback Loop
  • Interactive data apps
  • ML model interface
  • RAG Chatbot
  • Business process automation
  • Data collection form
  • Data / AI review & approval
  • What-if analysis
  • GenAI agents
  • Complex visualizations
  • No-code application builder
  • UI for APIs
  • and much more...

Customer Stories: E.ON Digital Technology, Addi, SAE International

  • "We were among the first customers to explore Apps during the Private Preview. The seamless integration of Apps into our DevOps processes enables us to quickly demonstrate and test new features with users while also providing a secure, production-ready frontend for the internal application-all without needing additional infrastructure." — Lukas Heidegger, Data & MLOps Engineer, E.ON Digital Technology
  • "By using Apps, we saved many rounds with the security and infrastructure team and were able to instantly share our app with stakeholders in production." — Cesar Augusto Charalla Olazo, Sr Machine Learning Engineer, Addi
  • "Apps helped me turn my RAG proof of concept into a polished and branded application. We built a RAG system to answer user questions by utilizing our company's extensive knowledge base." — Heather Gomer, Senior Data Scientist, SAE International

Developing Apps: Iterative Path & Templates

Frameworks

  • Plan an iterative path from basic to advanced app development
  • Out Of The Box -> Apps
  • Dashboards: Lakeview Dashboards to quickly visualise and analyse your data
  • Genie: Use Genie's conversational UI to ask questions about your data
  • Templates/Framework: OOTB libraries that accelerate building simple/medium apps
  • Custom Full Stack: Custom full stack development for advanced/complex apps
  • More control and customization, but higher complexity to implement
  • Also available as GitHub repo
  • Compute > Apps > Create new app

Choose how to start:

  • Template: Quickly create an app using the template library
  • Custom: Use your existing source code and packages to create an app
  • Supported Template Frameworks: Dash, Flask, Gradio, Shiny, Streamlit

Available Templates:

  • Chatbot: Create a chat UI using a large language model and Model Serving. Dependencies: Serving endpoint
  • Data app: Create an app that reads from a SQL warehouse and visualizes the data. Dependencies: SQL warehouse
  • Hello world: Create a simple app.

Frameworks & Full-Stack Architecture

Pythonic or JS-driven UI?

Python

  • Frameworks: Dash, Streamlit, Reflex, Gradio
  • All have pythonic APIs
  • Tight integration with server-side logic
  • Support custom components
  • For full customization might still require writing JS/JSX code

JS

  • Frameworks: React, Vue, Angular, Svelte and many others
  • Ready-to-use layout syntax (JSX/Svelte)
  • Would require certain knowledge of JS/TS and JSX/Svelte
  • Provide full customization capabilities
  • Flexible styling with CSS
  • Better client-side performance

You can also build React/JS/TS powered apps with the platform!

Architecture flow:

  • Apps routes to FastAPI
  • FastAPI /api routes to API (Can be Rest, GraphQL, Arrow)
  • FastAPI / routes to Static files (Compiled JS/HTML/CSS code)

Any framework with SSG:

  • Vite + React + TS
  • esbuild + Vue + JS
  • Any combination of your choice

Apps with backend-only routes

FastAPI CRUD example (Item model with name: str, price: float):

  • @app.post("/api/items/{item_id}") (Create)
  • @app.get("/api/items/{item_id}") (Read)
  • @app.put("/api/items/{item_id}") (Update)
  • @app.delete("/api/items/{item_id}") (Delete)
  • Build a business layer logic on top of the platform
  • Simple OAuth integration
  • Works natively without extra configuration effort

Developer Experience & Runtime Environment

Your App will run under the following:

  • Resources: 2 vCPU & 6GB RAM
  • It runs under serverless as a container in a managed multi-az compute; there is no Spark session
  • Complex/memory intensive workloads best serviced by Clusters/Warehouses
  • OS: Ubuntu 22.04 LTS (Non-DBR)
  • App source code copied from Workspace/Git Repo to local container
  • Secured down with no root access
  • Workspace and UC Volume objects only accessible through SDK; they are NOT available under Unix file path
  • Python: 3.11.10 with isolated virtual env
  • Pre-installed libraries but can be overridden via requirements.txt
  • Not possible at present to change Python version but customization considered under product roadmap
  • Configuration: YAML-based config to parameterise behaviours
  • Environment variables: Default provided and customization fully supported, including port binding
  • Secrets referenced via environment variables; redacted by Workspace UI
  • UI Access: URL constructed based on App Name, Workspace ID, and Cloud Provider

Resource Access & Secrets Management

Simplified access grants

  • Automatically grant access to the specified resources
  • If user deploying the app has permission to grant access
  • Can also manually assign permissions to the service principal
  • Resources make it easier to move apps to new environments

Supported Resource Types:

  • SQL Warehouse
  • Model Serving Endpoint
  • Job
  • Secret
  • UC Volume

Edit app UI configuration:

  • App name (Name can't be changed once app is created, e.g., nick1)
  • Description
  • Advanced settings > App resources: Resource type (SQL warehouse), Resource mapping, Permission (Can use), Resource key (sql-warehouse)

Use platform secret management to access external services

  • Automatically grant access to the secret
  • If user deploying the app has permission to grant access
  • Can also manually assign permissions to the service principal

Create new app UI configuration:

  • App name (Name can't be changed once app is created)
  • Description
  • Advanced settings > App resources: Resource type (Secret), Scope (nick-scope), Secret key (password), Permission (Can read), Resource key (secret)

App Structure, Deployment & CI/CD

Basic App Structure: Flask

  • Overview, Deployments, Logs, Environment tabs showing Running status and Accessible URL
  • Source code in Git/Workspace (app.py, app.yaml, requirements.txt)
  • App dependencies (requirements.txt, i.e., custom Python libraries such as beautifulsoup4==4.12.3)
  • App configuration (app.yaml, i.e., entrypoint command ["flask", "--app", "app.py", "run"], environment variables like CUSTOM_ENV_VAR: "some_custom_value", secrets)
  • App Code (Entrypoint in app.py using Flask, BeautifulSoup, logging, and os.environ.get)
  • Workspace & UC Volume require databricks-sdk

Development & Deployment Workflow

  • Develop in local IDE*
  • Upload code to workspace (app.py, databricks.yaml, requirements.txt (optional))
  • Create app via UI
  • Deploy app via UI
  • Choose a LLM (optional) — e.g., DBRX Instruct
  • Example UI shown: Chatbot App (A basic chatbot using various Foundation Model APIs)
  • * workspace editor also OK but less preferred
  • APIs available for automation & CI/CD purposes

Flow between local machine, Git, dev workspace, and prod workspace:

  • Source code on Your computer syncs with Git
  • Source code deploys from Your computer to dev workspace via $ databricks bundle
  • Source code deploys from Git to prod workspace via $ databricks bundle
  • In both dev workspace and prod workspace, Source code is deployed to an App, creating a Snapshot of code

Continuous Integration (CI):

  • SOURCE: Developers commit changes
  • BUILD: Build code and run tests

Continuous Delivery and/or Continuous Deployment (CD):

  • STAGING: Deploy code to staging and verify behavior and stability
  • PRODUCTION: Deploy code to production

Support under DABs

  • Declarative framework for creating and maintaining platform assets, now extended to support Apps
  • Compatible with Git folders and enables CI/CD across different environments

Example YAML configuration (bundle: name: "databricks-app-bundle"):

  • Defines resources.apps.hello-app with name, description, and source_code_path
  • Configures app resources (sql-warehouse-resource with sql_warehouse.id and permission: "CAN_USE")
  • Sets permissions (group_name: "analysts" with CAN_USE, group_name: "admins" with CAN_MANAGE)
  • Defines targets for dev (default: true) and prod workspace hosts
  • CLI deployment command: $ databricks bundle deploy -t "prod"

Diagnostics, Auditing & Troubleshooting

Diagnostic Information

  • Real-time logs of app from stdout and stderr; showing pip, deployment, and app details, ordered by most recent.
  • Recommended to configure logging library as needed (using Python logging.basicConfig with level INFO, format, and logging.getLogger)
  • Available in standalone page via <app-url>/logz or under Compute > Apps > Logs tab
  • Erased when compute is stopped
  • Secrets are redacted

Auditing: FROM system.access.audit

  • Logins to an app
  • Permission or sharing changes
  • Complements AI Security Framework (DASF)
  • Example SQL query selecting event_date, workspace_id, request_params.request_object_id as app, user_identity.email as user_email, and user_identity.subject_name as username from system.access.audit where action_name IN ("workspaceInHouseOAuthClientAuthentication", "mintOAuthToken", "mintOAuthAuthorizationCode") filtered by request_params["client_id"]

Common Issues & Recommendations

Code failures

  • Apps cannot (yet) fix logical issues in your code
  • Use Copilot or any other coding assistant
  • Apps can be tested locally before deploying
  • Use standard local IDE tooling for debugging
  • Add verbose logs to catch upon specific behavior

Env misconfiguration

  • Check env variables availability at startup
  • [JS/TS apps] Make sure CORS is configured properly
  • No need for PATs. Use WorkspaceClient and it will work like a charm.

Startup cmd issues

  • Run this in a local docker container
  • Make sure all relevant files are uploaded
  • Make sure command runs in the correct folder
  • Check relative paths

Product Showcase & Best Practices

Product Showcase

  • Advanced Apps In Depth Article
  • Full-Stack Application Development With Apps
  • Building data applications with Apps — Ivan Trusov (November 6, 2024)
  • Enabling teams to build efficient Data Intelligence Platforms. All views and opinions are my own.
  • Includes QR code to scan for the article

Demo

  • FastAPI Backend
  • React Frontend
  • Map visualization showing European regions (including North Rhine-Westphalia, Hesse, Baden-Württemberg, Bavaria, Lower Saxony, Schleswig-Holstein, Grand Est, Luxembourg, Brussels, Amsterdam, Frankfurt, Munich, Zurich, Hamburg)

Best Practices and Scalability

Development

  • Run the app locally with the correct Python version
  • Connect to the platform using OAuth (no PAT tokens)
  • Use testing frameworks like pytest & playwright to validate behavior

Deployment

  • Use Asset Bundles (DABs) to deploy apps & workflows
  • CI pipeline for unit tests
  • CD pipeline to deploy the app
  • Separate environments (e.g., dev & prod)
  • NEW Use OBO tokens to act on behalf of a user's identity
  • Use async operations in DBSQL connector
  • For heavy UI customization, use JS/TS frontend + Python backend
  • Prefer "status pull" over long-running tasks / connections
  • Pin package versions (using uv or any preferred manager)
  • For Pythonic frontends, choose UI frameworks that support multi-worker setups
  • Use a process manager (e.g. uvicorn) to improve stability and performance

Cost Management

  • Pricing Overview categories: Data Engineering, Data Warehousing, Operational Database, Interactive workloads (Compute for Data Science, Apps), Artificial Intelligence, Platform, Collaboration, Beta Products, Calculator
  • The fastest and most secure way to build data and AI applications.

Configuration options:

  • Select plan: Standard, Premium, Enterprise
  • Select cloud: AWS, Azure, Google Cloud
  • Select region: e.g., US East (N. Virginia)

App Capacity:

  • Build and deploy apps natively within the environment, automatically inheriting any governance configured in Unity Catalog
  • $\$0.375$ / app capacity hour
  • Use APIs/SDK to schedule startup/shutdown around the working day/week using Jobs
  • Auto startup/shutdown on the roadmap
  • Code snippet using WorkspaceClient from databricks.sdk:
  • w.apps.start_and_wait(name=app_name)
  • w.apps.stop_and_wait(app_name=app_name)

Architecture, Identity & Security

Control Plane components:

  • Web App
  • Compute Manager
  • Workflow Manager
  • Unity Catalog

Serverless environment:

  • Apps connects Control Plane to serverless services including SQL Warehouse, Model Serving, Vector Search, etc.
  • Supported cloud providers: AWS, Azure, Google Cloud

Your Workspace architecture flow:

  • Apps uses Short-lived OAuth tokens to connect to Unity Catalog, SQL Warehouse / Model Serving, and Object Store (S3, ADLS, GCS)
  • Unity Catalog manages Access Permissions and provides Short-lived UC tokens to access Tables, Models, Etc in Object Store

Dedicated service principal

  • A dedicated service principal (SP) is automatically created for each app
  • This enables you to grant the fewest privileges possible, and enables auditing of the app's actions

Automatic or manual permission assignment

  • Access to tables, clusters, and more can be added for your SP, just like any other user or SP
  • When you attach a resource you can manage, your SP will automatically be granted access

Best practice for compute

  • Connect to SQL warehouses, jobs, or model serving directly from your app

Service Principal

  • Created by default for every app
  • Can be used to perform actions outside of user access context
  • Can be granted with access to relevant resources

User identity

  • Passed via headers into the app
  • Used for OBO (on-behalf-of) inside the app
  • You can combine both SP and user clients in the same app for different actions
  • Use OBO for user-based data/AI access

OBO - how it works?

Request flow:

  • Request from API with token* or Request from browser with cookie goes to Control Plane
  • Control Plane performs: Generate token, Add token to headers, and forwards to Your app

Your application:

  • Pick the token from header
  • Use it in the workspace client

Example FastAPI code snippet (@app.get("/me")):

  • Extracts X-Forwarded-Access-Token header
  • Initializes as_user = WorkspaceClient(token=token)
  • Fetches user = as_user.current_user.me() and returns user.as_dict()
  • * Token must have same scopes as the app

SQL connector

  • Uses from databricks import sql
  • Connects with sql.connect(access_token=token)
  • Executes SQL query (SELECT name, age FROM users) and returns cursor.fetchall_arrow()

API

  • Uses from databricks.sdk import WorkspaceClient
  • Initializes w = WorkspaceClient(token)
  • Calls a serving endpoint via w.serving_endpoints.query(name="endpoint-name", inputs={...})

Dependency & Package Management Architecture

  • Apps connects to Unity Catalog (with Access Permissions) to install libraries stored on UC volumes in Object Store (S3, ADLS, GCS), while access to public Python Package Index (PyPI) can be blocked by a firewall

Libraries are installed at launch

  • Libraries defined in requirements.txt are installed directly in the sandboxed container, running on your dedicated compute

Use public / cloud repositories or UC

  • By default, libraries are downloaded from public repos like PyPI
  • You can specify self-hosted repos (use platform secrets for credentials)
  • You can also load libraries from your UC Volumes

Shared responsibility model

  • Customers are responsible for the management and patching of these dependencies.

Serverless Egress Controls

  • Block access to public repositories with serverless egress controls

Product Roadmap & Summary

Vision

  • To further democratize data + AI by making Apps the interface for the Data Intelligence Platform. Apps will be a secure, scalable, and cloud agnostic platform for developing, deploying, and managing the next generation of data and AI applications.

Timeline (* Timeline subject to change)

  • Q1 2025: Private Preview — Selected customers for early testing
  • Q2 2025: DAIS — Public announcement of Apps at DAIS 2025
  • Q4 2025: Public Preview — All eligible customers can use Apps under PubPr
  • End of Q1 2025*: GA — General Availability with more supported regions and capabilities

Availability, scalability, and complexity

  • Support complex modern web applications with broad availability across regions and clouds.
  • Broader region and cloud support
  • "On-behalf-of user" execution
  • Vertical and horizontal scaling
  • Native support for javascript
  • Multi-service apps with APIs

Operational visibility and analytics

  • Make Apps easier to productionalize and manage with native monitoring and analytics.
  • End-to-end app availability/uptime
  • App resource monitoring
  • Auditable app auth logs
  • Budgets and cost monitoring

Collaboration and distribution

  • Make it easier to distribute and collaborate both within and across organizational boundaries
  • Integration with external IdPs
  • Apps in the Marketplace

Summary — Key Takeaways

  • Apps is GA; identify any apps that may benefit from using platform data & services.
  • "There is no substitute for hard work" - roll up your sleeves and start building using existing templates, accelerators, or even from scratch.

Call to Action

  • Start developing with Apps, even for prototyping to start off with.
  • Reach out to your account team for further assistance (e.g. roadmap, use-case ideas, SME guidance)
  • Like, follow, and subscribe to Skill Builder channel!

Observability with OpenTelemetry

  • An open-source observability framework for collecting telemetry data

What is the OpenTelemetry Protocol?

  • Provides standardized tools and APIs for instrumenting applications
  • Vendor-neutral solution for generating, collecting, and exporting telemetry data
  • Supports multiple programming languages and platforms
  • Combines traces, metrics, and logs in a unified data collection approach

Why OTel?

  • OTel satisfies the need for observability while following two key principles:
  • You own the data that you generate. There's no vendor lock-in.
  • You only have to learn a single set of APIs and conventions.
  • Both principles combined grant teams and organizations the flexibility they need in today's modern computing world.

Tracing

  • Pinpoint application behaviour throughout the entire lifecycle
  • Tracing is a method of tracking a request's journey through a distributed system, providing visibility into the flow and performance of operations across multiple services or components.
  • It helps developers understand the path of a request, identify bottlenecks, and diagnose issues in complex, microservices-based architectures.

Key Components:

  • Spans
  • Context Propagation
  • Distributed Tracing
  • Trace flow: User Action -> API Gateway -> Service A -> Service B -> Database (with corresponding spans for each step)

Python instrumentation example (diceroller.tracer with Flask):

  • Acquires a tracer via trace.get_tracer("diceroller.tracer")
  • Creates a child span using with tracer.start_as_current_span("roll") as rollspan: and records attributes via rollspan.set_attribute("roll.value", res)

Metrics

  • Quantify application behaviour, analyze, and remediate
  • Metrics are numerical measurements of system behavior and performance collected over time, providing quantitative insights into the health and status of applications and infrastructure.
  • They provide a high-level overview of system performance, helping to identify trends, anomalies, and potential issues before they become critical problems.

Types of Metrics:

  • Counters
  • Gauges
  • Histograms

Dashboard monitoring examples:

  • Request Rate across endpoints (/account, /cart, /fastcache, /health, /login, /payment)
  • Overall Error %age ($1.00$) and Error Percentages by Target (/account: $3.95$, /cart: $1.30$, /fastcache: $5.10$, /health: $3.37$, /login: $3.57$, /payment: $1.69$)
  • Top 10 Highest Endpoint Latencies Over Last Minute (POST /fastcache at $15.6\text{ ms}$, GET /login at $11.9\text{ ms}$, POST /payment at $11.4\text{ ms}$, POST /cart at $10.7\text{ ms}$, DELETE /health at $10.7\text{ ms}$, DELETE /fastcache at $10.5\text{ ms}$, DELETE /cart at $9.99\text{ ms}$, POST /login at $9.65\text{ ms}$, POST /account at $9.31\text{ ms}$)
  • All Endpoint Latencies in ms (Last 10 mins) and 95th Percentile Response Latencies (ms)

Top comments (0)