azure-data-factory - 如何在 Azure 数据工厂的下一次查找中使用查找活动的结果?
问题描述
我使用 SQL 语句查找“获取客户”:
Select Count(CustomerId) As 'Row_count' ,Min(sales_amount) as 'Min_Sales' From [sales].
[Customers]
它返回值
10, 5000
接下来我使用 SQL 语句查找“更新最小销售额”,但出现错误:
Update Sales_Min_Sales
SET Row_Count = @activity('Fetch Customers').output.Row_count,
Min_Sales = @activity('Fetch Customers').output.Min_Sales
Select 1
即使我将 Lookup 设置为,也会发生相同的错误
Select @activity('Fetch Fetch Customers').output.Row_count
错误:
A database operation failed with the following error: 'Must declare the scalar variable
"@activity".',Source=,''Type=System.Data.SqlClient.SqlException,Message=Must declare the
scalar variable "@activity".,Source=.Net SqlClient Data
Provider,SqlErrorNumber=137,Class=15,ErrorCode=-2146232060,State=2,Errors=
[{Class=15,Number=137,State=2,Message=Must declare the scalar variable "@activity".,},],'
解决方案
我的设置和你的差不多。两个查找活动。
首先查找带来如图所示的最小 ID 和最大 ID
{
"count": 1,
"value": [
{
"Min": 1,
"Max": 30118
}
],
"effectiveIntegrationRuntime": "DefaultIntegrationRuntime (East US)",
"billingReference": {
"activityType": "PipelineActivity",
"billableDuration": [
{
"meterType": "AzureIR",
"duration": 0.016666666666666666,
"unit": "DIUHours"
}
]
},
"durationInQueue": {
"integrationRuntimeQueue": 22
}
}
在我的第二次查找中,我使用以下表达式
Update saleslt.customer set somecol=someval where CustomerID=@{activity('Lookup1').output.Value[0]['Min']}
选择 1 作为虚拟
只是我们必须使用前面提到的索引访问查找输出并将活动输出放在 {} 中。
推荐阅读
- python - 如何在线程运行 Python selenium 时从 Tkinter 关闭线程
- docker - Google App 引擎 32MB 最大请求大小限制 - 如何上传大文件?
- c - Gtk。GtkScrolledWindow 未显示为 GtkStack 子项
- javascript - 单选按钮不会选中/取消选中
- javascript - 如何在 javascript 中制作和引用配置文件
- python - 无法在谷歌协作中的 tensorflow 中训练完整批次
- javascript - 如何使用 jQuery 删除脚本
- c# - EF Core 6 ThenInclude 引用错误
- javascript - JavaScript 中的语法 x:y 是什么意思?
- javascript - 按下 Enter 按钮后将光标保持在文本框上