设置 Openflow Connector for Amazon Ads¶
备注
This connector is subject to the Snowflake Connector Terms.
本主题介绍设置 Openflow Connector for Amazon Ads 的步骤。
先决条件¶
Ensure that you have 设置 Openflow - BYOC or Set up Openflow - Snowflake Deployments.
If using Openflow - Snowflake Deployments, ensure that you have reviewed configuring required domains and have granted access to the required domains for the Amazon Ads connector.
获取凭据¶
以 Amazon Ads 管理员身份执行以下操作:
确保您可以访问 Amazon Ads 账户 (https://advertising.amazon.com/)。
获取 Amazon Ads API 访问权限 (https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview) 并完成入门流程。
获取客户端 ID 和客户端密钥 (https://advertising.amazon.com/API/docs/en-us/guides/get-started/retrieve-access-token)。
创建授权许可 (https://advertising.amazon.com/API/docs/en-us/guides/get-started/create-authorization-grant) 并 检索刷新令牌 (https://advertising.amazon.com/API/docs/en-us/guides/get-started/retrieve-access-token)。
查看 可用区域 (https://advertising.amazon.com/API/docs/en-us/reference/api-overview#api-endpoints) 并根据您投放广告的区域获取用于请求的基本 URL。
提取配置文件 IDs (https://advertising.amazon.com/API/docs/en-us/guides/get-started/retrieve-profiles) 用于报告配置。
设置 Snowflake 账户¶
作为 Snowflake 账户管理员,请执行以下任务:
创建新角色或使用现有角色并授予 数据库权限。
创建类型为 SERVICE 的新 Snowflake 服务用户。
向该 Snowflake 服务用户授予您在前面步骤中创建的角色。
为第 2 步中创建的 Snowflake SERVICE 用户配置 密钥对身份验证。
Snowflake 强烈建议执行此步骤。配置 Openflow 支持的密钥管理器(例如 AWS、Azure 和 Hashicorp),并将公钥和私钥存储在密钥存储库中。
备注
如果您出于任何原因不希望使用密钥管理器,则您有责任根据组织的安全策略保护用于密钥对身份验证的公钥和私钥文件。
配置密钥管理器后,确定如何对其进行身份验证。在 AWS 中,建议您使用与 Openflow 关联的 EC2 实例角色,因为这样就无需保留其他密钥。
In Openflow, configure a Parameter Provider associated with this Secrets Manager, from the hamburger menu in the upper right. Navigate to Controller Settings » Parameter Provider and then fetch your parameter values.
此时,可以使用关联的参数路径引用所有凭据,无需在 Openflow 中保留敏感值。
如果任何其他 Snowflake 用户需要访问连接器引入的原始文档和表(例如,在 Snowflake 中进行自定义处理),则授予这些用户在步骤 1 中创建的角色。
指定一个仓库供连接器使用。从最小的仓库规模开始,然后根据要复制的表数量和传输的数据量来测试规模。相较于扩大仓库规模,采用 多集群仓库 通常能更有效地应对海量表数量的扩展需求。
设置连接器¶
作为数据工程师,执行以下任务以安装和配置连接器:
安装连接器¶
Navigate to the Openflow overview page. In the Featured connectors section, select View more connectors.
在 Openflow 连接器页面上,找到连接器并选择 Add to runtime。
In the Select runtime dialog, select your runtime from the Available runtimes drop-down list and click Add.
备注
在安装连接器之前,请确保在 Snowflake 中为连接器创建了数据库和架构,用于存储引入的数据。
使用您的 Snowflake 账户凭据对部署进行身份验证,并在系统提示时选择 Allow,以允许运行时应用程序访问您的 Snowflake 账户。连接器安装过程需要几分钟才能完成。
使用您的 Snowflake 账户凭据进行运行时身份验证。
此时将显示 Openflow 画布,其中添加了连接器进程组。
配置连接器¶
右键点击导入的进程组并选择 Parameters。
按照 流参数 中所述填充所需的参数值。
流参数¶
本节介绍您可以根据以下参数上下文配置的流参数:
Amazon Ads source parameters: Used to establish connection with Amazon Ads API.
Amazon Ads destination parameters: Used to establish connection with Snowflake.
Amazon Ads ingestion parameters: Used to define the configuration of data downloaded from Amazon Ads.
Amazon Ads source parameters¶
参数 |
描述 |
|---|---|
客户端 ID |
Amazon Advertising 账户的客户端 ID |
客户端密钥 |
Amazon Advertising 账户的客户端密钥 |
OAuth 基础 URL |
颁发访问令牌的授权服务器的 URL
|
刷新令牌 |
Amazon Ads API 的刷新令牌 |
区域 |
下载广告数据的环境
|
Amazon Ads destination parameters¶
参数 |
描述 |
必填 |
|---|---|---|
目标数据库 |
The database where data will be persisted. It must already exist in Snowflake. The name is case-sensitive. For unquoted identifiers, provide the name in uppercase. |
是 |
目标架构 |
The schema where data will be persisted, which must already exist in Snowflake. The name is case-sensitive. For unquoted identifiers, provide the name in uppercase. 请参阅以下示例:
|
是 |
Snowflake 身份验证策略 |
使用以下方式时:
|
是 |
Snowflake 账户标识符 |
使用以下方式时:
|
是 |
Snowflake 私钥 |
使用以下方式时:
|
否 |
Snowflake 私钥文件 |
使用以下方式时:
|
否 |
Snowflake 私钥密码 |
使用以下方式时:
|
否 |
Snowflake 角色 |
使用以下方式时:
|
是 |
Snowflake 用户名 |
使用以下方式时:
|
是 |
Snowflake 仓库 |
Snowflake warehouse used to run queries. |
是 |
Amazon Ads 引入参数¶
参数 |
描述 |
|---|---|
报告名称 |
用作目标表名称的报告的名称。该名称在目标架构中必须是唯一的。 |
报告广告产品 |
被报告的广告产品类型
|
报告列 |
将出现在最终报告中的一组列。可用列的列表取决于报告类型,可以在 Amazon Ads API 文档 (https://advertising.amazon.com/API/docs/en-us/guides/reporting/v3/report-types/overview) 中找到。例如,对于 |
报告筛选器 |
一组筛选器,用于修剪返回的数据。可用筛选器的列表取决于报告类型,可以在 Amazon Ads API 文档 (https://advertising.amazon.com/API/docs/en-us/guides/reporting/v3/report-types/overview) 中找到。例如,对于 |
报告分组依据 |
确定粒度级别,以及如何汇总和显示报告中的数据。可用分组依据列的列表取决于报告类型,可以在 Amazon Ads API 文档 (https://advertising.amazon.com/API/docs/en-us/guides/reporting/v3/report-types/overview) 中找到。例如,对于 |
报告引入策略 |
提取数据的模式,可以是快照模式或增量模式
|
报告引入时段 |
指定了增量引入期间应下载数据的天数。例如,如果报告引入时段是 30 天,那么增量加载将从上次成功引入日期前 30 天开始引入,除非该计算出的日期早于总开始日期,在这种情况下,引入将从总开始日期开始。如果使用 |
报告配置文件 ID |
与特定市场中的广告账户关联的 配置文件 ID (https://advertising.amazon.com/API/docs/en-us/guides/get-started/retrieve-profiles)。 |
报告时间单位 |
日期聚合
|
报告类型 |
Amazon Ads API 支持多种 报告类型 (https://advertising.amazon.com/API/docs/en-us/guides/reporting/v3/report-types/overview)。例如:sbAds (https://advertising.amazon.com/API/docs/en-us/guides/reporting/v3/report-types/ad) 和 spCampaigns (https://advertising.amazon.com/API/docs/en-us/guides/reporting/v3/report-types/campaign)。请从文档中复制 |
报告开始日期 |
引入的起始日期。日期格式为 YYYY-MM-DD。 |
报告时间表 |
处理器创建报告的计划时间。例如: |
备注
Amazon Ads API 中的数据保留是一个特定的时间范围,从 60 天到 365 天不等,具体取决于报告类型。在此期间,历史广告效果数据会被存储并可供检索。在此之后,较早的数据可能不再可用。
运行流¶
右键点击“飞机”图标并选择 Enable all Controller Services。
右键点击导入的进程组并选择 Start。
连接器开始数据引入。