How to insert Python+SQLite3 if it doesn't exist?

if the Python+SQLite3 record does not exist, insert it and ignore it if it exists.

Nov.22,2021

SQL

Topic.insert(topic_id=topic_id, name=name, level=parent.level+1, parent_id=parent_id).on_conflict_ignore().execute()

the key point is on_conflict_ignore ()

Menu