メインコンテンツまでスキップ

Meta Adsからデータを取り込む

備考

ベータ版

この機能はベータ版です。ワークスペース管理者は、 プレビュー ページからこの機能へのアクセスを制御できます。「Databricks プレビューの管理」を参照してください。

Meta Ads から Databricks にデータを取り込むための管理された取り込みパイプラインを作成する方法を学びます。サポートされているオブジェクトの一覧については、 「サポートされているオブジェクト」を参照してください。

要件

  • 取り込み パイプラインを作成するには、次の要件を満たす必要があります。

    • ワークスペースでUnity Catalogが有効になっている必要があります。

    • ワークスペースでサーバレスコンピュートを有効にする必要があります。 「サーバレス コンピュート要件」を参照してください。

    • 新しい接続を作成する場合:メタストアに対してCREATE CONNECTION権限が必要です。Unity Catalogの「権限の管理」を参照してください。

      コネクタが UI ベースのパイプライン オーサリングをサポートしている場合、管理者はこのページのステップを完了することで、接続とパイプラインを同時に作成できます。 ただし、パイプラインを作成するユーザーが API ベースのパイプライン オーサリングを使用している場合、または管理者以外のユーザーである場合、管理者はまずカタログ エクスプローラーで接続を作成する必要があります。 「管理対象取り込みソースへの接続」を参照してください。

    • 既存の接続を使用する場合: 接続オブジェクトに対するUSE CONNECTION権限またはALL PRIVILEGESが必要です。

    • ターゲット カタログに対するUSE CATALOG権限が必要です。

    • 既存のスキーマに対するUSE SCHEMAおよびCREATE TABLE権限、またはターゲット カタログに対するCREATE SCHEMA権限が必要です。

  • メタ広告から取り込むには、 「メタ広告をデータソースとして設定する」のステップを完了する必要があります。

取り込みパイプラインを作成する

このタブでは、宣言型自動化バンドルを使用してデータ取り込みパイプラインをデプロイする方法について説明します。バンドルにはジョブとタスクの YAML 定義を含めることができ、 Databricks CLIを使用して管理でき、さまざまなターゲット ワークスペース (開発、ステージング、本番運用など) で共有して実行できます。 詳細については、 「宣言的オートメーション バンドルとは何ですか?」を参照してください。 。

  1. Databricks CLI を使用して新しいバンドルを作成します。

    Bash
    databricks bundle init
  2. バンドルに 2 つの新しいリソース ファイルを追加します。

  3. Databricks CLI を使用してパイプラインをデプロイします。

    Bash
    databricks bundle deploy

ad_insights構成

ad_insightsから取り込む場合は、 metamarketing_parametersで次の設定を構成する必要があります。

Value

説明

level

知識の粒度レベル: accountcampaignadset 、またはad 。 デフォルトはadです。

start_date

YYYY-MM-DD形式の知見データの開始日。

breakdowns

オプション。内訳ディメンションのリスト (例: ["age", "gender", "country"] )。

action_breakdowns

オプション。アクション内訳ディメンションのリスト (例: ["action_type", "action_destination"] )。

これらの例を使用してパイプラインを構成します。

アカウントから現在および将来のすべてのテーブルを取り込む

以下はパイプライン定義ファイルの例です。

YAML
resources:
pipelines:
pipeline_meta_ads:
name: <pipeline-name>
catalog: <destination-catalog>
target: <destination-schema>
channel: PREVIEW
ingestion_definition:
connection_name: <connection-name>
objects:
- schema:
source_schema: <meta-ads-account-id>
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
scd_type: SCD_TYPE_1

アカウントから特定のテーブルを選択して取り込む

以下はパイプライン定義ファイルの例です。

YAML
resources:
pipelines:
pipeline_meta_ads:
name: <pipeline-name>
catalog: <destination-catalog>
target: <destination-schema>
channel: PREVIEW
ingestion_definition:
connection_name: <connection-name>
objects:
- table:
source_schema: <meta-ads-account-id>
source_table: campaigns
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
scd_type: SCD_TYPE_1
- table:
source_schema: <meta-ads-account-id>
source_table: ads
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
scd_type: SCD_TYPE_1

ad_insights摂取する metamarketing_parameters

以下はresources/meta_ads_pipeline.ymlファイルの例です。

YAML
resources:
pipelines:
pipeline_meta_ads:
name: <pipeline-name>
catalog: <destination-catalog>
target: <destination-schema>
channel: PREVIEW
ingestion_definition:
connection_name: <connection-name>
objects:
- table:
source_schema: <meta-ads-account-id>
source_table: ad_insights
destination_catalog: <destination-catalog>
destination_schema: <destination-schema>
table_configuration:
scd_type: SCD_TYPE_1
metamarketing_parameters:
level: ad
start_date: '2024-01-01'
breakdowns:
- age
- gender
action_breakdowns:
- action_type

宣言型自動化バンドルのジョブ定義ファイル

以下はresources/meta_ads_job.ymlファイルの例です。

YAML
resources:
jobs:
meta_ads_dab_job:
name: meta_ads_dab_job
trigger:
# Run this job every day, exactly one day from the last run
# See https://docs.databricks.com/api/workspace/jobs/create#trigger
periodic:
interval: 1
unit: DAYS
email_notifications:
on_failure:
- <email-address>
tasks:
- task_key: refresh_pipeline
pipeline_task:
pipeline_id: <pipeline-id>

一般的なパターン

高度なパイプライン構成については、 「管理された取り込みパイプラインの一般的なパターン」を参照してください。

次のステップ

パイプラインを開始、スケジュールし、アラートを設定します。一般的なパイプラインメンテナンスタスクを参照してください。

追加のリソース