开发者

how to migrate document oriented db to mysql

开发者 https://www.devze.com 2023-02-01 11:12 出处:网络
I can find all over 开发者_Python百科the web articles to migrate an existing MySQL database to a SimpleDB or CouchDB or what so ever.

I can find all over 开发者_Python百科the web articles to migrate an existing MySQL database to a SimpleDB or CouchDB or what so ever.

But If I go ahead and migrate my millions of records to Riak or CouchDB, is there any way to migrate back?

Would it be possible in theory to regenerate all the relations between my data that has no clear indexes to a relational database and regenerate all the relations?

Example: I have two tables in MySQL one is person and one is job, job is related to person - in one to one relationship.

If I switch that to couchDB, person document will have the job defined as text value for the key "job"

inserting this relation in couchDB is very simple from MySQL. Select.. combine then dump one person object.

Now, split one person object into two objects - and find the correct key for the certain job. How?

Any help is appreciated!


Here's my idea:

For the example, I'd start with looping through all records to create a list of jobs, then adding those to the jobs table. Then do a loop again, this time matching the 'job' in persons to the newly created job in mysql and fetching the id, adding that id in the person table 'jobid' foreign key field.

This way of analysing the data could probably be generalised in a script, but you would need to present it a 'translation' array or something, defining the relations.

To answer your question, yes, in theory it should be possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号