简体   繁体   English

使用ruby快速比较xml文件并将其保存到数据库

[英]Fast comparison xml files with ruby and saving to db

I'm looking for method for fast comparison xml files with ruby. 我正在寻找与ruby快速比较xml文件的方法。 I have 2 files (40MB), each about 100,000 rows. 我有2个文件(40MB),每个文件约100,000行。 Each element consists of 20 attributes. 每个元素包含20个属性。 Files obtained from different databases. 从不同数据库获得的文件。 I would like to compare them and find out what data has changed, to update them in the database.Tell me, what's going to help me? 我想比较它们,找出发生了什么数据更改,以便在数据库中更新它们。告诉我,什么对我有帮助?

With xml I've never worked, so in my head is an idea for comparison of each line (after the parsing and checking with the database). 使用xml我从未工作过,所以在我的脑海里是一个比较每一行的想法(在解析和检查数据库之后)。 But I think it is very slow. 但是我认为这很慢。

如果文件格式合理(每行等着装,请换行),则可以使用diff命令并解析输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM