Lakehouse ランタイム カタログを使用して、SAP Business データクラウド データ プロダクトを Cortex Framework と統合して同期します。

このドキュメントでは、Lakehouse ランタイム カタログ統合を使用して Cortex Framework を SAP Business Data Cloud に接続する方法について説明します。

Google Cloud SAP Delta Sharing と BigQuery Lakehouse ランタイム カタログ連携接続を組み合わせることで、Cortex Framework は、SAP BDC 内で管理されているデータ プロダクトを BigQuery で直接クエリし、ゼロコピーのオーバーヘッドでカスタムの下流分析データ プロダクトで参照できます。この統合の主なコンポーネントは次のとおりです。

  1. 連携クエリ: SAP BDC で公開されたデータ プロダクトは、安全な Delta Sharing エンドポイントを使用して公開されます。BigQuery は、 Google Cloud Lakehouse ランタイム カタログ接続を使用して、これらのエンドポイントにクエリを連携します。
  2. カタログ登録: Cortex Framework では、config/config.yamldata.modules.catalogsdelta_share タイプのモジュールを使用して SAP BDC カタログを登録します。
  3. Google Cloud Cortex Framework データ プロダクトのバインディング: 下流のカスタム データ プロダクトは、入力依存関係を {catalog_id}.{share_id}.{table_name} 形式の特定の Delta Sharing 共有とテーブル ID にバインドすることで、BDC カタログ テーブルを参照します。

SAP BDC の前提条件

Cortex Framework で接続を構成する前に、 Google Cloud と SAP で次の手順を完了する必要があります。

  • Google Cloud Lakehouse ランタイム カタログを構成する: SAP Business データクラウド 用の Google Cloud Delta Sharing を活用して、 Google Cloud プロジェクトで BigQuery Lakehouse ランタイム カタログ接続を設定します。
  • 共有 ID を取得する: 接続された SAP BDC テナントによって公開された Delta Sharing の shareIdcustomer_v1_he2_100_p8123salesorder_v1_he2_100_p8124 など)を特定して一覧表示します。

構成の例

次の構成例では、SAP BDC カタログを登録し、その共有を使用してカスタムの販売パフォーマンス データ プロダクトを計算します。

buildEnvironment:
  buildProjectId: YOUR_BUILD_PROJECT_ID

data:
  bigQueryLocation: europe-west3
  namespaces:
    - name: cortex
      path: ../src/data_modules/cortex
    - name: cortex_samples
      path: ../src/data_modules/cortex_samples
  datasets:
    - id: sap_bdc_data_products
      projectId: YOUR_TARGET_PROJECT_ID
      datasetId: sap_bdc_data_products

  modules:
    # 1. Register the SAP BDC Lakehouse runtime catalog connection (using lakehouse_delta_share type)
    catalogs:
      - id: sap_bdc_catalog
        type: lakehouse_delta_share
        enabled: true
        bindsNamespaces: [sap_bdc]
        connectionSettings:
          catalogId: sap_bdc_catalog
          projectId: YOUR_CATALOG_PROJECT_ID
          location: europe-west3
          shares:
            - shareId: customer_v1_he2_100_p8123
            - shareId: salesorder_v1_he2_100_p8124

    # 2. Reference the catalog shares in downstream products
    products:
      - moduleId: sap_bdc_sales_performance
        modulePath: cortex_samples.sap_bdc.products.sales_performance
        dependencyBindings:
          # Bind logical dependencies directly to the catalog shares and tables
          sapBdcCustomer: sap_bdc_catalog.customer_v1_he2_100_p8123.customer
          sapBdcSalesOrder: sap_bdc_catalog.salesorder_v1_he2_100_p8124.salesorder
        dataTargetId: sap_bdc_data_products

パラメータのリファレンスについては、データ カタログ モジュール タイプのデプロイ構成セクションをご覧ください。

カスタム データ プロダクトが Lakehouse ランタイム カタログ テーブルに依存している場合は、カタログパス構文を使用して config/config.yaml で入力依存関係を構成します。

dependencyBindings:     {logical_input_name}: {catalog_id}.{share_id}.{table_name}

ここで

  • {catalog_id} は、data.modules.catalogs のカタログ id プロパティと一致します。
  • {share_id} が、宣言されたカタログ shareId 文字列のいずれかと一致します。
  • {table_name} は、その共有内で公開されている物理テーブル名と一致します。

ダウンストリームの Dataform 依存関係バインディング

コンパイル(cortex-build)中に、Cortex Framework はカタログ メタデータを読み取り、依存関係バインディングを完全修飾された BigQuery フェデレーション テーブル名に自動的に変換します。

カスタム データ プロダクトの定義(.js ファイルや .sqlx ファイルなど)で、準拠した SAP BDC ソースを参照します。

// Example JS definition referencing SAP BDC inputs
const moduleConfig = config.product[moduleContext.moduleId];
const customerSource = moduleConfig.sources.sapBdcCustomer;
const salesOrderSource = moduleConfig.sources.sapBdcSalesOrder;

publish("custom_sales_performance", {
  type: "table",
}).query(
  (ctx) => `
    SELECT
      cust.customer_id,
      orders.sales_order_id,
      orders.amount
    FROM ${ctx.ref(customerSource.datasetId, customerSource.tableName)} AS cust
    JOIN ${ctx.ref(salesOrderSource.datasetId, salesOrderSource.tableName)} AS orders
      ON cust.customer_id = orders.customer_id
  `
);