Does anyone know if there is a way to perform set difference (ie the
elements in set A that are not in set B) using database queries / DAL?
for example if you had some tables defined like this:
db.define_table('thing',
Field('name'))
db.define_table('owns',
Field('person', 'reference auth_user'),
Field('thing', 'reference thing'))
and you want to find a list of all the things that person X doesn't yet own.
The "easy" way would be to query for a set of all the "thing"s and then do
a separate query for all the "thing"s owned by person X, create python set
objects and use the set difference operator.
I'm wondering if there is a way to do this as a single db query?
Thanks!
Paul
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.