Hi,

I guess the error is in this line.

db.validades.empresa.*requires=requires*=IS_IN_DB 
<http://localhost/examples/global/vars/IS_IN_DB>(db, 
'auth_user.id','auth_user.empresa',error_message=e_m['not_in_db'])"


You are writing two times requires this cant be right.
best regards
Dmitri Husti

Am Montag, 8. Juli 2013 18:56:47 UTC+2 schrieb Ramos:
>
> hello i changed from sqlite to mysql and now i have an error
>
> <class 'gluon.contrib.pymysql.err.ProgrammingError'> (1064, u"You have an 
> error in your SQL syntax; check the manual that corresponds to your MySQL 
> server version for the right syntax to use near 'desc VARCHAR(512),\n 
> validade DATE,\n PRIMARY KEY(id)\n) ENGINE=InnoDB CHARAC' at line 4") 
>
>
> Traceback (most recent call last):
>   File "/home/ubuntu/web2py/gluon/restricted.py", line 212, in restricted
>
>
>     exec ccode in environment
>   File "/home/ubuntu/web2py/applications/EMPRE/models/db.py" 
> <http://localhost/admin/default/edit/EMPRE/models/db.py>, line 115, in 
> <module>
>
>
>     Field('validade','date', required=True,label='Validade da informação 
> apresentada'))
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 7755, in define_table
>
>
>     table = self.lazy_define_table(tablename,*fields,**args)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 7792, in lazy_define_table
>
>
>     polymodel=polymodel)
>   File "/home/ubuntu/web2py/gluon/dal.py", line 963, in create_table
>
>
>     self.create_sequence_and_triggers(query,table)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1781, in 
> create_sequence_and_triggers
>
>
>     self.execute(query)
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1798, in execute
>
>
>     return self.log_execute(*a, **b)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1792, in log_execute
>
>
>     ret = self.cursor.execute(command, *a[1:], **b)
>
>
>   File "/home/ubuntu/web2py/gluon/contrib/pymysql/cursors.py", line 117, in 
> execute
>
>
>     self.errorhandler(self, exc, value)
>
>
>   File "/home/ubuntu/web2py/gluon/contrib/pymysql/connections.py", line 202, 
> in defaulterrorhandler
>
>
>     raise errorclass, errorvalue
> ProgrammingError: (1064, u"You have an error in your SQL syntax; check the 
> manual that corresponds to your MySQL server version for the right syntax to 
> use near 'desc VARCHAR(512),\n    validade DATE,\n    PRIMARY KEY(id)\n) 
> ENGINE=InnoDB CHARAC' at line 4")
>
>
>
> my model where i think is the problem is 
>
> db.define_table('validades',
>     Field 
> <http://localhost/examples/global/vars/Field>('empresa',db.auth_user,unique=True),
>
>
>     Field <http://localhost/examples/global/vars/Field>('desc',compute=lambda 
> row: db.auth_user[row.empresa]['empresa']),
>
>
>     Field <http://localhost/examples/global/vars/Field>('validade','date', 
> required=True,label='Validade da informação apresentada'))
>
> # -requires
> db.validades.empresa.requires=requires=IS_IN_DB 
> <http://localhost/examples/global/vars/IS_IN_DB>(db, 
> 'auth_user.id','auth_user.empresa',error_message=e_m['not_in_db'])
>
> db.validades.validade.requires=[IS_DATE(format=T('%Y/%m/%d'),error_message=T("Formato
>  pretendido aaa/mm/dd"))]
>
>
> *What is the problem?*
>
>
>
>
Am Montag, 8. Juli 2013 18:56:47 UTC+2 schrieb Ramos:
>
> hello i changed from sqlite to mysql and now i have an error
>
> <class 'gluon.contrib.pymysql.err.ProgrammingError'> (1064, u"You have an 
> error in your SQL syntax; check the manual that corresponds to your MySQL 
> server version for the right syntax to use near 'desc VARCHAR(512),\n 
> validade DATE,\n PRIMARY KEY(id)\n) ENGINE=InnoDB CHARAC' at line 4") 
>
>
> Traceback (most recent call last):
>   File "/home/ubuntu/web2py/gluon/restricted.py", line 212, in restricted
>
>
>     exec ccode in environment
>   File "/home/ubuntu/web2py/applications/EMPRE/models/db.py" 
> <http://localhost/admin/default/edit/EMPRE/models/db.py>, line 115, in 
> <module>
>
>
>     Field('validade','date', required=True,label='Validade da informação 
> apresentada'))
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 7755, in define_table
>
>
>     table = self.lazy_define_table(tablename,*fields,**args)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 7792, in lazy_define_table
>
>
>     polymodel=polymodel)
>   File "/home/ubuntu/web2py/gluon/dal.py", line 963, in create_table
>
>
>     self.create_sequence_and_triggers(query,table)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1781, in 
> create_sequence_and_triggers
>
>
>     self.execute(query)
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1798, in execute
>
>
>     return self.log_execute(*a, **b)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1792, in log_execute
>
>
>     ret = self.cursor.execute(command, *a[1:], **b)
>
>
>   File "/home/ubuntu/web2py/gluon/contrib/pymysql/cursors.py", line 117, in 
> execute
>
>
>     self.errorhandler(self, exc, value)
>
>
>   File "/home/ubuntu/web2py/gluon/contrib/pymysql/connections.py", line 202, 
> in defaulterrorhandler
>
>
>     raise errorclass, errorvalue
> ProgrammingError: (1064, u"You have an error in your SQL syntax; check the 
> manual that corresponds to your MySQL server version for the right syntax to 
> use near 'desc VARCHAR(512),\n    validade DATE,\n    PRIMARY KEY(id)\n) 
> ENGINE=InnoDB CHARAC' at line 4")
>
>
>
> my model where i think is the problem is 
>
> db.define_table('validades',
>     Field 
> <http://localhost/examples/global/vars/Field>('empresa',db.auth_user,unique=True),
>
>
>     Field <http://localhost/examples/global/vars/Field>('desc',compute=lambda 
> row: db.auth_user[row.empresa]['empresa']),
>
>
>     Field <http://localhost/examples/global/vars/Field>('validade','date', 
> required=True,label='Validade da informação apresentada'))
>
> # -requires
> db.validades.empresa.requires=requires=IS_IN_DB 
> <http://localhost/examples/global/vars/IS_IN_DB>(db, 
> 'auth_user.id','auth_user.empresa',error_message=e_m['not_in_db'])
>
> db.validades.validade.requires=[IS_DATE(format=T('%Y/%m/%d'),error_message=T("Formato
>  pretendido aaa/mm/dd"))]
>
>
> *What is the problem?*
>
>
>
>
Am Montag, 8. Juli 2013 18:56:47 UTC+2 schrieb Ramos:
>
> hello i changed from sqlite to mysql and now i have an error
>
> <class 'gluon.contrib.pymysql.err.ProgrammingError'> (1064, u"You have an 
> error in your SQL syntax; check the manual that corresponds to your MySQL 
> server version for the right syntax to use near 'desc VARCHAR(512),\n 
> validade DATE,\n PRIMARY KEY(id)\n) ENGINE=InnoDB CHARAC' at line 4") 
>
>
> Traceback (most recent call last):
>   File "/home/ubuntu/web2py/gluon/restricted.py", line 212, in restricted
>
>
>     exec ccode in environment
>   File "/home/ubuntu/web2py/applications/EMPRE/models/db.py" 
> <http://localhost/admin/default/edit/EMPRE/models/db.py>, line 115, in 
> <module>
>
>
>     Field('validade','date', required=True,label='Validade da informação 
> apresentada'))
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 7755, in define_table
>
>
>     table = self.lazy_define_table(tablename,*fields,**args)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 7792, in lazy_define_table
>
>
>     polymodel=polymodel)
>   File "/home/ubuntu/web2py/gluon/dal.py", line 963, in create_table
>
>
>     self.create_sequence_and_triggers(query,table)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1781, in 
> create_sequence_and_triggers
>
>
>     self.execute(query)
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1798, in execute
>
>
>     return self.log_execute(*a, **b)
>
>
>   File "/home/ubuntu/web2py/gluon/dal.py", line 1792, in log_execute
>
>
>     ret = self.cursor.execute(command, *a[1:], **b)
>
>
>   File "/home/ubuntu/web2py/gluon/contrib/pymysql/cursors.py", line 117, in 
> execute
>
>
>     self.errorhandler(self, exc, value)
>
>
>   File "/home/ubuntu/web2py/gluon/contrib/pymysql/connections.py", line 202, 
> in defaulterrorhandler
>
>
>     raise errorclass, errorvalue
> ProgrammingError: (1064, u"You have an error in your SQL syntax; check the 
> manual that corresponds to your MySQL server version for the right syntax to 
> use near 'desc VARCHAR(512),\n    validade DATE,\n    PRIMARY KEY(id)\n) 
> ENGINE=InnoDB CHARAC' at line 4")
>
>
>
> my model where i think is the problem is 
>
> db.define_table('validades',
>     Field 
> <http://localhost/examples/global/vars/Field>('empresa',db.auth_user,unique=True),
>
>
>     Field <http://localhost/examples/global/vars/Field>('desc',compute=lambda 
> row: db.auth_user[row.empresa]['empresa']),
>
>
>     Field <http://localhost/examples/global/vars/Field>('validade','date', 
> required=True,label='Validade da informação apresentada'))
>
> # -requires
> db.validades.empresa.requires=requires=IS_IN_DB 
> <http://localhost/examples/global/vars/IS_IN_DB>(db, 
> 'auth_user.id','auth_user.empresa',error_message=e_m['not_in_db'])
>
> db.validades.validade.requires=[IS_DATE(format=T('%Y/%m/%d'),error_message=T("Formato
>  pretendido aaa/mm/dd"))]
>
>
> *What is the problem?*
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to