Kettle 将 csv 数据加载到多个表中
我需要从包含混合数据的单个 csv 文件加载 2 个数据库表。我还想使用外键关系来维护父子关系。
下面是输入 csv 文件的示例,
<name>,<title>,<department>,<location>
John,Developer,IT, Florida
Mike,Designer,Sales,Nevada
Chris,Designer,Sales,Nevada
下面是 2 个表结构。 Employee 表将 dept_id 作为外键。部门表将具有唯一的名称(不重复)。根据上面的 csv 示例,它应该有 2 个条目(IT、销售)。
DEPARTMENT
-------------
id
name
location
EMPLOYEE
---------
id
name
title
dept_id
我对使用 Kettle 完全陌生,任何指示将不胜感激。
I need to load 2 database tables from a single csv file containing mixed data. I also want to maintain parent child relations using foreign key relation.
Below is example of input csv file,
<name>,<title>,<department>,<location>
John,Developer,IT, Florida
Mike,Designer,Sales,Nevada
Chris,Designer,Sales,Nevada
And below are 2 table structures. Employee table has dept_id as foreign key. Department table will have unique names(no repetitions). According to above sample csv, it should have 2 entries(IT, Sales).
DEPARTMENT
-------------
id
name
location
EMPLOYEE
---------
id
name
title
dept_id
I am a completely new to using Kettle and any pointers would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很容易。您是否下载了 Spoon 并启动了它(用于创建转换的编辑器)
至于 ID,如果您愿意,您可以允许数据库将它们生成为自动编号字段 - 并根据任何独特要求进行查找。
我强烈建议下载该工具并试用 - 一旦开始使用就非常简单。
This is very easy. Have you downloaded spoon and started it up yet (The editor for creating transformations)
As for the ID's you can allow the database to generate those as autonumber fields if you like - and do the lookup on whatever the unique requirement is.
I strongly reccomend downloading the tool and having a play - it's so easy once you start.