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.
64
75%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./databricks-skills/databricks-lakebase-autoscale/SKILL.mdLakebase 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.tokenThat 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/TablesCanonical 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.93cb4e3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.