【问题标题】:Issue in Dynamic Job creation in TalendTalend 中的动态作业创建问题
【发布时间】:2017-05-09 21:24:17
【问题描述】:

我得到了这样的要求, 创建单个 Talend 作业,读取多个表并动态写入多个文件(当我们通过上下文变量提供表名时,作业应将该表作为 select * from tablename 并写入文件 tablename.txt)

我在 toracle 输入阶段给出的 oracle 查询-

"SELECT *  FROM '"+context.Table_Name+"'"

在上下文变量部分给出为

Table_Name-    String-   checked Prompt for value for dynamic table name

在我给出的 Oracle 表的元数据定义中

Type="dynamic" db type="varchar2"

面临的问题:

  1. 作业没有识别上下文变量

    ORA-00903: invalid table name
    Exception in component tOracleInput_1
    java.sql.SQLSyntaxErrorException: ORA-00903: invalid table name
    
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    

    但是当我对表名进行硬编码时,作业运行良好

  2. 我给出的目标文件路径

    "C:/Talend/OutputFIles/context.Table_Name.txt"
    

而不是打印上下文变量的值,我得到 context.Table_Name.txt 作为文件名!!!

请帮帮我

【问题讨论】:

    标签: talend talend-mdm


    【解决方案1】:

    您是否尝试删除表名周围的 '?
    试试这个:
    "SELECT * FROM " + context.Table_Name

    文件名构造也是如此,你应该写:
    "C:/Talend/OutputFIles/" + context.Table_Name + ".txt"

    更好的是,您应该有一个由上下文变量定义的路径名,给出:
    context.OutputPath + context.Table_Name + ".txt"

    TRF

    【讨论】:

    • 你太棒了!!完成的工作!再次感谢!:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多