I want to read a csv file to insert data into postgres SQL with Python but I have these error:
cursor.execute(passdata)
psycopg2.IntegrityError: duplicate key value violates unique constraint "prk_constraint_project"
DETAIL: Key (project_code)=(%s) already exists.
My code is:
clinicalCSVINSERT = open(clinicalname, 'r')
reader = csv.reader(clinicalCSVINSERT, delimiter='\t')
passdata = "INSERT INTO project (project_code, program_name ) VALUES ('%s', '%s')";
cursor.execute(passdata)
conn.commit()`
What does this error mean? Is it possible to have a working script?