Through Python, I'm pulling data from a JSON request and inserting into a database, but I want to make sure those records do not already exist before inserting it in there.
I know similar questions have been asked before, but mine is different because mine is not querying from a second table. So how do I approach this?
What I've tried, and I get an incorrect Syntax error, is
INSERT INTO table (col1, col2, col3)
VALUES (val1, val2, val3)
WHERE NOT EXISTS (select col1 FROM table WHERE col1 != val1)
Can anyone give me a better way to approach this problem? Thank you.