talend - 列值输出的文件名 [英] talend - filename of output from a column value

查看:37
本文介绍了talend - 列值输出的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一份现有的工作:

tDatabaseInput ->tMap ->tOutputDelimited

tDatabaseInput -> tMap -> tOutputDelimited

对于最后一个组件,我需要文件的文件名基于名为 TYPE 的列之一(每一行始终相同).名为 TYPE 的列的值为A1",这对于数据库中的所有记录都是相同的.

For the last component, I'll be needing the filename of the file to be based from one of the columns named TYPE (which is always the same for every row). The value for the column named TYPE is 'A1' which is the same for all the records in the database.

提前致谢

推荐答案

有很多方法可以做到,但这里是最简单、更易读的工作:

There is many ways to do it, but here is the simplest and more readable job :

  • tMySqlConnection_1:获取到数据库服务器的连接

  • tMySqlConnection_1 : Get a connection to the data base server

tMysqlInput_1:查询表并只得到这样的值:

tMysqlInput_1: Query the table an get only the value like this :

  select TYPE from my_table limit 1

  • tSetGlobalVar_1 : key = "file_name", value = (String)row1.type

    tMysqlInput_2 : 根据需要查询表

    tMysqlInput_2 : uqery the table as required

    tMap_1:映射您的数据

    tMap_1 : map your data

    tFileOutputDelimited_1 : filename = C:\\Users\\KKL\\Desktop\\"+((String)globalMap.get(file_name"))

    tFileOutputDelimited_1 : filename = "C:\\Users\\KKL\\Desktop\\"+((String)globalMap.get("file_name"))

    这篇关于talend - 列值输出的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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