simonw/sqlite-utils

Ability to merge databases and tables

オープン

#491 opened on 2022/09/23

 (9 件のコメント) (3 件のリアクション) (0 人の担当者)Python (145 件のフォーク)github user discovery
cli-toolhelp wanted

Repository metrics

Stars
 (2,065 個のスター)
PR merge metrics
 (平均マージ 9h 52m) (30d で 7 merged PRs)

説明

Hi! Let me firstly say that I am a big fan of your work -- I follow your tweets and blog posts with great interest 😄.

Now onto the matter at hand: I think it would be great if sqlite-utils included a merge or combine command, with the purpose of combining different SQLite databases into a single SQLite database. This way, the newly "merged" database would contain all differently named tables contained in the databases to be merged as-is, as well a concatenation of all tables of the same name.

This could look something like this:

sqlite-utils merge cats.db dogs.db > animals.db

I imagine this is rather straightforward if all databases involved in the merge contain differently named tables (i.e. no chance of conflicts), but things get slightly more complicated if two or more of the databases to be merged contain tables with the same name. Not only do you have to "do something" with the primary key(s), but these tables could also simply have different schemas (and therefore be incompatible for concatenation to begin with).

Anyhow, I would love your thoughts on this, and, if you are open to it, work together on the design and implementation!

コントリビューターガイド