데이터 기반 모듈 생성

보조 원시 테이블을 처리하고 데이터 기반 데이터 세트에 포함하려면 데이터 기반 모듈을 생성해야 합니다.

커스텀 데이터 기반 모듈을 만들 때는 전용 커스텀 네임스페이스를 사용하여 패키징하는 것이 좋습니다. 또한 처리하려는 소스 테이블이 원시 레이어 데이터 세트에 있는지 확인합니다.

SAP 데이터 기반 모듈로 작업할 때는 config/config.yaml 파일에서 기반 모듈의 소스로 구성된 원시 데이터 세트에 DD03L 테이블이 복제되었는지 확인합니다. 또한 복제된 DD03L 테이블에 수집하려는 테이블 (예: sflight와 같은 커스텀 또는 보조 테이블)의 필드 메타데이터 레코드가 포함되어 있는지 확인합니다. 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:
      [...]
      - moduleId:  foundation_module_id 
        type: cortex.sap
        dataSourceId: sap_raw_s4
        dataTargetId: data_foundation_sap_custom_namespace
        moduleSettings:
          sapVersion: s4
          mandt: "100"
        tableSettings: "table_settings.yaml"
        # Optional. Path to custom table settings configuration relative to this config file, e.g., `config/custom_namespace_path/data_foundation/sap/table_settings.yaml`
        # If omitted, defaults to src/data_modules/cortex/data_foundation/sap/table_settings.default.yaml. 

  • 대안: 외부 처리된 CDC 테이블을 데이터 기반으로 사용하는 경우 config/config.yaml 파일 내의 modules.foundation 섹션을 external: true로 조정하고 targetDataSetID를 삭제합니다.
[...]
data:
  [...]
  modules:
    foundation:
      [...]
      - moduleId:  foundation_module_id 
        type: cortex.sap
        dataSourceId: sap_raw_s4
        external: true
        moduleSettings:
          sapVersion: s4
          mandt: "100"
        tableSettings: "table_settings.yaml"
        # Optional. Path to custom table settings configuration relative to this config file, e.g., `config/custom_namespace_path/data_foundation/sap/table_settings.yaml`
        # If omitted, defaults to src/data_modules/cortex/data_foundation/sap/table_settings.default.yaml. 

  • 원시 레이어 데이터 세트의 테이블을 데이터 기반 레이어로 변환할 테이블을 정의하는 참조된 table_settings.yaml을 만듭니다.
common:
  - source:
      tableName: custom_sap_table_name
    target:
      tags: [sap, s4, hourly]
      clusterDetails:
        columns: [carrid, connid]
      partitionDetails:
        column: fldate
        partitionType: time
        timeGrain: day

데이터 기반 모듈 예

다음 예에서는 이전에 정의한 네임스페이스 custom_namespace를 사용하여 sflight 테이블을 처리하는 새 커스텀 데이터 기반 모듈을 만듭니다.

새 데이터 기반 모듈을 등록합니다.

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_sap_bookingdatamodel
        moduleSettings:
          sapVersion: s4
          mandt: "100"
        tableSettings: "table_settings.yaml"

table_settings.yaml 만들기

다음 콘텐츠로 config/sap_bookingdatamodel/data_foundation/sap/table_settings.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"

커스텀 데이터 기반 모듈이 컴파일되고 배포되는지 확인하려면 데이터 제품 확장성 페이지의 확인 섹션을 참고하세요.