在管線中使用create_streaming_table()函式,為串流作業輸出的記錄建立目標資料表,包括create_auto_cdc_flow()、create_auto_cdc_from_snapshot_flow()和append_flow輸出記錄。
備註
create_target_table() 和 create_streaming_live_table() 函式已被取代。 Databricks 建議更新現有程式碼以使用 create_streaming_table() 函式。
語法
from pyspark import pipelines as dp
dp.create_streaming_table(
name = "<table-name>",
comment = "<comment>",
spark_conf={"<key>" : "<value", "<key" : "<value>"},
table_properties={"<key>" : "<value>", "<key>" : "<value>"},
path="<storage-location-path>",
partition_cols=["<partition-column>", "<partition-column>"],
cluster_by_auto = <bool>,
cluster_by = ["<clustering-column>", "<clustering-column>"],
schema="schema-definition",
expect_all = {"<key>" : "<value", "<key" : "<value>"},
expect_all_or_drop = {"<key>" : "<value", "<key" : "<value>"},
expect_all_or_fail = {"<key>" : "<value", "<key" : "<value>"},
row_filter = "row-filter-clause"
)
參數
| 參數 | 類型 | Description |
|---|---|---|
name |
str |
必須的。 數據表名稱。 |
comment |
str |
數據表的描述。 |
spark_conf |
dict |
用於執行此查詢的 Spark 組態清單 |
table_properties |
dict |
一個用於資料表的dict資料表屬性。 |
path |
str |
數據表數據的儲存位置。 如果未設定,請使用包含數據表之架構的受控儲存位置。 |
partition_cols |
list |
用於分割數據表的一或多個欄列表。 |
cluster_by_auto |
bool |
在桌子上啟用自動液體聚集。 這可以與要用作初始叢集索引鍵的直欄結合 cluster_by 並定義,然後根據工作負載進行監視和自動索引鍵選擇更新。 請參閱 自動液體群集。 |
cluster_by |
list |
在數據表上啟用液體叢集,並定義要當做叢集索引鍵使用的數據行。 請參閱 針對數據表使用液體叢集。 |
schema |
str 或 StructType |
數據表的架構定義。 架構可以定義為 SQL DDL 字串,或使用 Python StructType。 |
expect_all、expect_all_or_drop、expect_all_or_fail |
dict |
表格的數據質量限制。 提供相同的行為,並使用與預期裝飾函式相同的語法,但實作為參數。 請參閱 預期。 |
row_filter |
str |
(公開預覽)數據表的數據列篩選子句。 請參閱 使用資料列篩選和欄位遮罩發佈資料表,。 |