如何在Talend中使用一个输入查询多个表?

时间:2020-11-28 00:56:15

For a simplified example, I have a DB2Input -> tMap -> DB2Output. In the DB2Input I wrote a query that takes data from two tables.

举一个简单的例子,我有一个DB2Input - > tMap - > DB2Output。在DB2Input中,我编写了一个从两个表中获取数据的查询。

I get the warning: Parameter(query): Schema is different from the query.

我收到警告:参数(查询):架构与查询不同。

Do I just need to specify one of the tables? Thanks.

我只需要指定其中一个表吗?谢谢。

UPDATE:

Well I think I got it. You click the 'edit schema' button and manually put in the columns your query selects.

好吧,我想我明白了。单击“编辑架构”按钮并手动放入查询选择的列。

3 个解决方案

#1


2  

Here's what I tend to do in those situations (only querying two tables) :

这是我在这些情况下倾向于做的事情(只查询两个表):

DB2Input --------
                -
               tMap ------- DB2Output
                -
DB2Input --------

In other words :

换一种说法 :

However, when you already have a complex made query, you can use one Input component like you're mentioning in your EDIT.

但是,当您已经有一个复杂的查询时,您可以使用一个输入组件,就像您在编辑中提到的那样。

In this case, you can press the "Guess query" button and Talend may succeed in detecting the result schema. For that, you will need to have the "built-in" schema option selected.

在这种情况下,您可以按“猜测查询”按钮,Talend可以成功检测结果模式。为此,您需要选择“内置”架构选项。

#2


1  

I think it will better for us to first create a view by writing complex query in database and then use that view in talend component as table to avoid creating multiple input and join's in talend :)

我认为通过在数据库中编写复杂查询然后在talend组件中使用该视图作为表来首先创建视图将更好,以避免在talend中创建多个输入和连接:)

#3


0  

If you have a non-repository query (manually entered/adjusted/whatever) and you get the "Schema is different than the query" warning, you can use the "guess schema" button. If the system is performing correctly, it should look at the fields you have in your query and give you an output schema to match them. You may have to adjust the field types if the system doesn't understand them.

如果您有非存储库查询(手动输入/调整/等等)并且您得到“模式与查询不同”警告,则可以使用“猜测模式”按钮。如果系统正常运行,它应该查看查询中的字段并为您提供输出模式以匹配它们。如果系统不理解它们,您可能必须调整字段类型。

I use this (writing my own input SELECT queries) a lot to control input from one db based on records in another db...

我使用它(编写我自己的输入SELECT查询)很多来控制来自一个数据库的输入基于另一个数据库中的记录...

#1


2  

Here's what I tend to do in those situations (only querying two tables) :

这是我在这些情况下倾向于做的事情(只查询两个表):

DB2Input --------
                -
               tMap ------- DB2Output
                -
DB2Input --------

In other words :

换一种说法 :

However, when you already have a complex made query, you can use one Input component like you're mentioning in your EDIT.

但是,当您已经有一个复杂的查询时,您可以使用一个输入组件,就像您在编辑中提到的那样。

In this case, you can press the "Guess query" button and Talend may succeed in detecting the result schema. For that, you will need to have the "built-in" schema option selected.

在这种情况下,您可以按“猜测查询”按钮,Talend可以成功检测结果模式。为此,您需要选择“内置”架构选项。

#2


1  

I think it will better for us to first create a view by writing complex query in database and then use that view in talend component as table to avoid creating multiple input and join's in talend :)

我认为通过在数据库中编写复杂查询然后在talend组件中使用该视图作为表来首先创建视图将更好,以避免在talend中创建多个输入和连接:)

#3


0  

If you have a non-repository query (manually entered/adjusted/whatever) and you get the "Schema is different than the query" warning, you can use the "guess schema" button. If the system is performing correctly, it should look at the fields you have in your query and give you an output schema to match them. You may have to adjust the field types if the system doesn't understand them.

如果您有非存储库查询(手动输入/调整/等等)并且您得到“模式与查询不同”警告,则可以使用“猜测模式”按钮。如果系统正常运行,它应该查看查询中的字段并为您提供输出模式以匹配它们。如果系统不理解它们,您可能必须调整字段类型。

I use this (writing my own input SELECT queries) a lot to control input from one db based on records in another db...

我使用它(编写我自己的输入SELECT查询)很多来控制来自一个数据库的输入基于另一个数据库中的记录...