Azure 数据工厂 V2 更新 SQL 条记录

Azure Data Factory V2 update an SQL record

我想在 Azure Data Factory Copy Activity 中更新 mysql 数据库中的值。基本上,我想更新与文件复制记录对应的列,类似于下面的示例

UPDATE database.filetable
set database.filetable.file_date = '@{utcNow()}'
WHERE database.filetable.file_id = 'xyz'

可能吗?什么是正确的方法。当这个逻辑我得到一个错误:

'Source' 端发生故障。 ErrorCode=InvalidParameter,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=属性 'schema' 的值无效:'Value cannot be null. Parameter name: schema'.,Source=,''Type=System.ArgumentNullException,Message=Value cannot be null. Parameter name: schema,Source=Microsoft.DataTransfer.ClientLibrary,'

数据工厂参数不支持 expression/function。我建议您使用变量和 set variable active 来实现。

例如:

然后把变量传给你的copy active,查询选项动态内容像这样:

@concat('UPDATE database.filetable set database.filetable.file_date =',variables('current_date'),'  
WHERE database.filetable.file_id = xyz')

HTH.