英語字幕DB作成への道_SQLite編③ (bulk_insert)
今日はこちらを参考に、bulk_insertを実装してみました。
docs.python.org
data = [ ("Monty Python Live at the Hollywood Bowl", 1982, 7.9), ("Monty Python's The Meaning of Life", 1983, 7.5), ("Monty Python's Life of Brian", 1979, 8.0), ] cur.executemany("INSERT INTO movie VALUES(?, ?, ?)", data) con.commit() # Remember to commit the transaction after executing INSERT.
100〜200件くらいのデータは全く問題なくinsertできました。
30分程度のドラマの1話分ならこれで全部賄えそうです。
毎度のことだけど、sqlite3はシンプルで使いやすい!
今日も新しいことが学べて良かったです。