SQLite Forum

How to not to overwrite a row if the key exists?
I use the following sqlite3 code (in python apsw) to overwrite or insert a row in a database.

c.execute('CREATE TABLE IF NOT EXISTS sqlar(name TEXT PRIMARY KEY, mode INT, mtime INT, sz INT, data BLOB)')
c.execute('REPLACE INTO sqlar VALUES(?, ?, ?, ?, ?)', [name, 0, t, len_data, zlib_data])

If I want to only insert the row when the key name does not exist, what is the correct way to do it? Thanks.