Kettle:想要将字符串值映射到另一个 table 的 id
Kettle: Want to map string value to id from another table
我想映射表 1 中具有以下结构的字符串:
Table1
id
value[string] (this can be repeated)
到表 2:
Table2
id
value_id
所以我创建了另一个表 3,其中我有与表 1 不同的值。
Table3
id
value(this is unique)
所以,这个映射的目的,是设置一个value_id而不是值,所以问题是,如何做到这一点?
改造如下:
'Table input' -> 'Database lookup' -> 'Table output'
Table 输入
select person_id, school_name 来自 Table1
数据库查询
- 查找table:Table2
- 查找值的键:school_name = school_name
- 从查找 table 到 return 的值:school_id
Table输出
- 目标 table:Table3
- 数据库字段:person_id、school_id
我想映射表 1 中具有以下结构的字符串:
Table1
id
value[string] (this can be repeated)
到表 2:
Table2
id
value_id
所以我创建了另一个表 3,其中我有与表 1 不同的值。
Table3
id
value(this is unique)
所以,这个映射的目的,是设置一个value_id而不是值,所以问题是,如何做到这一点?
改造如下: 'Table input' -> 'Database lookup' -> 'Table output'
Table 输入
select person_id, school_name 来自 Table1
数据库查询
- 查找table:Table2
- 查找值的键:school_name = school_name
- 从查找 table 到 return 的值:school_id
Table输出
- 目标 table:Table3
- 数据库字段:person_id、school_id