stripe-archive / mosql

MongoDB → PostgreSQL streaming replication
MIT License
1.62k stars 224 forks source link

Help!!! How to deal with embed list to postgres by using mosql?eg:cus.utm.utm_source #22

Open HAPPYY opened 11 years ago

HAPPYY commented 11 years ago
  1. mongo's table
    table: cus
    column: utm
    embed column: utm_source
    etc:

db.cus.findOne(); { "status" : 5, "assign_status" : 1, "insure_for" : "s", "email" : "", "payment_scope" : null, "sex" : 1, "has_social_insure" : null, "updated_at" : ISODate("2013-05-14T08:27:06.400Z"), "created_at" : ISODate("2013-05-14T07:16:48.239Z"), "utm" : { "utm_source" : null, "utm_medium" : "organic", "utm_campaign" : "product", "utm_term" : null, "utm_content" : "floatlink_bottom(detail)", "ab_version" : "B Version", "_id" : 13659 }, "_id" : 13663 }

2.collections.yml

mongodb: cus: :columns:

lucasmartins commented 11 years ago

You have to either create another table to map that embedded attribute or - which I think is easier - create a text column to store as JSON (that won't be useful if you need to use the data for SQL data analysis).

Sorry I can't be of more help...

HAPPYY commented 11 years ago

Thanks for help, we have already tried these methods what you said. (1).i created another table but how can i relate two tables when there aren't reference id? (2).create a text column it's really hard to group by some embedded attribute ,i have to join similar sq l sentences ,I can analysis simple situations but can't dig deep information...

hope more guys come here to discuss this question~

frankliu747 commented 11 years ago

mongodb: cus: :columns:

shaneog commented 10 years ago

This doesn't work for me. Is there any way of dealing with multiple embeds yet?

tirdadc commented 9 years ago

More documentation / examples of this being done would be welcome, at this point it seems like I'd be better off with manual migrations given the number of embedded models I have.