问题描述
我在sql server中有一个简单的客户表,其中包含2列-客户名称和城市.在Azure数据工厂中,如何将该表导出到多个csv文件中,每个文件将仅包含来自同一城市的客户端列表,这将是文件名
I have a simple clients table in sql server that contains 2 columns - client name and city. In Azure Data Factory, how can I export this table to multiple csv files that each file will contain only a list of clients from the same city, which will be the name of the file
我已经尝试并成功使用 lookup和foreach 将其拆分为不同的文件,但是数据仍然没有被城市过滤
I already tried, and succeeded, to split it to different files using lookup and foreach, but the data remains unfiltered by the city
有人有任何想法吗?
推荐答案
您需要遵循以下流程图:
You would need to follow the below flow chart:
- 查找活动:查询:从表格中选择不同的城市
- 对于每个活动
输入:@activity('LookUp').output.value
a)复制活动i)来源:动态查询从t1中选择*,其中city = @ item().City
- LookUp Activity : Query : Select distinct city from table
- For each activity
Input :@activity('LookUp').output.value
a) Copy activityi) Source : Dynamic Query Select * from t1 where city=@item().City
这应根据需要为每个国家/地区生成单独的文件
This should generate separate files for each country as needed
步骤:1)
-
批处理作业可以是任意nbr个并行执行
The batch job can be any nbr of parallel executions
- 创建参数化数据集:
5)
结果:我有2个不同的实体,因此生成了2个文件.
Result: I have 2 different Entities, so 2 files are generated.
输入:
输出:
这篇关于如何从SQL Server表导出到Azure Data Factory中的多个csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!