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 ()

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39053-2c153.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39053-2c153.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?