Migrating from DatabaseSelect to
tDBInput with multiple inputs
Update your Job and multi-input map to replace the deprecated
DatabaseSelect function with tDBInput
components.
Before you begin
You have a Job containing a tHMap with multiple inputs that use
DatabaseSelect functions.
You have created a connection to your database in
Talend Studio. For more information, see Setting up a database connection. Make
sure that the schema is identical to the structure used in your map.
About this task
In this example, you have a simple Job with a tHMap that
selects data from two database tables containing company information, and maps it to
an XML structure. Then, a tFileOutputRaw writes the result to
an XML file. The Job looks like this:
The map used in the tHMap looks like this:
The goal of this example is to remove the deprecated
DatabaseSelect function and keep the same behavior
for the Job.
Procedure
Drag and drop your input database tables from Metadata > Db Connections in your Job, before the tHMap.
Select tDBInput when prompted, then click
OK.
Link the tDBInput components to your
tHMap using Row > Main connections.
Information noteImportant: The database tables must be linked in the same order
as in the input structure used in the map. In this example, the first
table under root is employees and the second one is
departments. To make the map work correctly, you
need to link the employees component first, then the
departments component.
Optional: If needed, double-click the tDBInput components and
update the query to match the filters used in the
DatabaseSelect function.
In the Mapping perspective, expand the
Representations folder under all the database table
structures used as input in your map.
If there is a Map representation, you can go to
the next step.
If there is no Map representation, right-click
Representations and click New
Map.
Open the map used in your Job and click Database on the
Input side, then click Clear
and click OK to remove the representation.
Remove the DatabaseSelect functions in the input
structure.
They can be either on the element corresponding to the name of the
database table or on the Row loop, in the
IO/Database tab.
Click the root element for each table in the input structure,
employees and departments in this example,
and add a ReadURL function in the
IO/Database tab.
Double-click the ReadURL function, click the
[...] button next to the
Representation field and select
Map, then click OK.
Save your map and your Job.
Results
Your Job is now using tDBInput components instead of the
deprecated DatabaseSelect function. You can run the Job and you
should get the same result.
Information noteTip: You may need to close and reopen your Job to remove the error icon on
the tHMap.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!