Again… what is wrong with the generated SQL? I do not know how to fix it if I 
do not understand why postgres is complaining.

Massimo

On Sep 6, 2012, at 9:09 AM, Christian Espinoza wrote:

> The last one was with psycopg2, this is the last value of command using  
> pg8000:
> 
> SELECT  auth_group.id, auth_group.role, auth_group.description FROM 
> auth_group WHERE (auth_group.id > 0) ORDER BY auth_group.id LIMIT 1 OFFSET 0;
> 
> The failure appears when I try to init some values in a empty postgresql 
> database, with a empty sqlite db all works fine...
> Im using if db(db.auth_group).isempty():
> To check if is empty to insert the firsts values...
> 
> Christian.
> 
> 2012/9/6 Christian Espinoza <chespin...@gmail.com>
> Massimo,
> 
> SELECT  auth_user.id, auth_user.username, auth_user.first_name, 
> auth_user.last_name,\
> auth_user.sede_id, auth_user.email, auth_user.estado, auth_user.password, 
> auth_user.created_on, auth_user.modified_on, auth_user.registration_key,\
> auth_user.reset_password_key, auth_user.registration_id FROM auth_user WHERE 
> (auth_user.id > 0) ORDER BY auth_user.id LIMIT 1 OFFSET 0;
> 
> INSERT INTO 
> auth_user(username,first_name,last_name,registration_key,reset_password_key,registration_id,modified_on,created_on,sede_id,password,estado,email)\
> VALUES ('11111111-1','admin','admin','','','','2012-09-06 
> 10:36:50','2012-09-06 10:36:50',1,'admin','activo','ad...@live.com');
> 
> Thanks in advance
> Christian.
> 
> 2012/9/6 Massimo Di Pierro <massimo.dipie...@gmail.com>
> Can you add a 
> print command
> after
> command = a[0]
> I want to know what is the invalid command. The ticket only shows part if it.
> 
> On Wednesday, 5 September 2012 17:27:49 UTC-5, Christian Espinoza wrote:
> Hi Massimo, this is:
> 
> File /opt/web-apps/web2py/gluon/dal.py in log_execute at line 1653
> 
> Code listing
> 1648.
> 1649.
> 1650.
> 1651.
> 1652.
> 1653.
> 
> 1654.
> 1655.
> 1656.
> 1657.
>         command = a[0]
> 
> 
> 
>         if self.db._debug:
> 
> 
> 
>             logger.debug('SQL: %s' % command)
> 
> 
> 
>         self.db._lastsql = command
> 
> 
> 
>         t0 = time.time()
> 
> 
> 
>         ret = self.cursor.execute(*a, **b)
> 
> 
> 
> 
>         self.db._timings.append((command,time.time()-t0))
> 
> 
> 
>         del self.db._timings[:-TIMINGSSIZE]
> 
> 
> 
>         return ret
> Variables
> a     ('SELECT auth_user.id, auth_user.username, auth_u...r.id > 0) ORDER BY 
> auth_user.id LIMIT 1 OFFSET 0;',)
> b      {}
> self   <gluon.dal.PostgreSQLAdapter object>
> ret   undefined
> self.cursor   <gluon.contrib.pg8000.dbapi.CursorWrapper object>
> self.cursor.execute   <bound method CursorWrapper._fn of 
> <gluon.contrib.pg8000.dbapi.CursorWrapper object>>
> 
> 2012/9/5 Massimo Di Pierro <massimo....@gmail.com>
> Did you install psycopg2? If not it is probably using pg8000. Can you please 
> help us debug? Edit dal.py and in the function log_excecute can you print the 
> value of the command variable? What does it print when it fails?
> 
> On Wednesday, 5 September 2012 11:29:42 UTC-5, Christian Espinoza wrote:
> Hello, I'm in trouble with a webapp that I'have.
> 
> I develop it using sqlite only for a best approach of web2py features with it.
> 
> And I'm trying to migrate it to a Postgresql DB to put it on Testing phase.
> 
> But It doesn't work with PostgreSQL, only work with sqlite, I'd tried with  
> 1.99.7 - 2.0.6 -  2.0.7 Versions
> 
> At 2.0.7 and 2.0.6 showme: <type 'exceptions.ValueError'> invalid literal for 
> int() with base 10: 'SELECT'
> 
> At 
> 
> 
> 
> 
> Traceback (most recent call last):
> 
> 
> 
>   File "/opt/web-apps/web2py/gluon/restricted.py", line 209, in restricted
> 
> 
> 
>     exec ccode in environment
> 
> 
> 
>   File "/opt/web-apps/web2py-2.0.7/applications/sadma/models/db.py", line 
> 236, in <module>
> 
> 
> 
>     if db(db.auth_user).isempty():
> 
> 
> 
>   File "/opt/web-apps/web2py/gluon/dal.py", line 8722, in isempty
> 
> 
> 
>     return not self.select(limitby=(0,1))
> 
> 
> 
>   File "/opt/web-apps/web2py/gluon/dal.py", line 8743, in select
> 
> 
> 
>     return adapter.select(self.query,fields,attributes)
> 
> 
> 
>   File "/opt/web-apps/web2py/gluon/dal.py", line 1583, in select
> 
> 
> 
>     return self._select_aux(sql,fields,attributes)
> 
> 
> 
>   File "/opt/web-apps/web2py/gluon/dal.py", line 1556, in _select_aux
> 
> 
> 
>     self.execute(sql)
> My Connection string:
>     #db = DAL('sqlite://storage.sqlite')
>     db = DAL('postgres://user:pass@localhost/dbapp')
> Running on Centos 6.0, external Postgresql Server with 9 version, Python 2.6.6
> 
> Thanks in advance
> Christian.
> 
> -- 
>  
>  
>  
> 
> 
> -- 
>  
>  
>  
> 
> 

-- 



Reply via email to