データ基盤モジュールの作成
カスタムのデータ基盤モジュールの作成が必要になるのは、カスタムのビルド動作を定義する場合や、すぐに使用できる状態でサポートされていない新しいソースシステム(Salesforce など)のサポートを拡張する場合のみです。
開始する前に、処理する予定のソーステーブルが元レイヤ データセットに存在することを確認します。
SAP データ基盤モジュールを操作する場合は、レプリケートされた DD03L テーブルに、取り込む予定のテーブル(カスタム テーブルや補足テーブルを含む)に必要なメタデータ レコードが含まれていることを確認します。詳細な要件については、SAP ERP メタデータの要件をご覧ください。
カスタム データ基盤モジュールまたは名前空間を作成する場合は、専用のカスタム名前空間を使用して、拡張機能とカスタマイズを Cortex Framework アーティファクトから分離し、ライフサイクル管理を改善することをおすすめします。
新しいデータ基盤モジュールの作成
データ基盤モジュールの定義は、次の手順で行います。
config/config.yamlファイルで、ターゲット データセット構成をdata.targetsに追加します。これにより、基盤テーブルがデプロイされる専用の BigQuery データセットが準備されます。
data:
targets:
- id: data_foundation_sap_custom_namespace
# Google Cloud Project ID for the target dataset.
projectId: target_project_id
# BigQuery dataset ID for the target.
datasetId: data_foundation_sap_custom_namespace
- データ基盤モジュールを定義するには、
config/config.yamlファイルのmodules.foundationセクションに次の内容を追加します。
data:
modules:
foundation:
# Recommended naming for foundation_module_id:
# custom_namespace_data_foundation_module_type
- moduleId: foundation_module_id
type: cortex.sap
dataSourceId: sap_raw_s4
dataTargetId: data_foundation_sap_custom_namespace
moduleSettings:
sapVersion: s4
mandt: "100"
# Custom table settings file, relative to 'config/' directory
# If omitted, defaults to "../src/data_modules/custom_namespace/data_foundation/data_foundation_module_type/table_settings.default.yaml"
# tableSettings: "custom_namespace/data_foundation/data_foundation_module_type/table_settings.yaml"
- 代替案: 外部処理された CDC テーブルをデータ基盤として使用する場合は、
config/config.yamlファイル内のmodules.foundationセクションをexternal: trueで調整し、dataTargetIdを削除します。
data:
modules:
foundation:
- moduleId: foundation_module_id
type: cortex.sap
dataSourceId: sap_raw_s4
external: true
moduleSettings:
sapVersion: s4
mandt: "100"
# Custom table settings file, relative to 'config/' directory
# If omitted, defaults to "../src/data_modules/custom_namespace/data_foundation/data_foundation_module_type/table_settings.default.yaml"
# tableSettings: "custom_namespace/data_foundation/data_foundation_module_type/table_settings.yaml"
- 構成で参照される
tableSettingsファイルを作成し、未加工レイヤ データセットのどのテーブルがデータ基盤レイヤに変換されるかを定義します。デフォルトのパスsrc/data_modules/custom_namespace/data_foundation/data_foundation_module_type/table_settings.default.yamlを使用することをおすすめします。
common:
- source:
tableName: custom_sap_table_name
target:
tags: [sap, s4, hourly]
clusterDetails:
columns: [ pk_column]
partitionDetails:
column: fldate
partitionType: time
timeGrain: day
データ基盤モジュールの例
次の例では、sflight テーブルをカスタム名前空間 sap_bookingdatamodel に処理する新しいカスタム データ基盤モジュールを登録します。
新しいデータ基盤モジュールを登録します。
data:
targets:
- id: data_foundation_sap_bookingdatamodel
projectId: target_project_id
datasetId: data_foundation_sap_bookingdatamodel
modules:
foundation:
- moduleId: sap_bookingdatamodel
type: sap_bookingdatamodel.sap
dataSourceId: sap_raw_s4
dataTargetId: data_foundation_sap_bookingdatamodel
moduleSettings:
sapVersion: s4
mandt: "100"
table_settings.default.yaml を作成する
テーブル設定ファイル src/data_modules/sap_bookingdatamodel/data_foundation/sap/table_settings.default.yaml を次の内容で作成します。
common:
- source:
tableName: sflight
target:
tags: [sap, s4, hourly]
clusterDetails:
columns: [carrid, connid]
partitionDetails:
column: fldate
partitionType: time
timeGrain: day
この表は SAP ECC と S/4HANA の両方で同じレイアウトであるため、セクション common: の子要素です。
各テーブルのアノテーション ファイルを作成します。これは、メタデータでスキーマを拡充するために使用されます。
サンプル シナリオでは、次の内容で src/data_modules/sap_bookingdatamodel/data_foundation/sap/annotations/sflight.yaml を作成します。
description: "transparent table FLIGHT, part of the Basis Components Module, BC-DWB-TND (Training and Demo)."
fields:
- name: "mandt"
description: "Client"
- name: "carrid"
description: "Airline Code"
- name: "connid"
description: "Flight Connection Number"
- name: "fldate"
description: "Flight date"
- name: "price"
description: "Airfare"
- name: "currency"
description: "Local currency of airline"
- name: "planetype"
description: "Aircraft Type"
- name: "seatsmax"
description: "Maximum capacity in economy class"
- name: "seatsocc"
description: "Occupied seats in economy class"
- name: "paymentsum"
description: "Total of current bookings"
- name: "seatsmax_b"
description: "Maximum capacity in business class"
- name: "seatsocc_b"
description: "Occupied seats in business class"
- name: "seatsmax_f"
description: "Maximum capacity in first class"
- name: "seatsocc_f"
description: "Occupied seats in first class"
カスタム データ基盤モジュールが正常にコンパイルされてデプロイされたことを確認するには、データ プロダクトの拡張性ページの検証セクションをご覧ください。
- 前のステップ: カスタム名前空間の設定
- 次のステップ: データ プロダクト モジュールの作成
- 概要に戻る