Copy data from Square using Azure Data Factory or Synapse Analytics (Preview)
APPLIES TO: Azure Data Factory Azure Synapse Analytics
Tip
Try out Data Factory in Microsoft Fabric, an all-in-one analytics solution for enterprises. Microsoft Fabric covers everything from data movement to data science, real-time analytics, business intelligence, and reporting. Learn how to start a new trial for free!
This article outlines how to use the Copy Activity in an Azure Data Factory or Synapse Analytics pipeline to copy data from Square. It builds on the copy activity overview article that presents a general overview of copy activity.
Important
This connector is currently in preview. You can try it out and give us feedback. If you want to take a dependency on preview connectors in your solution, please contact Azure support.
Note
Currently, this connector doesn't support sandbox accounts.
Supported capabilities
This Square connector is supported for the following capabilities:
Supported capabilities | IR |
---|---|
Copy activity (source/-) | ① ② |
Lookup activity | ① ② |
① Azure integration runtime ② Self-hosted integration runtime
For a list of data stores that are supported as sources/sinks, see the Supported data stores table.
The service provides a built-in driver to enable connectivity, therefore you don't need to manually install any driver using this connector.
The connector supports the Windows versions in this article.
Getting started
To perform the Copy activity with a pipeline, you can use one of the following tools or SDKs:
- The Copy Data tool
- The Azure portal
- The .NET SDK
- The Python SDK
- Azure PowerShell
- The REST API
- The Azure Resource Manager template
Create a linked service to Square using UI
Use the following steps to create a linked service to Square in the Azure portal UI.
Browse to the Manage tab in your Azure Data Factory or Synapse workspace and select Linked Services, then click New:
Search for Square and select the Square connector.
Configure the service details, test the connection, and create the new linked service.
Connector configuration details
The following sections provide details about properties that are used to define Data Factory entities specific to Square connector.
Linked service properties
The following properties are supported for Square linked service:
Property | Description | Required |
---|---|---|
type | The type property must be set to: Square | Yes |
connectionProperties | A group of properties that defines how to connect to Square. | Yes |
Under connectionProperties : |
||
host | The URL of the Square instance. (i.e. mystore.mysquare.com) | Yes |
clientId | The client ID associated with your Square application. | Yes |
clientSecret | The client secret associated with your Square application. Mark this field as a SecureString to store it securely, or reference a secret stored in Azure Key Vault. | Yes |
accessToken | The access token obtained from Square. Grants limited access to a Square account by asking an authenticated user for explicit permissions. OAuth access tokens expires 30 days after issued, but refresh tokens do not expire. Access tokens can be refreshed by refresh token. Mark this field as a SecureString to store it securely, or reference a secret stored in Azure Key Vault. |
Yes |
refreshToken | The refresh token obtained from Square. Used to obtain new access tokens when the current one expires. Mark this field as a SecureString to store it securelyFactory, or reference a secret stored in Azure Key Vault. |
No |
useEncryptedEndpoints | Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. | No |
useHostVerification | Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over TLS. The default value is true. | No |
usePeerVerification | Specifies whether to verify the identity of the server when connecting over TLS. The default value is true. | No |
Square support two types of access token: personal and OAuth.
Personal access tokens are used to get unlimited Connect API access to resources in your own Square account.
OAuth access tokens are used to get authenticated and scoped Connect API access to any Square account. Use them when your app accesses resources in other Square accounts on behalf of account owners. OAuth access tokens can also be used to access resources in your own Square account.
Important
To perform Test connection in the linked service,
MERCHANT_PROFILE_READ
is required to get a scoped OAuth access token. For permissions to access other tables, see Square OAuth Permissions Reference.
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>",
"clientSecret": {
"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. This section provides a list of properties supported by Square dataset.
To copy data from Square, set the type property of the dataset to SquareObject. The following properties are supported:
Property | Description | Required |
---|---|---|
type | The type property of the dataset must be set to: SquareObject | Yes |
tableName | Name of the table. | 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. This section provides a list of properties supported by Square source.
Square as source
To copy data from Square, set the source type in the copy activity to SquareSource. The following properties are supported in the copy activity source section:
Property | Description | Required |
---|---|---|
type | The type property of the copy activity source must be set to: SquareSource | Yes |
query | Use the custom SQL query to read data. For example: "SELECT * FROM Business" . |
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 activity properties
To learn details about the properties, check Lookup activity.
Related content
For a list of data stores supported as sources and sinks by the copy activity, see supported data stores.