I don't have an example in Python. I give JavaScript example and I think you can compare on API doc to write Python equivalent.
Assume that id
is also the primary key of finished_tasks
table.
r.table('tasks').filter(function(task) {
return r.table('finished_tasks').get(task('id')).eq(null)
})
If id
isn't primary key of finished_tasks
, let's create a secondary index for it, then use it in getAll
// Create index
r.table('finished_tasks').indexCreate('finished_task', r.row('id'))
// Using index for efficient query
r.table('tasks').filter(function(task) {
return r.table('finished_tasks').getAll(task('id'), {index: 'finished_task'}).count().eq(0)
})