[web2py] Posgresql-query - DAL
The postgresql equivalent is: select * from gr02 where service_provider in (7, 10) I have tried: isps = (7,10) tb = 'gr02' data = db('%s.service_provider in (%s)' % (tb,isps)).select() Traceback (most recent call last): File console, line 1, in module File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 3295, in select rows = response(query) File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 3290, in response db._execute(query) File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 1035, in lambda self._execute = lambda *a, **b: self._cursor.execute(*a, **b) ProgrammingError: arguments of row IN must all be row expressions LINE 1: updated_by FROM gr02 WHERE gr02.service_provider in ((7, 10... ^ So how do I do it in DAL? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Posgresql-query - DAL
db(db.gr02.service_provider.belongs([7,10])).select() -- Thadeus On Tue, Dec 14, 2010 at 2:38 PM, Johann Spies johann.sp...@gmail.comwrote: The postgresql equivalent is: select * from gr02 where service_provider in (7, 10) I have tried: isps = (7,10) tb = 'gr02' data = db('%s.service_provider in (%s)' % (tb,isps)).select() Traceback (most recent call last): File console, line 1, in module File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 3295, in select rows = response(query) File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 3290, in response db._execute(query) File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 1035, in lambda self._execute = lambda *a, **b: self._cursor.execute(*a, **b) ProgrammingError: arguments of row IN must all be row expressions LINE 1: updated_by FROM gr02 WHERE gr02.service_provider in ((7, 10... ^ So how do I do it in DAL? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Posgresql-query - DAL
On 14 December 2010 23:02, Thadeus Burgess thade...@thadeusb.com wrote: db(db.gr02.service_provider.belongs([7,10])).select() Thanks. Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a