MySQLdb Error

Emeka emekamicro at gmail.com
Wed Jan 11 02:57:43 EST 2012


Hello All,

I got the below error why trying to create tables of the fly.

for item in ['CREATE TABLE AddressTables ( AddressTables_id int (9)
unsigned primary key auto_increment not null,  city_name char(40) ,
 state_name varchar,  street_number int,  country_name varchar,
 street_name char(40) , user_name char(40) references usertables(name))',
'CREATE TABLE UserTables ( age int,  UserTables_id int (9) unsigned primary
key auto_increment not null,  name char(40) ,  place_of_birth varchar)']:
    cursor.execute(item)


I receive the following errors.
 File "mor.py", line 98, in <module>
    cursor.execute(item)
  File "/usr/lib/pymodules/python2.7/MySQLdb/cursors.py", line 166, in
execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 35, in
defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "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 '  street_number int,  country_name varchar,
 street_name char(40) , user_name ch' at line 1")
*

Regards,*
*Emeka


*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120111/3d355496/attachment.html>


More information about the Python-list mailing list