From: tango ward [mailto:tangoward15@gmail.com] Sent: Thursday, May 24, 2018 8:16 PM To: Adrian Klaver <adrian.klaver@aklaver.com> Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org> Subject: Re: Insert data if it is not existing
curr.pgsql.execute(''' INSERT INTO my_table(name, age) SELECT %s, %s WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= name) ''', ('Scott', 23))
If I remove SELECT statement, I will get an error message: error : psycopg2.ProgrammingError: syntax error at or near "WHERE" LINE 12: WHERE NOT EXISTS
Trying to coordinate with Lead Dev about adding Index On The Fly
I tried to figure how to make this work and could not, so I led you down a false path.