[web2py] Re: Problem with DAL query self join
I do not not know but in the DAL query I see: db.tbl_objects.rlord In the original query I see tbl_objects.horid and tbl_alt_objects.rlord but not tbl_objects.rlord. I do not know the model but I suspect you simply have some typos. On Thursday, 20 September 2012 06:35:31 UTC-5, Pradeeshnarayan wrote: I am trying to convert the below sql query to DAL query. SQL query: SELECT L1_alt_obj.objid,L1_obj.objid FROM tbl_alt_objects JOIN tbl_objects on tbl_objects.horid = tbl_alt_objects.horid AND tbl_objects.objid = tbl_alt_objects.objid LEFT JOIN tbl_objects L1_obj ON L1_obj.horid = tbl_objects.horid AND L1_obj.objid = tbl_objects.rlord LEFT JOIN tbl_alt_objects L1_alt_obj ON L1_alt_obj.horid = tbl_objects.horid AND L1_alt_obj.objid = tbl_alt_objects.rlord WHERE tbl_alt_objects.horid=1076 AND tbl_alt_objects.objid=1 SQL is working fine and getting result +---+---+ | objid | objid | +---+---+ | 4 | 5 | +---+---+ DAL query: L1_obj = db.tbl_objects.with_alias('l1_obj') L1_alt_obj = db.tbl_alt_objects.with_alias('l1_alt_obj') query = (db.tbl_alt_objects.horid==1076) \ (db.tbl_alt_objects.horid==db.tbl_objects.horid) \ (db.tbl_objects.objid==1) (db.tbl_alt_objects.objid==db.tbl_objects.objid) result = db(query).select(L1_obj.objid,L1_alt_obj.objid, left=[ L1_obj.on((L1_obj.horid==horid) (db.tbl_objects.rlord == L1_obj.objid)), L1_alt_obj.on((L1_alt_obj.horid==horid) (L1_alt_obj.objid==db.tbl_alt_objects.rlord)) ] ).first() But I am getting an error as File /var/www/vhosts/astrozon/web2py/applications/astrozon/controllers/horoscope.py, line 104, in testing L1_alt_obj.on((L1_alt_obj.horid==horid) (L1_alt_obj.objid==db.tbl_alt_objects.rlord)) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 7578, in select return adapter.select(self.query,fields,attributes) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1315, in select rows = response(sql) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1305, in response self.execute(sql) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1392, in execute return self.log_execute(*a, **b) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1386, in log_execute ret = self.cursor.execute(*a, **b) File /var/www/vhosts/astrozon/web2py/gluon/contrib/pymysql/cursors.py, line 108, in execute self.errorhandler(self, exc, value) File /var/www/vhosts/astrozon/web2py/gluon/contrib/pymysql/connections.py, line 184, in defaulterrorhandler raise errorclass, errorvalue InternalError: (1054, uUnknown column 'tbl_objects.rlord' in 'on clause') --
[web2py] Re: Problem with DAL query self join
I have rechecked again. There is a valid field rlord in tbl_objects. You can see the field 'tbl_objects.rlord' in the 6th line of SQL query. SQL is working fine. In the error description I have noticed a difference. File /var/www/vhosts/astrozon/web2py/applications/astrozon/controllers/horoscope.py, line 104, in testing L1_alt_obj.on((L1_alt_obj.horid==horid) (L1_alt_obj.objid==db.tbl_alt_objects.rlord)) here it is showing the 104 line has problem. but the in last line InternalError: (1054, uUnknown column 'tbl_objects.rlord' in 'on clause'). it is telling the error is in field 'tbl_objects.rlord' which is in the previos line(103). I think it is a small syntax error. But I am unable to find out that. On Thursday, 20 September 2012 15:34:30 UTC+2, Massimo Di Pierro wrote: I do not not know but in the DAL query I see: db.tbl_objects.rlord In the original query I see tbl_objects.horid and tbl_alt_objects.rlord but not tbl_objects.rlord. I do not know the model but I suspect you simply have some typos. On Thursday, 20 September 2012 06:35:31 UTC-5, Pradeeshnarayan wrote: I am trying to convert the below sql query to DAL query. SQL query: SELECT L1_alt_obj.objid,L1_obj.objid FROM tbl_alt_objects JOIN tbl_objects on tbl_objects.horid = tbl_alt_objects.horid AND tbl_objects.objid = tbl_alt_objects.objid LEFT JOIN tbl_objects L1_obj ON L1_obj.horid = tbl_objects.horid AND L1_obj.objid = tbl_objects.rlord LEFT JOIN tbl_alt_objects L1_alt_obj ON L1_alt_obj.horid = tbl_objects.horid AND L1_alt_obj.objid = tbl_alt_objects.rlord WHERE tbl_alt_objects.horid=1076 AND tbl_alt_objects.objid=1 SQL is working fine and getting result +---+---+ | objid | objid | +---+---+ | 4 | 5 | +---+---+ DAL query: L1_obj = db.tbl_objects.with_alias('l1_obj') L1_alt_obj = db.tbl_alt_objects.with_alias('l1_alt_obj') query = (db.tbl_alt_objects.horid==1076) \ (db.tbl_alt_objects.horid==db.tbl_objects.horid) \ (db.tbl_objects.objid==1) (db.tbl_alt_objects.objid==db.tbl_objects.objid) result = db(query).select(L1_obj.objid,L1_alt_obj.objid, left=[ L1_obj.on((L1_obj.horid==horid) (db.tbl_objects.rlord == L1_obj.objid)), L1_alt_obj.on((L1_alt_obj.horid==horid) (L1_alt_obj.objid==db.tbl_alt_objects.rlord)) ] ).first() But I am getting an error as File /var/www/vhosts/astrozon/web2py/applications/astrozon/controllers/horoscope.py, line 104, in testing L1_alt_obj.on((L1_alt_obj.horid==horid) (L1_alt_obj.objid==db.tbl_alt_objects.rlord)) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 7578, in select return adapter.select(self.query,fields,attributes) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1315, in select rows = response(sql) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1305, in response self.execute(sql) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1392, in execute return self.log_execute(*a, **b) File /var/www/vhosts/astrozon/web2py/gluon/dal.py, line 1386, in log_execute ret = self.cursor.execute(*a, **b) File /var/www/vhosts/astrozon/web2py/gluon/contrib/pymysql/cursors.py, line 108, in execute self.errorhandler(self, exc, value) File /var/www/vhosts/astrozon/web2py/gluon/contrib/pymysql/connections.py, line 184, in defaulterrorhandler raise errorclass, errorvalue InternalError: (1054, uUnknown column 'tbl_objects.rlord' in 'on clause') --
[web2py] Re: Problem with DAL query self join
If you send me the models I wil try it. On Thursday, 20 September 2012 09:40:01 UTC-5, Pradeeshnarayan wrote: I have rechecked again. There is a valid field rlord in tbl_objects. You can see the field 'tbl_objects.rlord' in the 6th line of SQL query. SQL is working fine. In the error description I have noticed a difference. File /var/www/vhosts/astrozon/web2py/applications/astrozon/controllers/horoscope.py, line 104, in testing L1_alt_obj.on((L1_alt_obj.horid==horid) (L1_alt_obj.objid==db.tbl_alt_objects.rlord)) here it is showing the 104 line has problem. but the in last line InternalError: (1054, uUnknown column 'tbl_objects.rlord' in 'on clause'). it is telling the error is in field 'tbl_objects.rlord' which is in the previos line(103). I think it is a small syntax error. But I am unable to find out that. --
[web2py] Re: Problem slicing dal Rows
It appears that Python's __getslice__(self, a, b) overload has a surprising behavior. From http://docs.python.org/reference/datamodel.html#object.__getslice__: If negative indexes are used in the slice, the length of the sequence is added to that index. So when you evaluate rows[-20:], Python evaluates len(rows) (which is 13 in the above example), and calls: rows.__getslice__(-20+13, 2147483647) rather than: rows.__getslice__(-20, None) or rows.__getslice__(-20, 2147483647) as one might initially suspect. The Rows object just passes the received indices on to self.records, so you're getting a new Rows back containing records[-7:] - clearly not what you want!! SOLUTION: It turns out that __getslice__ is deprecated since Python 2.0, and that __getitem__ should be used instead. If __getslice__ is missing and a a slice is requested, __getitem__ receives a slice object. A proposed fix: - remove __getslice__ from Rows - replace __getitem__ with: def __getitem__(self, i): if isinstance(i, slice): return Rows(self.db, self.records[i], self.colnames) else: row = self.records[i] keys = row.keys() if self.compact and len(keys) == 1 and keys[0] != '_extra': return row[row.keys()[0]] return row I've done a bit of testing with this. It fixes the problem noted by Gene, and does not appear to break anything obvious. Cheers, Kevin
[web2py] Re: Problem slicing dal Rows
Can you please send me a patch as an attachment? On Mar 26, 3:13 pm, Kevin Ivarsen kivar...@gmail.com wrote: It appears that Python's __getslice__(self, a, b) overload has a surprising behavior. Fromhttp://docs.python.org/reference/datamodel.html#object.__getslice__: If negative indexes are used in the slice, the length of the sequence is added to that index. So when you evaluate rows[-20:], Python evaluates len(rows) (which is 13 in the above example), and calls: rows.__getslice__(-20+13, 2147483647) rather than: rows.__getslice__(-20, None) or rows.__getslice__(-20, 2147483647) as one might initially suspect. The Rows object just passes the received indices on to self.records, so you're getting a new Rows back containing records[-7:] - clearly not what you want!! SOLUTION: It turns out that __getslice__ is deprecated since Python 2.0, and that __getitem__ should be used instead. If __getslice__ is missing and a a slice is requested, __getitem__ receives a slice object. A proposed fix: - remove __getslice__ from Rows - replace __getitem__ with: def __getitem__(self, i): if isinstance(i, slice): return Rows(self.db, self.records[i], self.colnames) else: row = self.records[i] keys = row.keys() if self.compact and len(keys) == 1 and keys[0] != '_extra': return row[row.keys()[0]] return row I've done a bit of testing with this. It fixes the problem noted by Gene, and does not appear to break anything obvious. Cheers, Kevin
[web2py] Re: Problem slicing dal Rows
Note that __getslice__ is used in: dal.py (3 times), html.py and languages.py On Mar 26, 5:25 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you please send me a patch as an attachment?
[web2py] Re: Problem with DAL and Postgres
Your problem is that this: Field('password', 'password', '''length=512, ''', readable=False, label='Password'), should be Field('password', 'password', length=512, readable=False, label='Password'), On Feb 8, 2:36 am, Bernardo Botella Corbí estem...@gmail.com wrote: Hi Massimo, please find attached the output you asked for. I must say that it works using mysql. regards, Bernardo 2011/2/7 Massimo Di Pierro massimo.dipie...@gmail.com I am very puzzled. In gluon/dal.py there is this line: field.length = min(field.length,self._db and self._db._adapter.maxcharlength or INFINITY) can you print field.length before and field.length after this statement? Massimo On Feb 7, 3:06 am, Bernardo estem...@gmail.com wrote: Sure Massimo, here it goes: db.define_table(auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=128, default=''), Field('username', length=128, default=''), Field('email', length=128, default='', unique=True), Field('password', 'password', '''length=512, ''', readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('imagen', 'upload', requires=IS_IMAGE()), Field('texto_descriptivo', 'text'), Field('activado', 'boolean', default=True, readable=False, writable=False), Field('karma', 'double', default=0, readable=False, writable=False), Field('acepta_registro', 'boolean', requires=IS_IN_SET(['on'], error_message=T('You must accept the license terms.')), label=XML(T('I \'ve read and I accept the ') + A(T('license terms'), _href=URL('default', 'texto_registro'), _target='new'))) ) On 7 feb, 05:09, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you show your custom auth_user. I am still puzzled by the error. On Feb 6, 4:21 pm, Bernardo Botella Corbí estem...@gmail.com wrote: Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo output.txt 66KViewDownload
Re: [web2py] Re: Problem with DAL and Postgres
stop message services
Re: [web2py] Re: Problem with DAL and Postgres
Hi Massimo, tested like that, and still the same error. Bernardo 2011/2/8 Massimo Di Pierro massimo.dipie...@gmail.com Your problem is that this: Field('password', 'password', '''length=512, ''', readable=False, label='Password'), should be Field('password', 'password', length=512, readable=False, label='Password'), On Feb 8, 2:36 am, Bernardo Botella Corbí estem...@gmail.com wrote: Hi Massimo, please find attached the output you asked for. I must say that it works using mysql. regards, Bernardo 2011/2/7 Massimo Di Pierro massimo.dipie...@gmail.com I am very puzzled. In gluon/dal.py there is this line: field.length = min(field.length,self._db and self._db._adapter.maxcharlength or INFINITY) can you print field.length before and field.length after this statement? Massimo On Feb 7, 3:06 am, Bernardo estem...@gmail.com wrote: Sure Massimo, here it goes: db.define_table(auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=128, default=''), Field('username', length=128, default=''), Field('email', length=128, default='', unique=True), Field('password', 'password', '''length=512, ''', readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('imagen', 'upload', requires=IS_IMAGE()), Field('texto_descriptivo', 'text'), Field('activado', 'boolean', default=True, readable=False, writable=False), Field('karma', 'double', default=0, readable=False, writable=False), Field('acepta_registro', 'boolean', requires=IS_IN_SET(['on'], error_message=T('You must accept the license terms.')), label=XML(T('I \'ve read and I accept the ') + A(T('license terms'), _href=URL('default', 'texto_registro'), _target='new'))) ) On 7 feb, 05:09, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you show your custom auth_user. I am still puzzled by the error. On Feb 6, 4:21 pm, Bernardo Botella Corbí estem...@gmail.com wrote: Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo output.txt 66KViewDownload
[web2py] Re: Problem with DAL and Postgres
Sure Massimo, here it goes: db.define_table(auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=128, default=''), Field('username', length=128, default=''), Field('email', length=128, default='', unique=True), Field('password', 'password', '''length=512, ''', readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('imagen', 'upload', requires=IS_IMAGE()), Field('texto_descriptivo', 'text'), Field('activado', 'boolean', default=True, readable=False, writable=False), Field('karma', 'double', default=0, readable=False, writable=False), Field('acepta_registro', 'boolean', requires=IS_IN_SET(['on'], error_message=T('You must accept the license terms.')), label=XML(T('I \'ve read and I accept the ') + A(T('license terms'), _href=URL('default', 'texto_registro'), _target='new'))) ) On 7 feb, 05:09, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you show your custom auth_user. I am still puzzled by the error. On Feb 6, 4:21 pm, Bernardo Botella Corbí estem...@gmail.com wrote: Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo
[web2py] Re: Problem with DAL and Postgres
I am very puzzled. In gluon/dal.py there is this line: field.length = min(field.length,self._db and self._db._adapter.maxcharlength or INFINITY) can you print field.length before and field.length after this statement? Massimo On Feb 7, 3:06 am, Bernardo estem...@gmail.com wrote: Sure Massimo, here it goes: db.define_table(auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=128, default=''), Field('username', length=128, default=''), Field('email', length=128, default='', unique=True), Field('password', 'password', '''length=512, ''', readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('imagen', 'upload', requires=IS_IMAGE()), Field('texto_descriptivo', 'text'), Field('activado', 'boolean', default=True, readable=False, writable=False), Field('karma', 'double', default=0, readable=False, writable=False), Field('acepta_registro', 'boolean', requires=IS_IN_SET(['on'], error_message=T('You must accept the license terms.')), label=XML(T('I \'ve read and I accept the ') + A(T('license terms'), _href=URL('default', 'texto_registro'), _target='new'))) ) On 7 feb, 05:09, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you show your custom auth_user. I am still puzzled by the error. On Feb 6, 4:21 pm, Bernardo Botella Corbí estem...@gmail.com wrote: Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo
[web2py] Re: Problem with DAL and Postgres
Why is this line Field('password', 'password', '''length=512, ''', readable=False, label='Password'), should be Field('password', 'password', length=512, readable=False, label='Password'),
Re: [web2py] Re: Problem with DAL and Postgres
Dear Massimo, I've been busy today. I'll post it as soon as possible. thanks for your help, Bernardo 2011/2/7 Massimo Di Pierro massimo.dipie...@gmail.com I am very puzzled. In gluon/dal.py there is this line: field.length = min(field.length,self._db and self._db._adapter.maxcharlength or INFINITY) can you print field.length before and field.length after this statement? Massimo On Feb 7, 3:06 am, Bernardo estem...@gmail.com wrote: Sure Massimo, here it goes: db.define_table(auth.settings.table_user_name, Field('first_name', length=128, default=''), Field('last_name', length=128, default=''), Field('username', length=128, default=''), Field('email', length=128, default='', unique=True), Field('password', 'password', '''length=512, ''', readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('imagen', 'upload', requires=IS_IMAGE()), Field('texto_descriptivo', 'text'), Field('activado', 'boolean', default=True, readable=False, writable=False), Field('karma', 'double', default=0, readable=False, writable=False), Field('acepta_registro', 'boolean', requires=IS_IN_SET(['on'], error_message=T('You must accept the license terms.')), label=XML(T('I \'ve read and I accept the ') + A(T('license terms'), _href=URL('default', 'texto_registro'), _target='new'))) ) On 7 feb, 05:09, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you show your custom auth_user. I am still puzzled by the error. On Feb 6, 4:21 pm, Bernardo Botella Corbí estem...@gmail.com wrote: Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo
[web2py] Re: Problem with DAL and Postgres
Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo
Re: [web2py] Re: Problem with DAL and Postgres
Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo
[web2py] Re: Problem with DAL and Postgres
Can you show your custom auth_user. I am still puzzled by the error. On Feb 6, 4:21 pm, Bernardo Botella Corbí estem...@gmail.com wrote: Yes, the error is on my custom auth_user table. So, Do I reduce the leght numbers? Bernardo 2011/2/6 Massimo Di Pierro massimo.dipie...@gmail.com Do you have a custom auth_user table? Is seems to miss a length attribute and default to a number too large. I changed the default to 32768 in trunk but I am not sure. On Feb 6, 3:13 pm, Bernardo estem...@gmail.com wrote: Dear all, I am using web2py 1.91.6 and last version of Ubuntu. A model which works perfectly using sqlite database, throws an error when using a postgres database: ProgrammingError: syntax error at or near 100 LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100); posible bug in new DAL? Thanks a lot for your help, Bernardo
[web2py] Re: problem with dal
perhaps (db.actividades_riesgos.riesgos==riesgo) should be (db.actividades_riesgos.riesgos==riesgo.first().id) On Jan 15, 5:24 am, luifran lbernalhernan...@yahoo.es wrote: db.define_table('actividades_riesgos',Field('actividades',db.actividades),F ield('riesgos',db.riesgos)) actividad=db(db.actividades.nombre==request.args(0)).select(db.actividades. id) riesgo=db(db.riesgos.nombre==request.args(1)).select(db.riesgos.id) record = db((db.actividades_riesgos.actividades==actividad) (db.actividades_riesgos.riesgos==riesgo)).select().first() The last line show the next error: TypeError: int() argument must be a string or a number, not 'Rows' //
[web2py] Re: problem with dal
Thank you, I've fixed it with: actividad_id=actividad[0].id riesgo_id=riesgo[0].id On 15 ene, 12:45, Massimo Di Pierro massimo.dipie...@gmail.com wrote: perhaps (db.actividades_riesgos.riesgos==riesgo) should be (db.actividades_riesgos.riesgos==riesgo.first().id) On Jan 15, 5:24 am, luifran lbernalhernan...@yahoo.es wrote: db.define_table('actividades_riesgos',Field('actividades',db.actividades),F ield('riesgos',db.riesgos)) actividad=db(db.actividades.nombre==request.args(0)).select(db.actividades. id) riesgo=db(db.riesgos.nombre==request.args(1)).select(db.riesgos.id) record = db((db.actividades_riesgos.actividades==actividad) (db.actividades_riesgos.riesgos==riesgo)).select().first() The last line show the next error: TypeError: int() argument must be a string or a number, not 'Rows' //