在Talend中加载一组文件的策略 [英] Strategy to load a set of files in Talend

查看:91
本文介绍了在Talend中加载一组文件的策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在Talend中解决以下问题的最佳策略:

I want to know which is best strategy to aboard the following problem in Talend:

  • 我需要从一组分隔的文件中加载数据,这些文件存储在名称为(SAMPLE1.DAT,SAMPLE2.DAT,...,SAMPLEX.DAT)的目录中
  • 目标将是MySQL数据库中的表
  • 我必须一次加载所有数据,因为完成此任务后,我需要处理同一表中的所有记录

我有点困惑,因为我不知道塔伦德是否有可能.我看到的是tFileInputDelimited组件,但找不到解决方法.

I'm a bit confused because I don't know if it possible in Talend. I was seeing the tFileInputDelimited component but I didn't find the way to solve it.

谢谢

推荐答案

要从一个目录中读取多个文件,可以使用tFileList组件.它允许您指定目录和文件名模式.目录中与该模式匹配的所有文件都将被处理,一个接一个.

To read several files from one directory, you would use the tFileList component. It allows you to specify a directory and a file name pattern. All files in the directory matching the pattern will be processed, one after the other.

您需要使用tFileList组件到描述您要对每个文件执行的操作的组件的迭代"链接.在您的情况下,您将从tFileInputDelimited组件开始(读取文件),然后将其主要输出连接到tMysqlOutput组件.默认情况下,MySQL组件只会将数据追加到现有表中,这样就可以为您提供所需的结果.

You need to use an "Iterate" link from the tFileList component to those components that describe what you want to do with each file. In your case, you would start with a tFileInputDelimited component (read the file) and connect the main output of that to a tMysqlOutput component. The MySQL component will, by default, just append the data to an existing table, so that should get you the result you want.

在tFileInputDelimited组件中,您将不使用固定文件名,而是使用由tFileList组件为每次迭代设置的变量文件名(可以说是循环变量).该循环变量的名称通常可以在工作室的概述"视图中看到,通常在左下角.

In the tFileInputDelimited component, you would not use a fixed filename, but a variable filename which is set by the tFileList component for each iteration (your loop variable, so to speak of). The name of that loop variable can be seen in the "outline" view in the studio, usually in the bottom left corner.

这篇关于在Talend中加载一组文件的策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