使用 Azure 数据工厂(预览版)从 Square 复制数据Copy data from Square using Azure Data Factory (Preview)

适用于: Azure 数据工厂 Azure Synapse Analytics

本文概述了如何使用 Azure 数据工厂中的复制活动从 Square 复制数据。This article outlines how to use the Copy Activity in Azure Data Factory to copy data from Square. 它是基于概述复制活动总体的复制活动概述一文。It builds on the copy activity overview article that presents a general overview of copy activity.

重要

此连接器目前提供预览版。This connector is currently in preview. 欢迎试用并提供反馈。You can try it out and give us feedback. 若要在解决方案中使用预览版连接器的依赖项,请联系 Azure 客户支持If you want to take a dependency on preview connectors in your solution, please contact Azure support.

支持的功能Supported capabilities

以下活动支持此 Square 连接器:This Square connector is supported for the following activities:

可以将数据从 Square 复制到任何支持的接收器数据存储。You can copy data from Square to any supported sink data store. 有关复制活动支持作为源/接收器的数据存储列表,请参阅支持的数据存储表。For a list of data stores that are supported as sources/sinks by the copy activity, see the Supported data stores table.

Azure 数据工厂提供内置的驱动程序用于启用连接,因此无需使用此连接器手动安装任何驱动程序。Azure Data Factory provides a built-in driver to enable connectivity, therefore you don't need to manually install any driver using this connector.

入门Getting started

若要使用管道执行复制活动,可以使用以下工具或 SDK 之一:To perform the Copy activity with a pipeline, you can use one of the following tools or SDKs:

对于特定于 Square 连接器的数据工厂实体,以下部分提供有关用于定义这些实体的属性的详细信息。The following sections provide details about properties that are used to define Data Factory entities specific to Square connector.

链接服务属性Linked service properties

Square 链接的服务支持以下属性:The following properties are supported for Square linked service:

属性Property 说明Description 必需Required
typetype type 属性必须设置为:SquareThe type property must be set to: Square Yes
connectionPropertiesconnectionProperties 定义如何连接到 Square 的一组属性。A group of properties that defines how to connect to Square. Yes
connectionProperties 下:Under connectionProperties:
hosthost Square 实例的 URL。The URL of the Square instance. (即 mystore.mysquare.com)(i.e. mystore.mysquare.com) Yes
clientIdclientId 与 Square 应用程序关联的客户端 ID。The client ID associated with your Square application. Yes
clientSecretclientSecret 与 Square 应用程序关联的客户端密码。The client secret associated with your Square application. 将此字段标记为 SecureString 以安全地将其存储在数据工厂中或引用存储在 Azure Key Vault 中的机密Mark this field as a SecureString to store it securely in Data Factory, or reference a secret stored in Azure Key Vault. Yes
accessTokenaccessToken 从 Square 获得的访问令牌。The access token obtained from Square. 通过向经过身份验证的用户请求显式权限,授予对 Square 帐户的有限访问权限。Grants limited access to a Square account by asking an authenticated user for explicit permissions. OAuth 访问令牌在发布后 30 天过期,但刷新令牌不会过期。OAuth access tokens expires 30 days after issued, but refresh tokens do not expire. 刷新令牌可以刷新访问令牌。Access tokens can be refreshed by refresh token.
将此字段标记为 SecureString 以安全地将其存储在数据工厂中或引用存储在 Azure Key Vault 中的机密Mark this field as a SecureString to store it securely in Data Factory, or reference a secret stored in Azure Key Vault.
Yes
refreshTokenrefreshToken 从 Square 获得的刷新令牌。The refresh token obtained from Square. 用于在当前的访问令牌过期时获取新的访问令牌。Used to obtain new access tokens when the current one expires.
将此字段标记为 SecureString 以安全地将其存储在数据工厂中或引用存储在 Azure Key Vault 中的机密Mark this field as a SecureString to store it securely in Data Factory, or reference a secret stored in Azure Key Vault.
No
useEncryptedEndpointsuseEncryptedEndpoints 指定是否使用 HTTPS 加密数据源终结点。Specifies whether the data source endpoints are encrypted using HTTPS. 默认值为 true。The default value is true. No
useHostVerificationuseHostVerification 指定通过 TLS 进行连接时是否要求服务器证书中的主机名与服务器的主机名匹配。Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over TLS. 默认值为 true。The default value is true. No
usePeerVerificationusePeerVerification 指定通过 TLS 进行连接时是否要验证服务器的标识。Specifies whether to verify the identity of the server when connecting over TLS. 默认值为 true。The default value is true. No

