借助 Azure 数据工厂,可以从一个驱动器获取数据到 SQL 数据库
我正在尝试从一个驱动器(有多个文件夹)复制 Excel 文件,但 ADF 中没有内置连接器来执行此活动。我尝试过使用 Sharepoint 和 Microsoft Office 365 连接器,但无法从 One Drive 连接
根据this,Azure 数据工厂中没有内置连接器来连接一个驱动器。但作为替代方案,您可以使用 Power Automate 将数据从一个驱动器复制到 Azure blob 存储。 使用访问密钥身份验证连接 Azure blob 存储:
连接到 One Drive 帐户
选择文件来源和目的地:
通过使用 ADF 中的复制活动,您可以将数据从 blob 存储复制到 Sql 数据库。 复制数据 Json 以将多个表从 Blob 复制到 SQL 数据库:
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "Lookup1",
"type": "Lookup",
"dependsOn": [],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "AzureSqlSource",
"sqlReaderQuery": "SELECT TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES\nWHERE TABLE_TYPE = 'BASE TABLE' and TABLE_SCHEMA = 'dbo'",
"queryTimeout": "02:00:00",
"partitionOption": "None"
},
"dataset": {
"referenceName": "AzureSqlTable2",
"type": "DatasetReference"
},
"firstRowOnly": false
}
},
{
"name": "ForEach1",
"type": "ForEach",
"dependsOn": [
{
"activity": "Lookup1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "@activity('Lookup1').output.value\n",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Copy data1",
"type": "Copy",
"dependsOn": [],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "AzureSqlSource",
"queryTimeout": "02:00:00",
"partitionOption": "None"
},
"sink": {
"type": "DelimitedTextSink",
"storeSettings": {
"type": "AzureBlobFSWriteSettings"
},
"formatSettings": {
"type": "DelimitedTextWriteSettings",
"quoteAllText": true,
"fileExtension": ".csv"
}
},
"enableStaging": false,
"translator": {
"type": "TabularTranslator",
"typeConversion": true,
"typeConversionSettings": {
"allowDataTruncation": true,
"treatBooleanAsNumber": false
}
}
},
"inputs": [
{
"referenceName": "AzureSqlTable1",
"type": "DatasetReference",
"parameters": {
"Schema": {
"value": "@item().TABLE_SCHEMA",
"type": "Expression"
},
"tableName": {
"value": "@item().TABLE_NAME",
"type": "Expression"
}
}
}
],
"outputs": [
{
"referenceName": "DelimitedText1",
"type": "DatasetReference"
}
]
}
]
}
}
],
"annotations": []
}
}