Loading...
Loading...
Compare original and translation side by side
| 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 |
| 功能 | 说明 |
|---|---|
| 自动扩缩容计算资源 | 0.5-112 CU,每CU配备2GB内存;根据负载动态扩缩容 |
| 缩容至零 | 在配置的闲置超时后,计算资源会自动暂停 |
| 分支功能 | 创建隔离的数据库环境(类似Git分支),用于开发/测试 |
| 即时恢复 | 可在配置的时间窗口内(最长35天)从任意时间点进行恢复 |
| OAuth认证 | 通过Databricks SDK实现基于令牌的认证(令牌1小时后过期) |
| 反向ETL | 通过同步表将Delta表的数据同步至PostgreSQL |
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)| Object | Description |
|---|---|
| Project | Top-level container. Created via |
| Branch | Isolated database environment with copy-on-write storage. Default branch is |
| Compute | Postgres server powering a branch. Configurable CU sizing and autoscaling. |
| Database | Standard Postgres database within a branch. Default is |
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)| 对象 | 说明 |
|---|---|
| 项目(Project) | 顶级容器。通过 |
| 分支(Branch) | 具备写时复制存储的隔离数据库环境。默认分支是 |
| 计算资源(Compute) | 为分支提供支撑的Postgres服务器。可配置CU规格和自动扩缩容。 |
| 数据库(Database) | 分支内的标准Postgres数据库。默认数据库为 |
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import Project, ProjectSpec
w = WorkspaceClient()from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import Project, ProjectSpec
w = WorkspaceClient()undefinedundefinedfrom databricks.sdk import WorkspaceClient
w = WorkspaceClient()from databricks.sdk import WorkspaceClient
w = WorkspaceClient()undefinedundefinedimport psycopg
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()import psycopg
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()undefinedundefinedfrom databricks.sdk.service.postgres import Branch, BranchSpec, Durationfrom databricks.sdk.service.postgres import Branch, BranchSpec, Durationundefinedundefinedfrom databricks.sdk.service.postgres import Endpoint, EndpointSpec, FieldMaskfrom databricks.sdk.service.postgres import Endpoint, EndpointSpec, FieldMaskundefinedundefinedtype="autoscale"type="autoscale"| Tool | Description |
|---|---|
| Create or update a database. Finds by name, creates if new, updates if existing. Use |
| Get database details (including branches and endpoints) or list all. Pass |
| Delete a project and all its branches, computes, and data. Use |
| 工具 | 说明 |
|---|---|
| 创建或更新数据库。按名称查找,不存在则创建,存在则更新。使用 |
| 获取数据库详情(包括分支和端点)或列出所有数据库。传入 |
| 删除项目及其所有分支、计算资源和数据。使用 |
| Tool | Description |
|---|---|
| Create or update a branch with its compute endpoint. Params: |
| Delete a branch and its compute endpoints. |
| 工具 | 说明 |
|---|---|
| 创建或更新带有计算端点的分支。参数包括: |
| 删除分支及其计算端点。 |
| Tool | Description |
|---|---|
| Generate OAuth token for PostgreSQL connections (1-hour expiry). Pass |
| 工具 | 说明 |
|---|---|
| 生成用于PostgreSQL连接的OAuth令牌(1小时后过期)。针对Autoscale版本,传入 |
undefinedundefinedundefinedundefined| Aspect | Provisioned | Autoscaling |
|---|---|---|
| SDK module | | |
| 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 |
| 维度 | Provisioned版本 | Autoscaling版本 |
|---|---|---|
| SDK模块 | | |
| 顶级资源 | 实例(Instance) | 项目(Project) |
| 容量规格 | CU_1、CU_2、CU_4、CU_8(每CU 16GB内存) | 0.5-112 CU(每CU 2GB内存) |
| 分支功能 | 不支持 | 完全支持分支功能 |
| 缩容至零 | 不支持 | 可配置超时时间 |
| 操作方式 | 同步操作 | 长时间运行操作(LRO) |
| 只读副本 | 可读从节点 | 专用只读端点 |
| 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 |
| 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 |
| Update mask required | All update operations require an |
| Connection closed after 24h idle | All connections have a 24-hour idle timeout and 3-day max lifetime; implement retry logic |
| 问题 | 解决方案 |
|---|---|
| 长查询过程中令牌过期 | 实现令牌刷新逻辑;令牌有效期为1小时 |
| 缩容至零后连接被拒绝 | 计算资源会在连接请求时自动唤醒;重新激活需几百毫秒;实现重试逻辑 |
| macOS上DNS解析失败 | 使用 |
| 分支删除被阻止 | 先删除子分支;无法删除包含子分支的分支 |
| 自动扩缩容范围过宽 | 最大值与最小值的差不能超过8 CU(例如8-16 CU是合法的,0.5-32 CU不合法) |
| 要求SSL的错误 | 连接字符串中始终使用 |
| 需要更新掩码 | 所有更新操作都需要指定 |
| 闲置24小时后连接被关闭 | 所有连接的闲置超时为24小时,最大生命周期为3天;实现重试逻辑 |
w.postgreshostaddrpostgresql+psycopg%pip install -U "databricks-sdk>=0.81.0" "psycopg[binary]>=3.0" sqlalchemyw.postgreshostaddrpostgresql+psycopg%pip install -U "databricks-sdk>=0.81.0" "psycopg[binary]>=3.0" sqlalchemyprojects/{id}/branches/{id}/endpoints/{id}.wait()projects/{id}/branches/{id}/endpoints/{id}.wait()