How to correctly set AUTO INCREMENT fo a column in SQLite, using Python?

前端 未结 4 873
轻奢々
轻奢々 2021-02-04 04:33

I have been trying with the below code:

import sqlite3
data_person_name = [(\'Michael\', \'Fox\'),
                    (\'Adam\', \'Miller\'),
                           


        
4条回答
  •  被撕碎了的回忆
    2021-02-04 05:05

    Replace the first ? in executemany statement with null.

    So the following line can be rewritten:

    c.executemany('INSERT INTO q1_person_name VALUES (?,?,?)', data_person_name)
    

    as

    c.executemany('INSERT INTO q1_person_name VALUES (null,?,?)', data_person_name)
    

提交回复
热议问题