使用变量内容查询SQL源 [英] Use content of variable for querying SQL source
问题描述
大家好!
Hello everyone!
我在Azure Data Factory中设置管道,我遇到以下问题:
I am setting up a pipeline in Azure Data Factory and I have the following problem:
我想过滤SQL-Source查询中的Run-ID,我用于复制数据活动。我有一个带有管道的表 - RunIds,我想使用当前的RunId来过滤它。到目前为止,我尝试了以下内容:
- 选择[...]其中sysRunID = @pipeline()。RunId
I would like to filter for the Run-ID within the query of an SQL-Source, that I am using for a Copy Data activity. I have a table with the pipeline-RunIds and I want to use the current RunId to filter it. So far I tried the following:
- select [...] where sysRunID = @pipeline().RunId
..失败了。然后我设置一个名为sysRunID的变量(类型:字符串)并尝试使用其内容:
- 选择[...]其中sysRunID = @variables('sysRunID')。值
- 选择[...]其中sysRunID = @activity('Set Variable1')。value
.. which failed. Then I set a variable (type: string) called sysRunID and tried to use its content:
- select [...] where sysRunID = @variables('sysRunID').value
- select [...] where sysRunID = @activity('Set Variable1').value
...但它也失败了。错误消息告诉我,我必须声明一个标量变量(我以为我做过)。有人可以帮助我吗?
谢谢你和BR!
$
Rob
...but it also failed. The error message tells me, that I must declare a scalar variable (which I thought I did). Can someone help me?
Thank you and BR!
Rob
推荐答案
你好Rob,
请确保只在设置变量活动后才执行复制活动(使用变量的地方)。这可确保复制活动依赖于setVariable活动,并且活动以正确的
顺序执行。
Please make sure that the copy activity(where you are using the variable) is being executed only after the Set Variable Activity. This ensures that the copy activity has a dependency on the setVariable activity and the activities are executed in the right sequence.
此外,我找到了一个博客,可以帮助您了解更多关于如何使用变量,请看一下:
Also I found a blog which will help you understand more about how to use variables, please have a look at this :
http://www.aussierobsql.com/azure-data-factory-v2-variables/
http://www.aussierobsql.com/azure-data-factory-v2-variables/
如果这有帮助,请告诉我们。另外,我们可以继续深入研究。
Let us know if this helps. Else we can continue to dive deeper.
这篇关于使用变量内容查询SQL源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!