Pentaho将uniqe记录导入数据库 [英] Pentaho Import uniqe records into database

查看:126
本文介绍了Pentaho将uniqe记录导入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Pentaho Spoon还是很陌生,我想将一个csv文件的记录导入数据库表。但是,仅唯一记录应导入数据库表中。这就是为什么我需要将EACH记录与数据库表的所有记录进行比较,以确定该记录是否应该导入。

I am quite new to Pentaho Spoon and I would like to import records of an csv file to an database table. However, only unique records should be imported into the database table. That is why I need to compare EACH record with all records of the database table in order to determine if the record should be imported or not.

到目前为止,我已经尝试了建议的CRUD模式如下:

So far, I tried out the suggested CRUD-pattern which looks like this:

如图片所示,我合并excel输入和表输入(忽略转换步骤。我需要转换一个值,因为它们在float格式方面有所不同:数据库格式为#.000000,而float的csv格式为#.0)

As you can see in the picture, I merge the excel input and the table input (ignore the cast-steps. I needed to cast a value because ther differed in the float format: database format was #.000000 and the csv format of float was #.0)

在合并联接之后,我比较标志(由合并行(diff)给出,如果比较的记录是新记录,则将它们导入数据库表,如果它们是

After the merge join, I compare the flag (which is given by the merge rows(diff) and if the compared records are new, I import them to the database table, if they are changed, I update the record and if they are deleted or identical, I simply do nothing. So far, so good.

但这是问题所在:如果我将记录csv-input-file的命令并重新运行转换,所有记录都被重新导入,因此,数据库表中有重复的记录(我想避免)。再次强调:解决此问题的正确方法是将csv-input-file的每一行与数据库表中的所有条目进行比较。

But here is the problem: If I shuffle the records of the csv-input-file and run the transformation anew, all the records are imported anew and consequently, there are duplicated in my database table (which I wanted to avoid). To emphasize again: The right way to solve this is that each row of the csv-input-file is compared with ALL entries in the database table.

我如何实现这个?有什么建议么?

How can I realize this? Any suggestions? Thank you so much in advance!!

推荐答案

您可以使用维度查找/更新控件,该控件提供的功能与您正在尝试实现。

You can use the 'Dimension lookup/update' control which provides the same functionality which you are trying to achieve.

谢谢,
尼罗河

Thanks, Nilesh

这篇关于Pentaho将uniqe记录导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