MySql

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Thu Jul 27 03:13:39 EDT 2006


In <1153982385.121336.41500 at i3g2000cwc.googlegroups.com>, miker2 wrote:

> import MySQLdb
> base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> db="test_py")
> cursor = base.cursor()
> cursor.execute("INSERT INTO table (field) VALUES (int)")
> 
> this does not work but the interesting thing is, there is an
> AUTO_INCREMENT
> field. Now say i had a couple of entries in there already:
>                                    auto  table
>                                     1    |    90
>                                     2    |    32
> 
> and then i run my py script 3 times, the data is not entered but if i
> add
> another entry from mysql the auto increment field will have counted the
> 
> python entries:
>                        auto    table
>                          1    |    90
>                          2    |    32
>                          6    |    47
> 
> please tell me what i am doing wrong. thanks.

Where's the problem?  Do you mind that the third entry has a 6 as unique
`auto` value?  Doesn't `AUTO_INCREMENT` just guarantee unique values?

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list