[英]Data Factory V2 Query Azure Table Storage but use a lookup Value
I have a SQL watermark table which contains the last date in my destination table我有一个 SQL 水印表,其中包含目标表中的最后一个日期
My source data is coming from an Azure Storage Table and the date time is a string我的源数据来自 Azure 存储表,日期时间是一个字符串
I set up the date time in the watermark table to match the format in the Azure table storage我在水印表中设置日期时间以匹配 Azure 表存储中的格式
I create a lookup and a copy task我创建了一个查找和一个复制任务
If I hard code the date into the Query for source and run this works fine CreatedAt ge '2019-03-06T14:03:11.000Z'如果我将日期硬编码到 Query for source 中并运行此工作正常 CreatedAt ge '2019-03-06T14:03:11.000Z'
But obviously I dont want to hard code this value.但显然我不想硬编码这个值。 I want to use the date from the lookup
我想使用查找中的日期
But when I replace the hardcoded date with the lookup value但是当我用查找值替换硬编码日期时
CreatedAt ge 'activity('LookupWatermarkOld').output' CreatedAt ge 'activity('LookupWatermarkOld').output'
I get an error我收到一个错误
{
{
"errorCode": "2200","errorCode": "2200",
"message":"ErrorCode=FailedStorageOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A storage operation failed with the following error 'The remote server returned an error: (400) Bad Request.'.,Source=, ''Type=Microsoft.WindowsAzure.Storage.StorageException,Message=The remote server returned an error: (400) Bad Request., Source=Microsoft.WindowsAzure.Storage,StorageExtendedMessage=Syntax error at position 42 in 'CreatedAt ge 'activity('LookupWatermarkOld').output''.\\nRequestId:8c65ced9-b002-0051-79d9-d41d49000000\\nTime:2019-03-07T11:35:39.0640233Z,,''Type=System.Net.WebException,Message=The remote server returned an error: (400) Bad Request.,Source=Microsoft.WindowsAzure.Storage,'","message":"ErrorCode=FailedStorageOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=存储操作失败,出现以下错误'远程服务器返回错误:(400) 错误请求。'.,Source =, ''Type=Microsoft.WindowsAzure.Storage.StorageException,Message=远程服务器返回错误:(400) 错误请求。, Source=Microsoft.WindowsAzure.Storage,StorageExtendedMessage=“CreatedAt ge”中位置 42 处的语法错误activity('LookupWatermarkOld').output''.\\nRequestId:8c65ced9-b002-0051-79d9-d41d49000000\\nTime:2019-03-07T11:35:39.0640233Z,,''WebType,System.Net.远程服务器返回错误:(400) Bad Request.,Source=Microsoft.WindowsAzure.Storage,'",
"failureType": "UserError","failureType": "用户错误",
"target": "CopyMentions"“目标”:“复制提及”
}}
Can anyone help me with this?谁能帮我这个? How do you use the Lookup value in a Azure Table query?
如何在 Azure 表查询中使用 Lookup 值?
check this out:看一下这个:
1) Lookup activity. 1) 查找活动。 Query field:
查询字段:
SELECT MAX(WatermarkColumnName) as LastId FROM TableName;
SELECT MAX(WatermarkColumnName) as LastId FROM TableName;
Also, make sure that you checked "First row only" option.另外,请确保您选中了“仅限第一行”选项。
2) In Copy Data activity use query. 2) 在复制数据活动中使用查询。 Query field:
查询字段:
@concat('SELECT * FROM TableName as s WHERE s.WatermarkColumnName > ''', activity('LookupActivity').output.firstRow.LastID, '''')
@concat('SELECT * FROM TableName as s WHERE s.WatermarkColumnName > ''', activity('LookupActivity').output.firstRow.LastID, '''')
Finally I got some help on this and it works with最后我得到了一些帮助,它适用于
CreatedAt gt '@{activity('LookupWatermarkOld').output.firstRow.WaterMarkValue}' CreatedAt gt '@{activity('LookupWatermarkOld').output.firstRow.WaterMarkValue}'
the WaterarkValue is the column name from the SQL Lookup table WaterarkValue 是 SQL 查找表中的列名
The Lookup creates an array so you have to specify the FirstRow from this array Lookup 创建一个数组,因此您必须从该数组中指定 FirstRow
And wrap in '' so its used as a string value并包裹在 '' 中,以便将其用作字符串值
--For recent ADFv2 --对于最近的 ADFv2
Use the watermark/lookup/output value in parameter.使用参数中的水印/查找/输出值。
Example: ParamUserCount = @{activity('LookupActivity').output.count}
示例:
ParamUserCount = @{activity('LookupActivity').output.count}
or for output function或用于输出功能
and you can use it in query as你可以在查询中使用它作为
Example: "select * from userDetails where usercount = {$ParamUserCount}"
示例:
"select * from userDetails where usercount = {$ParamUserCount}"
make sure you enclose the query in " " to set as string and parameter in query should be enclosed in { }确保将查询括在“”中以设置为字符串,并且查询中的参数应括在 {} 中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.