I want to insert some values in a postgres database with a python script, but when I try it with my code below I get a syntaxerror at my first IF.
sql_string = "BEGIN IF (NOT EXISTS(SELECT * FROM table WHERE nm=name))
BEGIN INSERT INTO table(nm, nb)
VALUES (%s, %s) END END"
cur.execute(sql_string, (name, number))
Would be nice if someone has an idea. thanks :)