Delta テーブルプロパティの設定
適用対象 : SaaS コネクタ
データベース コネクタ
クエリーベースのコネクタ
管理された取り込みパイプラインによって作成される宛先ストリーミングテーブルに対して、Delta Lake テーブルプロパティを設定できます。宛先テーブルはパイプラインによって管理されるストリーミングテーブルであるため、ALTER TABLE ... SET TBLPROPERTIES を直接実行するのではなく、パイプラインの ingestion_definition を通じてテーブルプロパティを設定します。パイプライン仕様で table_properties を指定することは、ALTER TABLE ... SET TBLPROPERTIES コマンドと同じ効果があります。
テーブルプロパティは、次の2つのレベルで設定できます。
レベル | 挙動 |
|---|---|
パイプライン | パイプラインレベルの |
テーブルまたはスキーマ | 個々のテーブルまたはスキーマの |
テーブルプロパティを有効にする前に、その機能のリーダーおよびライターバージョンの要件を確認してください。プロパティ固有の要件については、「テーブルプロパティのリファレンス」および「型拡張」など、有効にする機能のドキュメントを参照してください。
API を使用したテーブルプロパティの設定
Declarative Automation Bundles、ノートブック、または Databricks CLI を使用してマネージド インジェスト パイプラインを作成または編集する際に、テーブル プロパティを設定できます。
次の例では、パイプラインレベルで型の拡張を有効にし、users_1 宛先テーブルに対してそれを false に上書きします。calendar_test テーブルは、パイプラインレベルの設定を継承します。
- Declarative Automation Bundles
- Databricks notebook
- Databricks CLI
resources:
pipelines:
pipeline_cdc:
name: <pipeline-name>
catalog: <destination-catalog>
schema: <destination-schema>
ingestion_definition:
ingestion_gateway_id: <gateway-pipeline-id>
table_configuration:
table_properties:
delta.enableTypeWidening: 'true'
delta.enableDeletionVectors: 'true'
objects:
- table:
source_schema: <source-schema>
source_table: users_1
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
table_properties:
delta.enableTypeWidening: 'false'
- table:
source_schema: <source-schema>
source_table: calendar_test
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
pipeline_spec = """
{
"ingestion_definition": {
"ingestion_gateway_id": "<gateway-pipeline-id>",
"table_configuration": {
"table_properties": {
"delta.enableTypeWidening": "true",
"delta.enableDeletionVectors": "true"
}
},
"objects": [
{
"table": {
"source_schema": "<source-schema>",
"source_table": "users_1",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>",
"table_configuration": {
"table_properties": {
"delta.enableTypeWidening": "false"
}
}
}
},
{
"table": {
"source_schema": "<source-schema>",
"source_table": "calendar_test",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>"
}
}
]
}
}
"""
{
"ingestion_definition": {
"ingestion_gateway_id": "<gateway-pipeline-id>",
"table_configuration": {
"table_properties": {
"delta.enableTypeWidening": "true",
"delta.enableDeletionVectors": "true"
}
},
"objects": [
{
"table": {
"source_schema": "<source-schema>",
"source_table": "users_1",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>",
"table_configuration": {
"table_properties": {
"delta.enableTypeWidening": "false"
}
}
}
},
{
"table": {
"source_schema": "<source-schema>",
"source_table": "calendar_test",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>"
}
}
]
}
}
単一の table_properties ブロック内で複数のテーブルプロパティを指定できます。
継承と上書き
テーブルプロパティは継承モデルに従っており、個々のテーブルまたはスキーマに適用された設定が、パイプラインレベルのdefault設定よりも優先されます。
- パイプラインレベルで設定されたテーブルプロパティは、パイプライン内のすべてのテーブルとスキーマに継承されます。
- テーブルまたはスキーマレベルで設定された
table_configurationは、パイプラインレベルの構成を上書きします。テーブルまたはスキーマレベルで上書きを行うと、他のパイプラインレベルのテーブル構成は継承されません。パイプラインレベルの構成を保持するには、オーバーライドでそれを繰り返します。
制限事項
マネージド インジェスト パイプラインでテーブル・プロパティを設定する場合、以下の制限が適用されます。
- 管理された取り込みパイプラインのテーブルプロパティ設定は、チェンジデータキャプチャ(CDC)を使用するデータベースコネクタでのみサポートされています。SaaS コネクタおよびクエリーベースのコネクタはサポートされていません。
- パイプライン仕様からテーブル・プロパティを削除しても、基盤となるテーブル機能は自動的には元に戻りません。例えば、
delta.enableTypeWideningを有効にした後に、リーダーの Databricks Runtime バージョンが型の拡張をサポートしていないことが判明した場合、仕様からプロパティを削除しても変更は取り消されません。その場合は、影響を受けるテーブルの完全更新を実行する必要があります。テーブル・プロパティを変更する前に、プロパティを元に戻すことで問題が解決するか、それとも完全更新が必要かを確認してください。ターゲットテーブルの完全更新を参照してください。