Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18811 > unrolled thread

Re: MySQLdb Error

Started byChris Angelico <rosuav@gmail.com>
First post2012-01-11 20:00 +1100
Last post2012-01-11 20:00 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: MySQLdb Error Chris Angelico <rosuav@gmail.com> - 2012-01-11 20:00 +1100

#18811 — Re: MySQLdb Error

FromChris Angelico <rosuav@gmail.com>
Date2012-01-11 20:00 +1100
SubjectRe: MySQLdb Error
Message-ID<mailman.4634.1326272411.27778.python-list@python.org>
On Wed, Jan 11, 2012 at 6:57 PM, Emeka <emekamicro@gmail.com> wrote:
> 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))
>
> _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")

You're getting an error back from the database. The message suggests
that you look around the place cited for some kind of syntactic error.
See if you can find the error; often, in situations like this, the
actual error is a little bit before what's pointed to.

Have a look, I'll wait.







Spoiler alert! Try figuring it out yourself before you scroll down.







You've been warned! There are spoilers ahead.







Okay. The problem is that MySQL requires varchar to be followed by a
length: varchar(255) or varchar(32) or whatever. The use of naked
'varchar' is a PostgreSQL feature only.

Hope that helps!

Chris Angelico

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web