Hi guys
i try to run this code in loop and to pass even the entry is
duplicated
def email_insert_in _db(email):
sql="INSERT INTO emails (email) values ('%s') "%(email)
db=_mysql.conne ct(host = "localhost" , user = db_user, passwd =
db_pass, db = db_name)
try:
db.query(sql)
except IndentationErro r:
print "duplicate"
pass
also try to (raise, continue)
but can't continue in loop
error output is:
File "inser_in_db.py ", line 85, in email_insert_in _db
db.query(sql)
IntegrityError: (1062, "Duplicate entry 'email@domain.c om' for key 1")
thanks for your help
Baurzhan Zhakashev
Kazakhstan / Shymkent city
i try to run this code in loop and to pass even the entry is
duplicated
def email_insert_in _db(email):
sql="INSERT INTO emails (email) values ('%s') "%(email)
db=_mysql.conne ct(host = "localhost" , user = db_user, passwd =
db_pass, db = db_name)
try:
db.query(sql)
except IndentationErro r:
print "duplicate"
pass
also try to (raise, continue)
but can't continue in loop
error output is:
File "inser_in_db.py ", line 85, in email_insert_in _db
db.query(sql)
IntegrityError: (1062, "Duplicate entry 'email@domain.c om' for key 1")
thanks for your help
Baurzhan Zhakashev
Kazakhstan / Shymkent city
Comment