I want the insertion query do nothing if it's nothing new in csv file , In Case it is , i want to insert only this one and not again all the csv, any suggestion would be great!
PS: it's not duplicate with other questions because here we have "%s" no stable values and in python it's different the syntax!
cursorobject=connection.cursor()
sql2="CREATE DATABASE IF NOT EXISTS mydb"
cursorobject.execute(sql2)
sql1="CREATE TABLE IF NOT EXISTS users(id int(11) NOT NULL AUTO_INCREMENT,first_name varchar(255),last_name varchar(255),company_name varchar(255),address varchar(255),city varchar(255),country varchar(255),postal varchar(255),phone1 varchar(255),phone2 varchar(255),email varchar(255),web varchar(255),PRIMARY KEY(id))"
cursorobject.execute(sql1)
csvfile=open('Entries.csv','r')
reader = csv.reader(csvfile,delimiter=',')
for row in reader:
cursorobject.execute("INSERT INTO users(first_name,last_name,company_name,address,city,country,postal,phone1,phone2,email,web) VALUES (%s ,%s, %s,%s,%s,%s,%s,%s,%s,%s,%s)",row)