INSERT OR IGNORE with SQLModel using Python
Asked Answered
P

0

8

Does anyone know if its possible to get a INSERT OR IGNORE function with SQLModel? And if not, does anyone know if there is a workaround to get the same results?

I haven't tried anything to get the results I'm look for as I'm fairly new to programming. I just been reading of documentation.

If you have used SQLite before you know that INSERT OR IGNORE is a function that looks for the primary_key in your database and if it doesn't exist, it will insert the new data into the database, but if the primary_key does exist, it will completely ignore the data and prevent errors on your code.

Plugboard answered 29/3, 2022 at 5:7 Comment(2)
a very common DB idiom is an UPSERT which doesn't seem supported yet, so presumably this isn't supported eitherForage
You might be looking for the CREATE TABLE IF NOT EXISTS statement.Jupiter

© 2022 - 2024 — McMap. All rights reserved.