Token导航 LogoToken导航TokenDH.com
待分类敏感数据github未标认证来源可访问许可证需确认审计通过

databricks-lakebase-autoscaledatabricks Lakebase 自动缩放

Agent Skill

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

总安装

360

周安装

15

GitHub Stars

1,311

下载量

120
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:databricks-lakebase-autoscale(databricks Lakebase 自动缩放)
来源仓库:https://github.com/databricks-solutions/ai-dev-kit
仓库路径:skills/databricks-lakebase-autoscale
安装命令:
npx skills add https://github.com/databricks-solutions/ai-dev-kit --skill databricks-lakebase-autoscale
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/databricks-solutions/ai-dev-kit --skill databricks-lakebase-autoscale

简介

运用 Lakebase Autoscaling 模式构建按需扩展的 OLTP 数据库应用。

  • 支持分支工作流、瞬时恢复和零成本空闲状态管理。
  • 适用于需要持久化状态的应用如 LangChain 对话记忆存储。
  • 可结合 synced tables 实现 Delta Lake 到操作型数据库的反向 ETL。
  • databricks-lakebase-autoscale 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

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.

FeatureDescription
Autoscaling Compute0.5-112 CU with 2 GB RAM per CU; scales dynamically based on load
Scale-to-ZeroCompute suspends after configurable inactivity timeout
BranchingCreate isolated database environments (like Git branches) for dev/test
Instant RestorePoint-in-time restore from any moment within the configured window (up to 35 days)
OAuth AuthenticationToken-based auth via Databricks SDK (1-hour expiry)
Reverse ETLSync 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:

Project (top-level container)
  └── Branch(es) (isolated database environments)
        ├── Compute (primary R/W endpoint)
        ├── Read Replica(s) (optional, read-only)
        ├── Role(s) (Postgres roles)
        └── Database(s) (Postgres databases)
              └── Schema(s)
ObjectDescription
ProjectTop-level container. Created via w.postgres.create_project().
BranchIsolated database environment with copy-on-write storage. Default branch is production.
ComputePostgres server powering a branch. Configurable CU sizing and autoscaling.
DatabaseStandard Postgres database within a branch. Default is databricks_postgres.

Quick Start

Create a project and connect:

from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import Project, ProjectSpec

w = WorkspaceClient()

# Create a project (long-running operation)
operation = w.postgres.create_project(
    project=Project(
        spec=ProjectSpec(
            display_name="My Application",
            pg_version="17"
        )
    ),
    project_id="my-app"
)
result = operation.wait()
print(f"Created project: {result.name}")

Common Patterns

Generate OAuth Token

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

# Generate database credential for connecting (optionally scoped to an endpoint)
cred = w.postgres.generate_database_credential(
    endpoint="projects/my-app/branches/production/endpoints/ep-primary"
)
token = cred.token  # Use as password in connection string
# Token expires after 1 hour

Connect from Notebook

import psycopg
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

# Get endpoint details
endpoint = w.postgres.get_endpoint(
    name="projects/my-app/branches/production/endpoints/ep-primary"
)
host = endpoint.status.hosts.host

# Generate token (scoped to endpoint)
cred = w.postgres.generate_database_credential(
    endpoint="projects/my-app/branches/production/endpoints/ep-primary"
)

# Connect using psycopg3
conn_string = (
    f"host={host} "
    f"dbname=databricks_postgres "
    f"user={w.current_user.me().user_name} "
    f"password={cred.token} "
    f"sslmode=require"
)
with psycopg.connect(conn_string) as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT version()")
        print(cur.fetchone())

Create a Branch for Development

from databricks.sdk.service.postgres import Branch, BranchSpec, Duration

# Create a dev branch with 7-day expiration
branch = w.postgres.create_branch(
    parent="projects/my-app",
    branch=Branch(
        spec=BranchSpec(
            source_branch="projects/my-app/branches/production",
            ttl=Duration(seconds=604800)  # 7 days
        )
    ),
    branch_id="development"
).wait()
print(f"Branch created: {branch.name}")

Resize Compute (Autoscaling)

from databricks.sdk.service.postgres import Endpoint, EndpointSpec, FieldMask

