如何从现有的单表数据库填充合理的多表 MySQL 数据库?
基本上有许多巨大的分隔文件,我知道我可以将它们作为表导入,但我需要将该数据映射到现有的合理多表 MySQL 数据库。与数据类型不应该有任何冲突,但我对此非常陌生,所以请指出我应该注意的任何内容。显然,在我知道它有效之前,我也不会在生产中运行它。
不能 100% 确定 stackoverflow 是询问数据库问题的正确位置,但我找不到任何其他更适合的 Stack Exchange。
发布了此问题 超级用户正在寻找一个 GUI 来执行此操作,但我准备编写代码,这样就可以完成工作。因此没有目标语言,只要求数据库是MySQL。
另外,发现了这个处理 MS-SQL 的 SSIS 的 stackoverflow Q/A(由于成本问题,我不打算使用它,但所面临的内容和问题与它出现的性质相同。)-- 使用保持外键关系的 SSIS 加载多个表
Basically have many huge delimited files that I know I can import as a table, but I need to map that data to an existing rational multi-table MySQL database. There should not be any conflict with datatypes, but I'm super new to this, so please point out anything I should be watching for. Clearly I'm not going to run this in production either until I know it works.
Not 100% sure stackoverflow is the right place to ask a database question, but I couldn't find any other Stack Exchange that was a better fit.
Posted this question on SuperUser looking for a GUI to do this, but I up for coding this is it gets the job done. As such there is no target language, just the requirement that the database be MySQL.
Also, found this stackoverflow Q/A that deals with MS-SQL's SSIS (which I'm not planning on using due to cost, but the content and issues faced are of the same nature it appears.) --
Loading Multiple Tables using SSIS keeping foreign key relationships
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 Pentaho Business Intelligence 包中的 ETL(提取翻译加载)工具。它有一点学习曲线,但它会完全满足您的需求。他们的 ETL 工具称为 Kettle,一旦掌握了它的窍门,它就会非常强大。
Pentaho 有两个版本,一个是免费试用的企业版,另一个是免费的社区版。社区版本的功能非常强大,但您也可以尝试一下企业版本。
这里有一些链接
Pentaho 社区版网站
Kettle 站点
Pentaho Enterprise 站点
更新:多个表输出
一个转型中的关键步骤将是组合查找更新。此步骤检查给定表以查看数据流中的记录是否存在,如果不存在则插入新记录。无论它是新记录还是旧记录,它都会将该记录中的关键字段附加到您的数据流中。当您继续操作时,您将在将数据导入相关表时使用这些键作为外键。
I'd suggest using the ETL(extract translate load) tool from the Pentaho Business Intelligence package. It's got a bit of a learning curve but it'll do exactly what you're looking for. Their ETL tool is called Kettle and it's extremely powerful once you get the hang of it.
There are two versions of Pentaho, an enterprise version that has a free trial, and a free community version. The community version is more than capable but you might give the enterprise version a test ride too.
Here's some links
Pentaho Community Edition Site
Kettle Site
Pentaho Enterprise Site
Update: Multiple table outputs
One of the key steps in your transformation is going to be a combination lookup-update. This step checks a given table to see if a record from your data-stream exists and inserts a new record if it does not. Regardless of whether it's a new or old record it's going to append the key field from that record into your data-stream. As you keep going you'll use these keys as foreign keys as you import data into related tables.