0

I have 3 tables t1, t2, and t3 on RethinkDB

Each document (d) in t1 has 7 keys (k) and associated values. t1 looks like :

{"key1": ["valued1k1t1"], "key2": ["valued1k2t1"], "key3": ["valued1k3t1"] , "key4": ["valued1k4t1"] ,"id": "UUIDd1t1", "key5": ["valued1k5t1"], "key6": ["valued1k6t1], "key7": "valued1k7t1"}
{"key1": ["valued2k1t1"], "key2": ["valued2k2t1"], "key3": ["valued2k3t1"] , "key4": ["valued2k4t1"] ,"id": "UUIDd2t1", "key5": ["valued2k5t1"], "key6": ["valued2k6t1], "key7": "valued2k7t1"}
...

t2 has the same structure :

{"key1": ["valued1k1t2"], "key2": ["valued1k2t2"], "key3": ["valued1k3t2"] , "key4": ["valued1k4t2"] ,"id": "UUIDd1t2", "key5": ["valued1k5t2"], "key6": ["valued1k6t2], "key7": "valued1k7t2"}
...

and t3 also :

{"key1": ["valued1k1t3"], "key2": ["valued1k2t3"], "key3": ["valued1k3t3"] , "key4": ["valued1k4t3"] ,"id": "UUIDd3t3", "key5": ["valued1k5t3"], "key6": ["valued1k6t3], "key7": "valued1k7t3"}
...

I'd like to create a table t4 that would look like that :

{"key1": ["valued1k1t1"], "key2": ["valued1k2t1"], "key3": ["valued1k3t1"] , "key4": ["valued1k4t1"] ,"id": "UUIDd1t1", "key5": ["valued1k5t1"], "key6": ["valued1k6t1], "key7": "valued1k7t1"}
{"key1": ["valued2k1t1"], "key2": ["valued2k2t1"], "key3": ["valued2k3t1"] , "key4": ["valued2k4t1"] ,"id": "UUIDd2t1", "key5": ["valued2k5t1"], "key6": ["valued2k6t1], "key7": "valued2k7t1"}
...
{"key1": ["valued1k1t2"], "key2": ["valued1k2t2"], "key3": ["valued1k3t2"] , "key4": ["valued1k4t2"] ,"id": "UUIDd1t2", "key5": ["valued1k5t2"], "key6": ["valued1k6t2], "key7": "valued1k7t2"}
...
{"key1": ["valued1k1t3"], "key2": ["valued1k2t3"], "key3": ["valued1k3t3"] , "key4": ["valued1k4t3"] ,"id": "UUIDd1t3", "key5": ["valued1k5t3"], "key6": ["valued1k6t3], "key7": "valued1k7t3"}
...

I use Python client driver, which query might do the job ?

4

1 回答 1

1

Ok, I found the solution. Suppose your tables are in a database called DB. Create a table t4 in DB and then do :

>> r.db("DB").table("t4").insert(r.db("DB").table("t1")).run()
>> r.db("DB").table("t4").insert(r.db("DB").table("t2")).run()
>> r.db("DB").table("t4").insert(r.db("DB").table("t3")).run()
于 2016-04-22T14:20:52.777 回答