i am trying to populate data in mysql from python using csv. till tuple my program is working fine. am able to see data but while uploading in sql. its giving error "Not all parameters used in sql statement"
with open("USERS.csv", "r") as f:
val = []
data = csv.reader(f)
for row in data:
val.append(tuple(row))
print(tuple(row))
cursor = mydb.cursor()
sql=("insert into users (user_id, user_name, user_email,user_password,user_address,is_vendor)"
" values(%s, %s , %s , %s , %s ,%d)")
cursor.execute(sql,tuple(row))
i al ready described above
1条答案
按热度按时间dldeef671#
Looks like you are passing also the header data to the query, try to loop from the first row: