使用bash脚本中的sqlite将两个chrome历史文件合并为一个

使用bash脚本中的sqlite将两个chrome历史文件合并为一个,bash,sqlite,Bash,Sqlite,我每天都在生成一个新的chrome历史文件,我想从这些日常文件中选取两个,并将它们连接在一起,形成一个连续的历史文件 这两个历史文件不共享来自同一时间的任何相同数据,但基本转储和管道导入失败。我希望类似的文件可以合并而不会发生冲突,但我错了 sqlite3 History1 .dump | sqlite3 FullHistory 成功,因为FullHistory文件不存在 sqlite3 History2 .dump | sqlite3 FullHistory 错误。我将尝试列出每个错误中的

我每天都在生成一个新的chrome历史文件,我想从这些日常文件中选取两个,并将它们连接在一起,形成一个连续的历史文件

这两个历史文件不共享来自同一时间的任何相同数据,但基本转储和管道导入失败。我希望类似的文件可以合并而不会发生冲突,但我错了

sqlite3 History1 .dump | sqlite3 FullHistory
成功,因为FullHistory文件不存在

sqlite3 History2 .dump | sqlite3 FullHistory
错误。我将尝试列出每个错误中的一个,但实际上每行都有多个相同的错误

table meta already exists
UNIQUE constraint failed: meta.key
table downloads already exists
UNIQUE constraint failed: downloads.id
table downloads_url_chains already exists
UNIQUE constraint failed: downloads_url_chains.id, downloads_url_chains.chain_index
table downloads_slices already exists
table typed_url_sync_metadata already exists
table "urls" already exists
UNIQUE constraint failed: urls.id
table visits already exists
table visit_source already exists
table keyword_search_terms already exists
table segments already exists
UNIQUE constraint failed: segments.id
table segment_usage already exists
UNIQUE constraint failed: segment_usage.id
index urls_url_index already exists
visits_url_index already exists
index visits_from_index already exists
index visits_time_index already exists
index segments_name already exists
index segments_url_id already exists
index segment_usage_time_slot_segment_id already exists
index segments_usage_seg_id already exists
index keyword_search_terms_index1 already exists
index keyword_search_terms_index2 already exists
index keyword_search_terms_index3 already exists
我只是想创建一个文件,就像我让Chrome自己生成两天的历史文件一样

很明显,我对数据库没有实际的了解,我只想要一段代码,可以添加到bash脚本中,将这两个文件连接在一起


谢谢

您不能合并数据库转储,除非重新处理数据,了解模式,重新匹配表之间的索引引用。即使您成功地删除了重复的表创建语句,表中的数据也需要重新编制索引,所有索引引用都需要更新为相应的新值。当我认为一台计算机甚至不需要花费太多精力或时间来合并两个大约有400个条目的sqlite数据库时,这听起来像是一项艰巨的任务。除非你的意思是用手做,这不是我想要的。问题是怎么做,因为我不知道怎么做。我经常遇到这样的解决方案,但我对它们一无所知,因为我不知道自己在做什么。简单的解决方案看起来很有希望,但如果你把汽车粘在一起,它就不会成为一辆公共汽车。与粘合SQLite转储相同,它不会生成一个工作数据库。比如,如果您试图从多辆汽车中制造一辆公共汽车,您将不得不重新安排零件,删除重复项,合并两个数据库将需要您重新安排记录,修复索引和对索引的引用。现在,如果您想学习足够多的SQL,这是一种简单的语言,请检查SQLite DB表结构。您肯定会看到需要做什么来合并数据。这不是一项艰巨的任务,但需要一些参与,了解布局和工作。