# Update compute to autoscale between 2-8 CU
w.postgres.update_endpoint(
    name="projects/my-app/branches/production/endpoints/ep-primary",
    endpoint=Endpoint(
        name="projects/my-app/branches/production/endpoints/ep-primary",
        spec=EndpointSpec(
            autoscaling_limit_min_cu=2.0,
            autoscaling_limit_max_cu=8.0
        )
    ),
    update_mask=FieldMask(field_mask=[
        "spec.autoscaling_limit_min_cu",
        "spec.autoscaling_limit_max_cu"
    ])
).wait()

MCP Tools

The following MCP tools are available for managing Lakebase infrastructure. Use type="autoscale" for Lakebase Autoscaling.

manage_lakebase_database - Project Management

ActionDescriptionRequired Params
create_or_updateCreate or update a projectname
getGet project details (includes branches/endpoints)name
listList all projects(none, optional type filter)
deleteDelete project and all branches/computes/dataname

Example usage:

# Create an autoscale project
manage_lakebase_database(
    action="create_or_update",
    name="my-app",
    type="autoscale",
    display_name="My Application",
    pg_version="17"
)

# Get project with branches
manage_lakebase_database(action="get", name="my-app", type="autoscale")

# Delete project
manage_lakebase_database(action="delete", name="my-app", type="autoscale")

manage_lakebase_branch - Branch Management

ActionDescriptionRequired Params
create_or_updateCreate/update branch with compute endpointproject_name, branch_id
deleteDelete branch and endpointsname (full branch name)

Example usage:

# Create a dev branch with 7-day TTL
manage_lakebase_branch(
    action="create_or_update",
    project_name="my-app",
    branch_id="development",
    source_branch="production",
    ttl_seconds=604800,  # 7 days
    autoscaling_limit_min_cu=0.5,
    autoscaling_limit_max_cu=4.0,
    scale_to_zero_seconds=300
)

# Delete branch
manage_lakebase_branch(action="delete", name="projects/my-app/branches/development")

generate_lakebase_credential - OAuth Tokens

Generate OAuth token (~1hr) for PostgreSQL connections. Use as password with sslmode=require.

# For autoscale endpoints
generate_lakebase_credential(endpoint="projects/my-app/branches/production/endpoints/ep-primary")

Reference Files

CLI Quick Reference

# Create a project
databricks postgres create-project \
    --project-id my-app \
    --json '{"spec": {"display_name": "My App", "pg_version": "17"}}'

# List projects
databricks postgres list-projects

# Get project details
databricks postgres get-project projects/my-app

# Create a branch
databricks postgres create-branch projects/my-app development \
    --json '{"spec": {"source_branch": "projects/my-app/branches/production", "no_expiry": true}}'

# List branches
databricks postgres list-branches projects/my-app

# Get endpoint details
databricks postgres get-endpoint projects/my-app/branches/production/endpoints/ep-primary

# Delete a project
databricks postgres delete-project projects/my-app

Key Differences from Lakebase Provisioned

AspectProvisionedAutoscaling
SDK modulew.databasew.postgres
Top-level resourceInstanceProject
CapacityCU_1, CU_2, CU_4, CU_8 (16 GB/CU)0.5-112 CU (2 GB/CU)
BranchingNot supportedFull branching support
Scale-to-zeroNot supportedConfigurable timeout
OperationsSynchronousLong-running operations (LRO)
Read replicasReadable secondariesDedicated read-only endpoints

Common Issues

IssueSolution
Token expired during long queryImplement token refresh loop; tokens expire after 1 hour
Connection refused after scale-to-zeroCompute wakes automatically on connection; reactivation takes a few hundred ms; implement retry logic
DNS resolution fails on macOSUse dig command to resolve hostname, pass hostaddr to psycopg
Branch deletion blockedDelete child branches first; cannot delete branches with children
Autoscaling range too wideMax - min cannot exceed 8 CU (e.g., 8-16 CU is valid, 0.5-32 CU is not)
SSL required errorAlways use sslmode=require in connection string
Update mask requiredAll update operations require an update_mask specifying fields to modify
Connection closed after 24h idleAll 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.postgres module)
  • psycopg: 3.x (supports hostaddr parameter for DNS workaround)
  • SQLAlchemy: 2.x with postgresql+psycopg driver
%pip install -U "databricks-sdk>=0.81.0" "psycopg[binary]>=3.0" sqlalchemy

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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.91%
按下载量换算44

Claude

29.38%
按下载量换算35

Cursor

17.42%
按下载量换算21

Gemini CLI

10.35%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills