Hi - Can someone explain why I am returning this error? I’ve basically at this point recreated your answer but the only answer the module will take is your answer.
Here is the error:
IntegrityError: duplicate key value violates unique constraint “notes_pkey”
DETAIL: Key (id)=(1) already exists.
# conn = psycopg2.connect("dbname=dq user=dq")
# cur = conn.cursor()
# cur.execute("INSERT INTO notes VALUES (1, 'Do more missions on Dataquest.', 'Dataquest reminder');")
# conn.commit()
# cur.execute("SELECT * from notes;")
# rows = cur.fetchall()
# print(rows)
# conn.close()
conn = psycopg2.connect("dbname=dq user=dq")
cur = conn.cursor()
cur.execute("INSERT INTO notes VALUES (1, 'Do more missions on Dataquest.', 'Dataquest reminder');")
conn.commit()
cur.execute("SELECT * FROM notes;")
rows = cur.fetchall()
print(rows)
conn.close()