adewes / blitzdb

Blitz is a document-oriented database for Python that is backend-agnostic. It comes with a flat-file database for JSON documents and provides MongoDB-like querying capabilities.
http://blitzdb.readthedocs.org
MIT License
330 stars 37 forks source link

Merge two databases? #62

Open wmayner opened 8 years ago

wmayner commented 8 years ago

Suppose I've created two different filesystem-backed databases. Is there a preferred, sanctioned way of merging them into one?

Thanks for this, it fills a useful niche!

adewes commented 8 years ago

Actually there isn't right now, if your two databases are not extremely large the simplest way would be to simultaneously open them and copy the documents from one to the other.

Alternatively, you could possibly also copy the document files and rebuild the indexes for each collection using rebuild_indexes, although I don't have any reliable test data on this so if you go down this route make sure to make a backup copy of your data first.

wmayner commented 8 years ago

Ok, that's what I figured, but I'll look into rebuild_indexes. Thanks!