0

I am trying to insert a new values into my Place table, but I am get an error that the syntax incorrect.

mysql.connector.errors.ProgrammingError: 1064 (42000)

In the Place table I have four fields one is the ID that is primary key, auto increment and the the other is recognize, name and place and they are only not null.

sql.query_insert("""insert into Place('RECOGNIZE','NAME','PLACE') values ('QsDyNOZG9n','test1','test2')""")

create table statement -

CREATE TABLE `Place`.`Place` (
`ID` INT NOT NULL AUTO_INCREMENT,
`RECOGNIZE` VARCHAR(10) NOT NULL,
`NAME` VARCHAR(45) NOT NULL,
`PLACE` VARCHAR(45) NOT NULL,
 PRIMARY KEY (`ID`));

How can I find where the problem occurs ? And how to fix that ?

Thanks.

asaproG
  • 35
  • 1
  • 10

2 Answers2

0

try this

sql.query_insert("""insert into Place.Place(`RECOGNIZE`,`NAME`,`PLACE`)
                    values ('QsDyNOZG9n','test1','test2')""")

use `` instead ''

denny
  • 2,084
  • 2
  • 15
  • 19
0

Try writing it as such..

("insert into Place.Place (RECOGNIZE, NAME, PLACE) values ('QsDyNOZG9n','test1','test2')")

I think you have too many quotes in place and the space between the table 'place' and the column names need to be there. Let me know if that works..

Arron J. Linton
  • 681
  • 2
  • 11
  • 28