简体   繁体   English

Azure 数据工厂。 使用存储源目标和查询的控制表将数据从源加载到目标

[英]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提取SQL SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table
StoredProc存储过程 Load_dimTable加载_dimTable

Columns

  • Source Schema and Table.源架构和表。
  • Target Schema and Table.目标架构和表。
  • SQL example SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table SQL 示例 SELECT Acol1, Acol2 AS Bcol1 FROM dim.Table
  • Stored Procedure.存储过程。 This copies the data from staging into a 'working' table.这会将暂存中的数据复制到“工作”表中。

创建一个 Foreach

Foreach 中的活动

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.

相关问题 Azure 数据工厂 - 在同一源表和目标表中更新或插入值 - Azure Data Factory- Updating or Inserting Values from and to the same source and target table 不从Azure数据工厂中的Azure表存储源加载所有列 - Not Loading all columns from Azure Table Storage Source in Azure Data Factory 在 Azure 数据工厂中,是否可以使用来自另一个源的列过滤复制活动的源查询? - In Azure Data Factory, is it possible to filter the Source query of a Copy Activity, using a column from another Source? 如何覆盖源表 azure 数据工厂 - How to overwrite source table azure Data factory 源选项中的 Azure 数据工厂递归查询 - Azure Data Factory Recursive Query in source option 将 Azure 数据工厂与来自 Microsoft Dynamics Marketing 的 Odata 源结合使用 - Using Azure data factory with Odata source from Microsoft Dynamics Marketing 如何根据源和目标的不同列名在 Azure 数据工厂中使数据流列映射动态化? - How can I make Data Flow column mapping Dynamic in Azure Data Factory based on different column names of Source and target? 用于源代码管理的 Azure 数据工厂链接 GitHub 存储库? - Azure Data Factory linking GitHub repository for Source Control? 如何为昨天的记录指定 Azure 数据工厂源(Azure 表存储)的查询 - How to specify query for Azure Data Factory Source (Azure Table Storage) for yesterday's records 如何使用 azure 数据工厂复制不在目标数据存储中的记录 - How to copy the records which are not in the target datastore using azure data factory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM