I have a code like this
c.execute('CREATE TABLE IF NOT EXISTS base (ID INTEGER NOT NULL, col2 TEXT NOT NULL, col3 INTEGER, PRIMARY KEY(ID, col2))')
This code gives me an sqlite3.IntegrityError exception even though I am very sure that I am writing the record for the first time.
So, I tried
c.execute('CREATE TABLE IF NOT EXISTS base (ID INTEGER, col2 TEXT, col3 INTEGER, PRIMARY KEY(ID, col2))')
This inserts the row fine in the base table BUT, ID column is not auto incremented at all.
What can I do? Any idea?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…