thomazrossito/data-agents/databricks-lakebase-autoscale
Claude Code and agent skill by thomazrossito/data-agents
- community
Checking that the SKILL.md file is still in the repository.
Patterns and best practices for Lakebase Autoscaling (next-gen managed PostgreSQL). Use when creating or managing Lakebase Autoscaling projects, configuring autoscaling compute or scale-to-zero, working with database branching for dev/test workflows, implementing reverse ETL via synced tables, or connecting applications to Lakebase with OAuth credentials.
Install
npx vskill@latest install thomazrossito/data-agents/databricks-lakebase-autoscaleSKILL.md
The same SKILL.md was published earlier as thomazrossito/data-agents/databricks-lakebase-autoscale.
Lakebase Autoscaling
Patterns and best practices for using Lakebase Autoscaling, the next-generation managed PostgreSQL on Databricks with autoscaling compute, branching, scale-to-zero, and instant restore.
When to Use
Use this skill when:
- Building applications that need a PostgreSQL database with autoscaling compute
- Working with database branching for dev/test/staging workflows
- Adding persistent state to applications with scale-to-zero cost savings
- Implementing reverse ETL from Delta Lake to an operational database via synced tables
- Managing Lakebase Autoscaling projects, branches, computes, or credentials
Overview
Lakebase Autoscaling is Databricks' next-generation managed PostgreSQL service for OLTP workloads. It provides autoscaling compute, Git-like branching, scale-to-zero, and instant point-in-time restore.
| Feature | Description | |
|---|---|---|
| Autoscaling Compute | 0.5-112 CU with 2 GB RAM per CU; scales dynamically based on load | |
| Scale-to-Zero | Compute suspends after configurable inactivity timeout | |
| Branching | Create isolated database environments (like Git branches) for dev/test | |
| Instant Restore | Point-in-time restore from any moment within the configured window (up to 35 days) | |
| OAuth Authentication | Token-based auth via Databricks SDK (1-hour expiry) | |
| Reverse ETL | Sync data from Delta tables to PostgreSQL via synced tables |
Available Regions (AWS): us-east-1, us-east-2, eu-central-1, eu-west-1, eu-west-2, ap-south-1, ap-southeast-1, ap-southeast-2
Available Regions (Azure Beta): eastus2, westeurope, westus
Project Hierarchy
Understanding the hierarchy is essential for working with Lakebase Autoscaling:
| Object | Description | |
|---|---|---|
| Project | Top-level container. Created via w.postgres.create_project(). | |
| Branch | Isolated database environment with copy-on-write storage. Default branch is production. | |
| Compute | Postgres server powering a branch. Configurable CU sizing and autoscaling. | |
| Database | Standard Postgres database within a branch. Default is databricks_postgres. |
Quick Start
Create a project and connect:
Common Patterns
Generate OAuth Token
Connect from Notebook
Create a Branch for Development
Resize Compute (Autoscaling)
MCP Tools
The following MCP tools are available for managing Lakebase infrastructure. Use type="autoscale" for Lakebase Autoscaling.
manage_lakebase_database - Project Management
| Action | Description | Required Params | |
|---|---|---|---|
create_or_update | Create or update a project | name | |
get | Get project details (includes branches/endpoints) | name | |
list | List all projects | (none, optional type filter) | |
delete | Delete project and all branches/computes/data | name |
Example usage:
manage_lakebase_branch - Branch Management
| Action | Description | Required Params | |
|---|---|---|---|
create_or_update | Create/update branch with compute endpoint | project_name, branch_id | |
delete | Delete branch and endpoints | name (full branch name) |
Example usage:
generate_lakebase_credential - OAuth Tokens
Generate OAuth token (~1hr) for PostgreSQL connections. Use as password with sslmode=require.
Reference Files
- projects.md - Project management patterns and settings
- branches.md - Branching workflows, protection, and expiration
- computes.md - Compute sizing, autoscaling, and scale-to-zero
- connection-patterns.md - Connection patterns for different use cases
- reverse-etl.md - Synced tables from Delta Lake to Lakebase
CLI Quick Reference
Key Differences from Lakebase Provisioned
| Aspect | Provisioned | Autoscaling | |
|---|---|---|---|
| SDK module | w.database | w.postgres | |
| Top-level resource | Instance | Project | |
| Capacity | CU_1, CU_2, CU_4, CU_8 (16 GB/CU) | 0.5-112 CU (2 GB/CU) | |
| Branching | Not supported | Full branching support | |
| Scale-to-zero | Not supported | Configurable timeout | |
| Operations | Synchronous | Long-running operations (LRO) | |
| Read replicas | Readable secondaries | Dedicated read-only endpoints |
Common Issues
| Issue | Solution | |
|---|---|---|
| Token expired during long query | Implement token refresh loop; tokens expire after 1 hour | |
| Connection refused after scale-to-zero | Compute wakes automatically on connection; reactivation takes a few hundred ms; implement retry logic | |
| DNS resolution fails on macOS | Use dig command to resolve hostname, pass hostaddr to psycopg | |
| Branch deletion blocked | Delete child branches first; cannot delete branches with children | |
| Autoscaling range too wide | Max - min cannot exceed 8 CU (e.g., 8-16 CU is valid, 0.5-32 CU is not) | |
| SSL required error | Always use sslmode=require in connection string | |
| Update mask required | All update operations require an update_mask specifying fields to modify | |
| Connection closed after 24h idle | All connections have a 24-hour idle timeout and 3-day max lifetime; implement retry logic |
Current Limitations
These features are NOT yet supported in Lakebase Autoscaling:
- High availability with readable secondaries (use read replicas instead)
- Databricks Apps UI integration (Apps can connect manually via credentials)
- Feature Store integration
- Stateful AI agents (LangChain memory)
- Postgres-to-Delta sync (only Delta-to-Postgres reverse ETL)
- Custom billing tags and serverless budget policies
- Direct migration from Lakebase Provisioned (use pg_dump/pg_restore or reverse ETL)
SDK Version Requirements
- Databricks SDK for Python: >= 0.81.0 (for
w.postgresmodule) - psycopg: 3.x (supports
hostaddrparameter for DNS workaround) - SQLAlchemy: 2.x with
postgresql+psycopgdriver
Notes
- Compute Units in Autoscaling provide ~2 GB RAM each (vs 16 GB in Provisioned).
- Resource naming follows hierarchical paths:
projects/{id}/branches/{id}/endpoints/{id}. - All create/update/delete operations are long-running -- use
.wait()in the SDK. - Tokens are short-lived (1 hour) -- production apps MUST implement token refresh.
- Postgres versions 16 and 17 are supported.
Related Skills
- [databricks-lakebase-provisioned](../databricks-lakebase-provisioned/SKILL.md) - fixed-capacity managed PostgreSQL (predecessor)
- [databricks-app-apx](../databricks-app-apx/SKILL.md) - full-stack apps that can use Lakebase for persistence
- [databricks-app-python](../databricks-app-python/SKILL.md) - Python apps with Lakebase backend
- [databricks-python-sdk](../databricks-python-sdk/SKILL.md) - SDK used for project management and token generation
- [databricks-bundles](../databricks-bundles/SKILL.md) - deploying apps with Lakebase resources
- [databricks-jobs](../databricks-jobs/SKILL.md) - scheduling reverse ETL sync jobs
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/databricks/databricks-lakebase-autoscale/SKILL.md
Popularity
- Repository stars
- 30
- Repository forks
- 20
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thomazrossito/data-agents/databricks-lakebase-autoscale)