Also if you want to make sure that x = db(~db.languages.id.belongs(db()._select(db.words.lang, distinct=True))).select()
is not working on gae, here is traceback from gae logs Traceback (most recent call last): File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/restricted.py", line 188, in restricted exec ccode in environment File "/base/data/home/apps/visuallingua/2.348005112605606701/applications/init/controllers/manage.py:clean", line 51, in <module> File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/globals.py", line 95, in <lambda> self._caller = lambda f: f() File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/tools.py", line 2297, in f return action(*a, **b) File "/base/data/home/apps/visuallingua/2.348005112605606701/applications/init/controllers/manage.py:clean", line 37, in clean File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/dal.py", line 4511, in select return self.db._adapter.select(self.query,fields,attributes) File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/dal.py", line 2677, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/dal.py", line 2637, in select_raw filters = self.expand(query) File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/dal.py", line 2550, in expand return expression.op(expression.first) File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/dal.py", line 2613, in NOT raise SyntaxError, "Not suported %s" % first.op.__name__ SyntaxError: Not suported BELONGS