Patterns and best practices for managing Lakebase Autoscaling (managed PostgreSQL) projects, autoscaling compute, scale-to-zero, database branching, reverse ETL synced tables, and OAuth connections.
How this skill is triggered — by the user, by Claude, or both
Slash command
/databricks-ai-dev-kit:databricks-lakebase-autoscaleThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Lakebase Autoscaling is Databricks' next-generation managed PostgreSQL service for OLTP workloads: autoscaling compute, database branching, scale-to-zero, instant restore, and Delta-to-Postgres synced tables.
Lakebase Autoscaling is Databricks' next-generation managed PostgreSQL service for OLTP workloads: autoscaling compute, database branching, scale-to-zero, instant restore, and Delta-to-Postgres synced tables.
Use this skill when creating/managing Lakebase Autoscaling projects, branches, endpoints/computes, credentials, reverse ETL synced tables, or app connections.
There is no separate Python “Lakebase SDK.” Use
databricks-sdkfor management and for minting short-lived database credentials withWorkspaceClient().postgres.generate_database_credential(...); use standard Postgres drivers (psycopg, SQLAlchemy, JDBC,pgx, etc.) for SQL.
| Language | Credential / management SDK | DB driver / wrapper |
|---|---|---|
| Python | databricks-sdk WorkspaceClient().postgres | psycopg[binary,pool] canonical; SQLAlchemy supported |
| Node/TS | @databricks/lakebase convenience wrapper, Autoscaling only | Wrapper manages pg pool |
| Java/Go | Databricks SDK for Java/Go | Standard JDBC / pgx |
For production Python apps, start with:
psycopg_pool.ConnectionPoolconnection_class=OAuthConnection, where OAuthConnection(psycopg.Connection).connect() calls w.postgres.generate_database_credential(endpoint=...)max_lifetime=2700This is the canonical pattern from the official Databricks Apps + Lakebase Autoscaling tutorial lineage and databricks-ai-bridge: no background token thread; physical connections get fresh credentials when opened/recycled.
Prefer max_lifetime=2700 as a defensive 45-minute recycle before 1-hour token expiry. The official tutorial does not set max_lifetime; databricks-ai-bridge uses 2700.
See connections.md.
Do not use WorkspaceClient().config.token, w.config.oauth_token().access_token, or any workspace-scoped OAuth token as the Postgres password. It will fail at Postgres login.
Use:
cred = WorkspaceClient().postgres.generate_database_credential(endpoint=endpoint_name)
password = cred.token
That token is Lakebase-scoped and is used as the Postgres password with sslmode=require.
Project
└── Branches
├── Endpoint/Compute: primary read-write endpoint
├── Read replicas: optional read-only endpoints
├── Roles
└── Databases
└── Schemas/Tables
Canonical names:
projects/{project_id}
projects/{project_id}/branches/{branch_id}
projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}
Defaults on project creation:
productiondatabricks_postgresKey SDK namespace: WorkspaceClient().postgres.
Most create/update/delete calls return long-running operations; call .wait().
| Aspect | Provisioned | Autoscaling |
|---|---|---|
| SDK module | w.database | w.postgres |
| Top-level resource | Instance | Project |
| Capacity | fixed CU tiers, ~16 GB/CU | 0.5–112 CU, ~2 GB/CU |
| Branching | no | yes |
| Scale-to-zero | no | yes |
| Operations | mostly synchronous | LROs; use .wait() |
| Reverse ETL | synced tables | synced tables |
| Read replicas | readable secondaries | dedicated read-only endpoints |
us-east-1, us-east-2, eu-central-1, eu-west-1, eu-west-2, ap-south-1, ap-southeast-1, ap-southeast-2.eastus2, westeurope, westus.max - min <= 16.sslmode=require on all driver connections.w.postgres.get_endpoint(...).status.hosts.host.status; create/update payloads use spec.FieldMask.host and hostaddr to psycopg.connections.md — app/notebook connection patterns and credential rotation.operations.md — project, branch, endpoint/compute, scale-to-zero, limits, MCP mapping.reverse-etl.md — synced tables from Delta Lake to Lakebase.pip install -U "databricks-sdk>=0.81.0" "psycopg[binary,pool]>=3.1" "sqlalchemy>=2"
Use SQLAlchemy URL prefix postgresql+psycopg://... for psycopg3.
Not yet supported or not equivalent to Provisioned:
pg_dump/pg_restore or reverse ETL patterns where appropriate.npx claudepluginhub databricks-solutions/ai-dev-kit --plugin databricks-ai-dev-kitProvides patterns and best practices for Databricks Lakebase Provisioned (managed PostgreSQL) including instance creation, OAuth authentication, and reverse ETL for OLTP workloads.
Manages Databricks Lakebase Postgres: creates autoscaling projects, branching, compute scaling, PostgreSQL connectivity, Data API, and synced tables. For Lakebase databases, OLTP storage, or app connections to Databricks Postgres.
Provides expert guidance for Azure Database for PostgreSQL: troubleshooting, best practices, architecture, security, deployment. Use when working with pgvector, query store, VNet/Private Link, CI/CD/Bicep.