我有excel文件中的数据,我想插入数据库表。其中一列(名称)与db中的另一个表连接。我想根据excel中的值进行简单查询,并将表中只放入id。
excel文件样本:
age name position
------- ------- -------
23 Kate PWN
36 John TDF
db的表样本:
id name
------- -------
1 Kate
2 John
我想从excel中放入数据的表:
id name_id position
------- ------- -------
1 1 PWN
2 2 TDF
基本上我需要从excel文件中获取数据,迭代并进行简单的查询
SELECT (id) FROM name WHERE name = name_from_excel;
然后我可以将id放入tMap中的正确字段。
您可以通过Talend中的简单连接来完成此操作:
DB Input
|
|
tFileInputExcel -- tMap -- DB Output
在tMap中,您可以使用表中的Name列连接excel中的列Name,并在目标DB中插入所需的列