Square 支持两种类型的访问令牌:个人和 OAuth 。Square support two types of access token: personal and OAuth.

  • 个人访问令牌用于对自己 Square 帐户中的资源进行无限制的 Connect API 访问。Personal access tokens are used to get unlimited Connect API access to resources in your own Square account.
  • OAuth 访问令牌用于对任何 Square 帐户进行经过身份验证且在范围内的 Connect API 访问。OAuth access tokens are used to get authenticated and scoped Connect API access to any Square account. 当应用以帐户所有者名义访问其他 Square 帐户中的资源时,请使用它们。Use them when your app accesses resources in other Square accounts on behalf of account owners. OAuth 访问令牌还可用于访问自己 Square 帐户中的资源。OAuth access tokens can also be used to access resources in your own Square account.

在数据工厂中,通过个人访问令牌进行身份验证只需使用 accessToken,而通过 OAuth 进行身份验证则需要 accessTokenrefreshTokenIn Data Factory, Authentication via personal access token only needs accessToken, while authentication via OAuth requires accessToken and refreshToken. 此处了解如何获取访问令牌。Learn how to retrieve access token from here.

示例:Example:

{
    "name": "SquareLinkedService",
    "properties": {
        "type": "Square",
        "typeProperties": {
            "connectionProperties": {
                "host": "<e.g. mystore.mysquare.com>", 
                "clientId": "<client ID>", 
                "clientSecrect": {
                    "type": "SecureString",
                    "value": "<clientSecret>"
                }, 
                "accessToken": {
                    "type": "SecureString",
                    "value": "<access token>"
                }, 
                "refreshToken": {
                    "type": "SecureString",
                    "value": "<refresh token>"
                }, 
                "useEncryptedEndpoints": true, 
                "useHostVerification": true, 
                "usePeerVerification": true 
            }
        }
    }
}

数据集属性Dataset properties

有关可用于定义数据集的各部分和属性的完整列表,请参阅数据集一文。For a full list of sections and properties available for defining datasets, see the datasets article. 本部分提供 Square 数据集支持的属性列表。This section provides a list of properties supported by Square dataset.

要从 Square 复制数据,请将数据集的 type 属性设置为“SquareObject” 。To copy data from Square, set the type property of the dataset to SquareObject. 支持以下属性:The following properties are supported:

属性Property 说明Description 必需Required
typetype 数据集的 type 属性必须设置为:SquareObjectThe type property of the dataset must be set to: SquareObject Yes
tableNametableName 表的名称。Name of the table. 否(如果指定了活动源中的“query”)No (if "query" in activity source is specified)

示例Example

{
    "name": "SquareDataset",
    "properties": {
        "type": "SquareObject",
        "typeProperties": {},
        "schema": [],
        "linkedServiceName": {
            "referenceName": "<Square linked service name>",
            "type": "LinkedServiceReference"
        }
    }
}

复制活动属性Copy activity properties

有关可用于定义活动的各部分和属性的完整列表,请参阅管道一文。For a full list of sections and properties available for defining activities, see the Pipelines article. 本部分提供 Square 源支持的属性列表。This section provides a list of properties supported by Square source.

Square 作为源Square as source

要从 Square 复制数据,请将复制活动中的源类型设置为“SquareSource” 。To copy data from Square, set the source type in the copy activity to SquareSource. 复制活动 source 部分支持以下属性:The following properties are supported in the copy activity source section:

属性Property 说明Description 必需Required
typetype 复制活动 source 的 type 属性必须设置为:SquareSourceThe type property of the copy activity source must be set to: SquareSource Yes
查询query 使用自定义 SQL 查询读取数据。Use the custom SQL query to read data. 例如:"SELECT * FROM Business"For example: "SELECT * FROM Business". 否(如果指定了数据集中的“tableName”)No (if "tableName" in dataset is specified)

示例:Example:

"activities":[
    {
        "name": "CopyFromSquare",
        "type": "Copy",
        "inputs": [
            {
                "referenceName": "<Square input dataset name>",
                "type": "DatasetReference"
            }
        ],
        "outputs": [
            {
                "referenceName": "<output dataset name>",
                "type": "DatasetReference"
            }
        ],
        "typeProperties": {
            "source": {
                "type": "SquareSource",
                "query": "SELECT * FROM Business"
            },
            "sink": {
                "type": "<sink type>"
            }
        }
    }
]

Lookup 活动属性Lookup activity properties

若要了解有关属性的详细信息,请查看 Lookup 活动To learn details about the properties, check Lookup activity.

后续步骤Next steps

有关 Azure 数据工厂中复制活动支持作为源和接收器的数据存储的列表,请参阅支持的数据存储For a list of data stores supported as sources and sinks by the copy activity in Azure Data Factory, see supported data stores.