MySQL Error

305 views
Skip to first unread message

Hassan Alnatour

unread,
Aug 7, 2012, 7:13:03 AM8/7/12
to web...@googlegroups.com
Dear ALL ,

I am trying to connect to mysql database and i keep getting this 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 'Like INT,\n Sidebar CHAR(1),\n Homepage CHAR(1),\n Order VARCHAR(255),\n ' at line 22")

Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
File "C:/web2py/applications/latesti3zif/models/db.py", line 298, in <module>
Field('SEO_Description','text'))
File "C:\web2py\gluon\dal.py", line 5097, in define_table
polymodel=polymodel)
File "C:\web2py\gluon\dal.py", line 705, in create_table
self.create_sequence_and_triggers(query,table)
File "C:\web2py\gluon\dal.py", line 1348, in create_sequence_and_triggers
self.execute(query)
File "C:\web2py\gluon\dal.py", line 1359, in execute
return self.log_execute(*a, **b)
File "C:\web2py\gluon\dal.py", line 1353, in log_execute
ret = self.cursor.execute(*a, **b)
File "C:\web2py\gluon\contrib\pymysql\cursors.py", line 108, in execute
self.errorhandler(self, exc, value)
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 184, 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 'Like INT,\n Sidebar CHAR(1),\n Homepage CHAR(1),\n Order VARCHAR(255),\n ' at line 22")

This is the table in the Error ::

db.define_table('Videos', Field('Title'), Field('Hits','integer',default=1), Field('Arabic_Title'), Field('Bits_on_The_Run_Script'), Field('Youtube_Video_Url'), Field('Description','text',length=1000), Field('Arabic_Description','text',length=1000), Field('Publish_Date','datetime',default=now), Field('Teacher',db.Teachers), Field('Instroument',db.Instruments), Field('Level',requires=IS_IN_SET(Course_level,zero=None)), Field('Style'), Field('Video_Type',requires=IS_IN_SET(Video_type,zero=None)), Field('Course_ID'), Field('Song_ID',db.Songs), Field('Price',default=0), Field('Full_Course_Price',default=0), Field('Cover','upload'), Field('PDF','upload'), Field('Like','integer',default=1), Field('Sidebar','boolean'), Field('Homepage','boolean'), Field('Order'), Field('SEO_Keywords','text'), Field('SEO_Description','text'))


What do you think is the problem , i tried a lot ?? please Help


Best Regards,

Marin Pranjić

unread,
Aug 7, 2012, 8:07:49 AM8/7/12
to web...@googlegroups.com
'Like' is an sql keyword.

--
 
 
 

Hassan Alnatour

unread,
Aug 7, 2012, 9:05:22 AM8/7/12
to web...@googlegroups.com
Dear Marin,

I change Like To Likes but i still get errors  , the traceback is : 


<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 'Order VARCHAR(255),\n SEO_Keywords LONGTEXT,\n SEO_Description LONGTEXT,\n ' at line 25")



1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
File "C:/web2py/applications/latesti3zif/models/db.py", line 298, in <module>
Field('SEO_Description','text'))
File "C:\web2py\gluon\dal.py", line 5097, in define_table
polymodel=polymodel)
File "C:\web2py\gluon\dal.py", line 705, in create_table
self.create_sequence_and_triggers(query,table)
File "C:\web2py\gluon\dal.py", line 1348, in create_sequence_and_triggers
self.execute(query)
File "C:\web2py\gluon\dal.py", line 1359, in execute
return self.log_execute(*a, **b)
File "C:\web2py\gluon\dal.py", line 1353, in log_execute
ret = self.cursor.execute(*a, **b)
File "C:\web2py\gluon\contrib\pymysql\cursors.py", line 108, in execute
self.errorhandler(self, exc, value)
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 184, 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 'Order VARCHAR(255),\n    SEO_Keywords LONGTEXT,\n    SEO_Description LONGTEXT,\n   ' at line 25")

Marin Pranjić

unread,
Aug 7, 2012, 9:14:42 AM8/7/12
to web...@googlegroups.com
Hi,

order is sql keyword too.

This might be helpful to you: http://web2py.com/books/default/chapter/29/6?search=check#Reserved-keywords

Regards,
Marin

--
 
 
 

Reply all
Reply to author
Forward
0 new messages