[英]Azure Data Factory. Loading data from Source to Target using a control table storing source target and query
I am having a brain freeze as I cannot remember how to create the following pipeline, and I know it's quite simple.我的大脑冻结了,因为我不记得如何创建以下管道,而且我知道这很简单。
I know this works as I created something like this previous, but it was nearly 2 years ago, and I've moved jobs so don't remember the method exactly.我知道这是因为我之前创建了类似的东西,但这是近 2 年前的事情,我已经换了工作,所以不记得确切的方法了。
I have created a table that has the following data, |我创建了一个包含以下数据的表,| ColumnName |
列名 | Data |
数据 | |:----------------|-------:|
|:----------------|-------:| |SourceSchemaName |
|源架构名称 | dim |
昏暗| |SourceTableName |
|源表名称 | Table |
表 | |TargetSchemaName |
|目标架构名称 | dw |
dw | |TargetTableName |
|目标表名称 | Table |
表 | |ExtractSQL |
|提取SQL | SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table |
SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table | |StoredProc |
|存储过程 | Load_dimTable |
Load_dimTable |
The query has to have the same column names as the target DB to work, I remember that bit.查询必须与目标数据库具有相同的列名才能工作,我记得那一点。 Then I use a look up to get this data from each table that needs the data.
然后我使用查找从需要数据的每个表中获取这些数据。 The query can also include a parameter if you want to limit this import.
如果您想限制此导入,查询还可以包含一个参数。
I should be able to use this query to do the copying data from within a foreach.我应该能够使用此查询从 foreach 中复制数据。 In the copy data, I have the Use Query selected and have @item().ExtractSQL, However when I try this I get an error 'Table is required for Copy Activity'.
在复制数据中,我选择了使用查询并使用了@item().ExtractSQL,但是当我尝试这个时,我收到一个错误“复制活动需要表”。
I was wondering if anyone else had used this method at all.我想知道是否还有其他人使用过这种方法。 I found it quite useful, now I can't remember how I got it to work.
我发现它非常有用,现在我不记得我是如何让它工作的。 It's so frustrating.
这太令人沮丧了。
Many thanks非常感谢
This was easier than I thought.这比我想象的要容易。 Though it take me a while to figure it out.
虽然我需要一段时间才能弄清楚。 But time can be a wonderful thing.
但时间可以是一件美妙的事情。
So in the Lookup activity in the Query I am selecting the columns of the table above... which looks rubbish, but it looks fine in the preview.因此,在查询中的查找活动中,我选择了上面表格的列...看起来很垃圾,但在预览中看起来不错。
ColumnName![]() |
Data![]() |
---|---|
SourceSchemaName![]() |
dim![]() |
SourceTableName![]() |
Table![]() |
TargetSchemaName![]() |
dw![]() |
TargetTableName![]() |
Table![]() |
ExtractSQL![]() |
SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table ![]() |
StoredProc![]() |
Load_dimTable![]() |
Columns列
My problem was the source wasn't set up correctly.我的问题是源设置不正确。 With the connection.
随着连接。 I required two parameters
我需要两个参数
Do the same in Sink but use the Targets...在 Sink 中做同样的事情,但使用目标......
Execute Stored Procedure use the link service and add the Stored Procedure name as '@item().LoadSproc'使用链接服务执行存储过程并将存储过程名称添加为“@item().LoadSproc”
As long as your control table is set up correctly and the stored procedure is correct.只要你的控制表设置正确,存储过程正确。 It works fine.
它工作正常。 I am using a merge in the stored procedure.
我在存储过程中使用合并。
Many thanks非常感谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.