mercredi 13 juillet 2016

Python 3 MySql connector AUTO_INCREMENT error

I just started using MySql with python and Im kinda confused about the Primary key thing. I tried this: c.execute("""create table if not EXISTS player ( hid INT NOT NULL AUTO_INCREMENT, name text, lane1 text, lane2 text, devision text, elo int(1), age int(2), team text, PRIMARY KEY (hid))""") However if I use: c.execute("""create table if not EXISTS player ( hid int primary key not NULL , name text, lane1 text, lane2 text, devision text, elo int, age int, team text)""") everything is working fine, but I want to use the Auto_increment command. The Error I get: mysql.connector.errors.DataError: 1136 (21S01): Column count doesn't match value count at row 1

Aucun commentaire:

Enregistrer un commentaire