データベースコネクタの完全更新動作を構成する
適用対象: データベースコネクタ
APIベースのパイプラインオーサリング
LakeFlow Connectのデータベース コネクタ ( SQL Serverなど) を使用して、管理された取り込みパイプラインの完全な更新動作を構成する方法を学びます。 完全更新スナップショットの実行時間をスケジュールし、自動完全更新を有効にしてサポートされていないスキーマの変更から回復することができます。
完全な更新ウィンドウ
完全更新ウィンドウを使用すると、完全更新のスナップショット操作がいつ発生するかをスケジュールできます。完全更新を要求するか、システムが自動的に完全更新をトリガーすると、構成されたウィンドウ内の次の利用可能な時間にスナップショットが開始されます。次の表は、スケジュールの仕組みを示しています。
リクエスト時間 | ウィンドウ | スナップショット開始 | 注 |
|---|---|---|---|
2025年10月20日月曜日 10:00:00 UTC | 開始時間: 20、曜日: 火曜日、タイムゾーン: UTC | 2025年10月21日火曜日 20:00:00 UTC | スナップショットは次の利用可能なウィンドウ日に延期されます |
2025年10月20日月曜日 09:30:00 UTC | 開始時間: 9、曜日: 月曜日、タイムゾーン: UTC | 2025年10月20日月曜日 09:30:00 UTC | 当日、時間枠内でリクエスト |
2025年10月20日月曜日 10:00:00 UTC | 開始時間: 9、曜日: 月曜日、タイムゾーン: UTC | 2025年10月27日月曜日 09:00:00 UTC | リクエスト期限が過ぎたため、来週に延期されました |
構成の問題
パイプライン仕様のingestion_definitionで完全な更新ウィンドウを構成します。
パラメーター | Type | 説明 | 必須 |
|---|---|---|---|
| Integer | 24 時間制におけるウィンドウの開始時刻 (0 ~ 23)。 | はい |
| Array | ウィンドウがアクティブな日数。有効な値: | No |
| String | ウィンドウのタイムゾーン ID。サポートされているタイム ゾーン ID については、 「セッション タイム ゾーンの設定」を参照してください。指定されていない場合はデフォルトで UTC になります。 | No |
例: 完全な更新ウィンドウを構成する
次の例は、パイプライン定義に完全更新ウィンドウを追加する方法を示しています。
- Databricks Asset Bundles
- Databricks notebook
resources:
pipelines:
gateway:
name: <gateway-name>
gateway_definition:
connection_id: <connection-id>
gateway_storage_catalog: <destination-catalog>
gateway_storage_schema: <destination-schema>
gateway_storage_name: <destination-schema>
target: <destination-schema>
catalog: <destination-catalog>
pipeline_sqlserver:
name: <pipeline-name>
catalog: <destination-catalog>
schema: <destination-schema>
ingestion_definition:
ingestion_gateway_id: <gateway-id>
objects:
- table:
source_schema: <source-schema>
source_table: <source-table>
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
full_refresh_window:
start_hour: 20
days_of_week:
- MONDAY
- TUESDAY
time_zone_id: 'America/Los_Angeles'
gateway_pipeline_spec = {
"pipeline_type": "INGESTION_GATEWAY",
"name": "<gateway-name>",
"catalog": "<destination-catalog>",
"target": "<destination-schema>",
"gateway_definition": {
"connection_id": "<connection-id>",
"gateway_storage_catalog": "<destination-catalog>",
"gateway_storage_schema": "<destination-schema>",
"gateway_storage_name": "<destination-schema>"
}
}
ingestion_pipeline_spec = {
"pipeline_type": "MANAGED_INGESTION",
"name": "<pipeline-name>",
"catalog": "<destination-catalog>",
"schema": "<destination-schema>",
"ingestion_definition": {
"ingestion_gateway_id": "<gateway-pipeline-id>",
"source_type": "SQLSERVER",
"objects": [
{
"table": {
"source_schema": "<source-schema>",
"source_table": "<source-table>",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>"
}
}
],
"full_refresh_window": {
"start_hour": 20,
"days_of_week": ["MONDAY", "TUESDAY"],
"time_zone_id": "America/Los_Angeles"
}
}
}
自動フル更新ポリシー
手動介入なしでデータの一貫性を維持できるように、自動完全更新ポリシーを使用すると、パイプラインでサポートされていない DDL 操作が発生したときに完全更新を自動的にトリガーできます。
- テーブルの切り捨て
- 互換性のないスキーマの変更(たとえば、データ型の変更)
- 列名の変更
- デフォルト値を持つ列の追加
自動完全更新が有効になっていない場合、これらの操作が発生したときに手動で完全更新をトリガーする必要があります。
構成の問題
パイプライン仕様で、パイプライン レベルまたはテーブル レベルで自動フル更新を構成します。
パラメーター | Type | 説明 | デフォルト |
|---|---|---|---|
| Boolean | 自動完全更新が有効かどうか。 |
|
| Integer | 完全更新間の最小待機間隔(時間単位)。システムは、新しい自動完全更新を開始する前に、最後のスナップショットからこの間隔だけ待機します。 | 24 |
自動完全更新は複数のレベルで設定できます。
- パイプラインレベル:
ingestion_definition.table_configuration.auto_full_refresh_policy - テーブルレベル:
ingestion_definition.objects[].table.table_configuration.auto_full_refresh_policy
テーブルレベルの構成はパイプラインレベルの構成よりも優先されます。
例: パイプライン レベルで自動完全更新を構成する
次の例は、パイプライン内のすべてのテーブルに対して自動完全更新を有効にする方法を示しています。
- Databricks Asset Bundles
- Databricks notebook
resources:
pipelines:
gateway:
name: <gateway-name>
gateway_definition:
connection_id: <connection-id>
gateway_storage_catalog: <destination-catalog>
gateway_storage_schema: <destination-schema>
gateway_storage_name: <destination-schema>
target: <destination-schema>
catalog: <destination-catalog>
pipeline_sqlserver:
name: <pipeline-name>
catalog: <destination-catalog>
schema: <destination-schema>
ingestion_definition:
ingestion_gateway_id: <gateway-id>
objects:
- table:
source_schema: <source-schema>
source_table: <source-table>
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
auto_full_refresh_policy:
enabled: true
min_interval_hours: 24
gateway_pipeline_spec = {
"pipeline_type": "INGESTION_GATEWAY",
"name": "<gateway-name>",
"catalog": "<destination-catalog>",
"target": "<destination-schema>",
"gateway_definition": {
"connection_id": "<connection-id>",
"gateway_storage_catalog": "<destination-catalog>",
"gateway_storage_schema": "<destination-schema>",
"gateway_storage_name": "<destination-schema>"
}
}
ingestion_pipeline_spec = {
"pipeline_type": "MANAGED_INGESTION",
"name": "<pipeline-name>",
"catalog": "<destination-catalog>",
"schema": "<destination-schema>",
"ingestion_definition": {
"ingestion_gateway_id": "<gateway-pipeline-id>",
"source_type": "SQLSERVER",
"objects": [
{
"table": {
"source_schema": "<source-schema>",
"source_table": "<source-table>",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>"
}
}
],
"table_configuration": {
"auto_full_refresh_policy": {
"enabled": True,
"min_interval_hours": 24
}
}
}
}
例: テーブルごとに自動完全更新を構成する
次の例は、パイプライン レベルで自動完全更新を有効にし、特定のテーブルに対して無効にする方法を示しています。
- Databricks Asset Bundles
- Databricks notebook
resources:
pipelines:
gateway:
name: <gateway-name>
gateway_definition:
connection_id: <connection-id>
gateway_storage_catalog: <destination-catalog>
gateway_storage_schema: <destination-schema>
gateway_storage_name: <destination-schema>
target: <destination-schema>
catalog: <destination-catalog>
pipeline_sqlserver:
name: <pipeline-name>
catalog: <destination-catalog>
schema: <destination-schema>
ingestion_definition:
ingestion_gateway_id: <gateway-id>
objects:
- table:
source_schema: <source-schema>
source_table: table_1
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
- table:
source_schema: <source-schema>
source_table: table_2
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
auto_full_refresh_policy:
enabled: false
min_interval_hours: 24
table_configuration:
auto_full_refresh_policy:
enabled: true
min_interval_hours: 24
gateway_pipeline_spec = {
"pipeline_type": "INGESTION_GATEWAY",
"name": "<gateway-name>",
"catalog": "<destination-catalog>",
"target": "<destination-schema>",
"gateway_definition": {
"connection_id": "<connection-id>",
"gateway_storage_catalog": "<destination-catalog>",
"gateway_storage_schema": "<destination-schema>",
"gateway_storage_name": "<destination-schema>"
}
}
ingestion_pipeline_spec = {
"pipeline_type": "MANAGED_INGESTION",
"name": "<pipeline-name>",
"catalog": "<destination-catalog>",
"schema": "<destination-schema>",
"ingestion_definition": {
"ingestion_gateway_id": "<gateway-pipeline-id>",
"source_type": "SQLSERVER",
"objects": [
{
"table": {
"source_schema": "<source-schema>",
"source_table": "table_1",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>"
}
},
{
"table": {
"source_schema": "<source-schema>",
"source_table": "table_2",
"destination_catalog": "<destination-catalog>",
"destination_schema": "<destination-schema>",
"table_configuration": {
"auto_full_refresh_policy": {
"enabled": False,
"min_interval_hours": 24
}
}
}
}
],
"table_configuration": {
"auto_full_refresh_policy": {
"enabled": True,
"min_interval_hours": 24
}
}
}
}
この例では、 table_1パイプライン レベルのポリシー (有効) を使用しますが、 table_2それをテーブル レベルの構成 (無効) で上書きします。