如何在Talend open studio中基于MySQL表生成多格式文件?

How to generate multiple formatted files in Talend open studio based on MySQL tables?

我需要从 MYSQL 数据库中提取数据并根据数据创建格式化文件。我怎样才能通过 Talend open studio 做到这一点??

MySQL 数据库有一个 table(user_id、order_id、purchase_date),我需要为每个包含他的订单的用户生成 csv 文件.文件名应该有 user_id(输出文件可能像 user_id.csv)

谢谢

You can try below - 
tMysqlInput--->tFlowToIterate---(iterate)-->tMysqlInput--->tFileOutputDelimited

More details given below - 
tmysqlInput(select user_id from table group by user_id) --- row Main ---> tFlowToIterate (uncheck use the default key option, create a new key called user_id and set value to user_id in dropdown) ----- Iterate -----> tmysqlInput(sql = "select user_id, order_id,purchase_date from table where user_id=((String)globalMap.get("user_id))") ----- row main ----> tFileOutputDelimited(set filename = (String)globalMap.get("user_id))+".csv").

        to summarize - you first get list of all distinct user_id then you iterate through each of them and again fetch orders for each user_id by applying filter and use this user_id value from global variable into filename..