简体   繁体   English

塔伦德tMSSQLInput

[英]Talend tMSSQLInput

I created a Talend MS Sql job using tMSQLInput_1 and inserted my own query. 我使用tMSQLInput_1创建了一个Talend MS Sql作业,并插入了自己的查询。 Below is example of my query. 以下是我的查询示例。

if  object_id('tempdb..#lang_guid')is not null 
    drop table #lang_guid;
  create table #lang_guid(
                patient_guid varchar(255)
               ,accountid varchar(255)
               );
   insert into #lang_guid

        select  c.customerid
               ,'0000001'
          from  customer c with(nolock)

  select patient_guid
        ,accountid

    from #lang_guid

The issue I'm having is the query pulls the patient_guid from the table but not the accountid I creating that on the fly in the temp table. 我遇到的问题是查询从表中拉出Patient_guid,而不是我在temp表中即时创建的accountid。 when i run the job in Talend it returns the patient_guid but I don't get any data back for the accountid. 当我在Talend中运行该作业时,它返回Patient_guid,但我没有获得该accountid的任何数据。 Have anyone seen this issue with Talend before and if so how do I fix it. 有没有人以前见过Talend的这个问题,如果是的话,我该如何解决。

在tMssqlInput中,如果单击Guess模式,则可以看到从查询中检测到哪些列。

Did you define the corresponding schema ? 您是否定义了相应的架构? In Talend, when using an input component (a Database or any other input), you have to define a schema by clicking on ..., in the component view of tMSSQLInput. 在Talend中,使用输入组件(数据库或任何其他输入)时,必须在tMSSQLInput的组件视图中通过单击...来定义模式。

You should have two defined columns in your case. 在这种情况下,您应该有两个定义的列。

Make sure that for every input, the right talend Schema is defined. 确保为每个输入定义了正确的策略架构。

检查tMssqlInput组件(针对fetch查询定义)上的架构是否包含两列。

单击查询框上方的Guess模式或单击编辑模式并定义您的模式,或者您可以查看下面提供的Talend文档https://www.talendforge.org/tutorials/tutorial.php?idTuto=11&nbrFields= 10&validate = true

Here are the steps you need to follow: 这是您需要遵循的步骤:

  • You need to write the exact query to fetch the fields you seek, in your case it may be select patient_guid, accountid from customer c with(nolock) 您需要编写确切的查询来获取您要查找的字段,在这种情况下,可以select patient_guid, accountid from customer c with(nolock)
  • Then you have to click guess schema to populate metadata for the component. 然后,您必须单击猜测模式以填充组件的元数据
  • You can check the fields by clicking Edit Schema button in component view. 您可以通过在组件视图中单击“ 编辑架构”按钮来检查字段。
  • Then connect it to tLogRow to see whether your intended data is coming or not. 然后将其连接到tLogRow以查看是否要输入预期的数据。
  • Other wise, simply write the query Select * from customer c with(nolock) -> Guess Schema -> Connect it with tLogRow and see which field your data is coming from -> then add tFilterColumn to pick your choice of fields and process the data further. Select * from customer c with(nolock) ,只需编写查询Select * from customer c with(nolock) -> Guess Select * from customer c with(nolock) ->将其与tLogRow连接,然后查看数据来自哪个字段->然后添加tFilterColumn来选择您选择的字段并处理数据进一步。

I hope I was helpful, please provide your feedback. 希望对您有所帮助,请提供您的反馈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM