incremental_update を行うための設定#
full_refresh: false#
content:
run_canonical_ids: true
run_enrichments: true
run_master_tables: true
full_refresh: false
keep_debug_tables: true
unification:
!include : unification_ex5.yml
dig ファイルの content:
の設定において full_refresh: false
を設定することで、incremental_update を行う設定となる。ただ、毎日の更新で incremental_update を行うわけではなく、3日に1回は full_refresh (従来通りの全レコードに対する処理) が行われることに注意。
incremental_columns:#
Warning
現在は、incremental_columns: [time]
の設定以外では、全ての処理が full_refresh になってしまうので、これ以外の設定を使用しない。
tables:
- database: test_id_unification_ex5
table: site_aaa
incremental_columns: [time]
key_columns:
- {column: td_client_id, key: td_client_id}
- {column: td_global_id, key: td_global_id}
YML ファイルの tables:
の設定において、各テーブルに対して incremental_columns: [column1, column2,...]
を設定する。前回どこまで処理したかを +get_next_high_water_mark
タスクで記録する際に、このオプションで指定した順に、
ORDER BY column1 DESC, column2 DESC,...
の並び替えが行われ、この並びで最初の一行 (最も最新のレコード) の column1, column2,… の値が記録される。
このオプションが設定されない場合には、+get_next_high_water_mark
タスクが実行されず、Unification Algorithm は full_refresh に近いものになり、かつ enriched_ テーブルは全てのレコードの Replace 処理となる。
incremental_columns: [time]#
incremental_columns: [time]
が指定された (ただ1つ time カラムだけが指定された) 時のみ、
incremental_update となる。Unification Algorithm が新規追加分のレコードだけを考慮し、かつ enriched_ Table をテーブルごと Replace するのではなく、新規追加分のレコードのみにエンリッチ処理を行ってテーブルに追記することになる。現状、このオプションは [time]
を設定することのみ、効率化できることを覚えておこう。
incremental_merge_iterations:#
canonical_ids:
- name: unified_cookie_id
merge_by_keys: [td_client_id, td_global_id]
merge_iterations: 5
incremental_merge_iterations: 3
canonical_ids:
の設定で、incremental_update 時のループ回数を incremental_merge_iterations:
に指定する。設定しない場合のデフォルト値は 2
となっている。