i have table , table b.
table b has relationship with key a_id
.
i created document in in table a. i'm wondering how insert data in single query using doc in table b foreign key a.
r.db('db').table('b').insert([{ 'b_data': ..., 'a_id': r.db('db').table('a').filter(r.row['name'] == 'some_name') } p in a]).run(conn)
you on right track, reql differs logic of sql in more flow. query needs start source of data can flow insert portion. here version of think want (in python format):
r.db('db').table('a').filter({'name':'some_name}).for_each( r.db('db').table('b').insert( {'name':r.row['name'],'b_data':'something'} ) ).run(conn)