本頁說明如何移轉現有的 Databricks 線上資料表 (舊版)。 您可以移轉至下列項目:
- 線上專題商店
- Lakebase 同步資料表
這很重要
Databricks 線上資料表 (舊版) 已被取代。 2026 年 1 月 15 日之後,您將無法存取這些表格。
Databricks 線上功能存放區 (由 Lakebase 提供) 是線上功能服務的建議方法。
列出所有現有的線上表格
若要查看工作區中所有現有的線上資料表,請使用 SQL 查詢或 Python 指令碼。
SQL
將<workspace_url>和<workspace_id>替換為您的工作區資訊。
SELECT
CONCAT("https://<workspace_url>/pipelines/", usage_metadata.dlt_pipeline_id, "?o=<workspace_id>"),
SUM(usage_quantity)
FROM
system.billing.usage
WHERE
usage_date > DATE_SUB(NOW(), 7)
AND billing_origin_product = 'ONLINE_TABLES'
GROUP BY
ALL;
Python
from databricks.sdk import *
from databricks.sdk.service.catalog import *
w = WorkspaceClient()
result = []
for catalog in w.catalogs.list():
for schema in w.schemas.list(catalog_name=catalog.name):
for table in w.tables.list(catalog_name=catalog.name, schema_name=schema.name):
if table.table_type == TableType.FOREIGN and table.data_source_format == DataSourceFormat.MYSQL_FORMAT and table.pipeline_id is not None:
result.append((table.full_name, table.comment))
print(result)
將線上資料表移轉至線上功能存放區,以取得模型或功能服務端點
這很重要
這項功能為 公開預覽 版,可在下列區域使用:
westus、westus2、eastus、eastus2、northeurope、westeurope、australiaeast、brazilsouth、canadacentral、centralindia、centralus、southcentralus、southeastasia、uksouth
步驟 1:建立線上功能存放區並發佈功能表
Databricks 建議為每個工作區建立單一線上商店,以進行測試和概念證明。 對於生產使用案例或隔離需求,您可以佈建其他存放區。
from databricks.feature_engineering import FeatureEngineeringClient
fe = FeatureEngineeringClient()
# Create a single online store that can support multiple feature tables
fe.create_online_store(
name="online-feature-store",
capacity="CU_1"
)
如需發佈功能資料表的詳細資訊,請參閱 Databricks 線上功能存放區。
步驟 2:更新相依於這些線上功能的端點
使用 Databricks SDK for Python 或 UI,更新端點並新增一個以當前日期為值的環境變數 MIGRATE_FEATURE_STORE 。
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import EndpointCoreConfigInput, ServedEntityInput
workspace = WorkspaceClient()
workspace.serving_endpoints.update_config(
name="my-serving-endpoint",
served_entities=[
ServedEntityInput(
entity_name="main.default.customer_features",
workload_size="Small",
scale_to_zero_enabled=True,
environment_vars={
# Set to the current date (optional time) to indicate migration to online store
# This environment variable can be removed after January 15, 2026.
"MIGRATE_FEATURE_STORE": "2025-11-13"
}
)
]
)
如需詳細資訊,請參閱 更新端點。
步驟 3:清除在線數據表
檢查端點事件是否包含類似 的 Linked to Online Feature Store table: "table name"訊息,以確認端點是否使用新的在線商店。 請參閱 監控模型品質和端點健康情況。
接下來,刪除舊版線上資料表。 請參閱使用UI刪除線上表格或使用API刪除線上表格。
將線上資料表移轉至 OLTP 的同步處理資料表
這很重要
這項功能在下列區域中處於公開預覽狀態:westus、、westus2eastuseastus2centralussouthcentralusnortheuropewesteuropeaustraliaeastbrazilsouth、canadacentralcentralindia、、 southeastasiauksouth
步驟 1:建立資料庫實例
若要開始,請建立 Lakebase 資料庫實例來儲存同步的數據表。 請參閱 建立和管理資料庫實例。
或者,您可以建立資料庫目錄,以使用 Unity 目錄許可權來管理資料存取。 請參閱 在 Unity 目錄中註冊您的資料庫。
步驟 2:從源數據表建立同步數據表
同步表是 Unity 目錄的唯讀 Postgres 表,能自動將資料從 Unity 目錄表同步到您的 Lakebase 資料庫實例。
若要從線上資料表移轉至同步資料表,請從線上資料表的來源資料表建立同步資料表:
- 在
目錄,選取您要移轉至同步資料表的線上資料表。
- 在 概觀 索引標籤的 描述 區段下,按一下 來源 表格的名稱。
- 從選取的來源表格建立同步處理的表格。 請參閱 將數據從 Unity 目錄資料表同步至資料庫實例。
- 您可以將同步處理的資料表儲存在與現有線上資料表相同的目錄位置。
- 您可以在同步處理的資料表之間共用管線。
- 建立同步資料表後,您可以連線到資料庫執行個體並直接查詢。 請參閱 連線和查詢。
步驟 3:清除在線數據表
建立同步資料表之後,請刪除線上資料表。 請參閱使用UI刪除線上表格或使用API刪除線上表格。