x = db(~db.languages.id.belongs(db()._select(db.words.lang,
distinct=True))).select()
This works fine for sqllite on which I'm developing
But it doesn't work for appengine.
So I tried,
lst = db().select(db.words.lang, distinct=True).as_list()
lst = map(lambda x: x['lang'], lst)
x = reduce((lambda x, y: x|y), map((lambda x: db(~db.languages.id ==
x).select()), lst))
This gives me error. *OperationalError: near "DESC": syntax error*
*
*
But if I change ~db.languages.id == x to db.languages.id == x, then it works
(notice that I removed ~), but it's not what I want.
I need to negate the result.
Please help me to correctly do this.
----------------------------Full traceback----------------------------
Traceback (most recent call last):
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/restricted.py", line
188, in restricted
exec ccode in environment
File
"/home/kra/Evolve/Works/Python/web2py_vl/applications/init/controllers/manage.py",
line 54, in <module>
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/globals.py", line 95,
in <lambda>
self._caller = lambda f: f()
File
"/home/kra/Evolve/Works/Python/web2py_vl/applications/init/controllers/manage.py",
line 28, in clean
x = reduce((lambda x, y: x|y), map((lambda x: db(~db.languages.id ==
x).select()), lst))
File
"/home/kra/Evolve/Works/Python/web2py_vl/applications/init/controllers/manage.py",
line 28, in <lambda>
x = reduce((lambda x, y: x|y), map((lambda x: db(~db.languages.id ==
x).select()), lst))
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/dal.py", line 4511, in
select
return self.db._adapter.select(self.query,fields,attributes)
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/dal.py", line 1003, in
select
rows = response(sql)
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/dal.py", line 994, in
response
self.execute(sql)
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/dal.py", line 1067, in
execute
return self.log_execute(*a, **b)
File "/home/kra/Evolve/Works/Python/web2py_vl/gluon/dal.py", line 1064, in
log_execute
return self.cursor.execute(*a,**b)
OperationalError: near "DESC": syntax error
<class 'sqlite3.OperationalError'>(near "DESC": syntax error)