SQLite Forum

Fast way to insert rows in SQLite
Login
<https://docs.python.org/3/library/sqlite3.html>

<pre>The Python sqlite3 module by default issues a BEGIN statement
implicitly before a Data Modification Language (DML) statement
(i.e. INSERT/UPDATE/DELETE/REPLACE).
[...]
Changed in version 3.6: sqlite3 used to implicitly commit an
open transaction before DDL statements. This is no longer the
case.</pre>

Given the above, I'm not sure whether you are correctly controlling your transactions.  I would be explicitly issue both <code>BEGIN</code> and <code>COMMIT</code> commands.  But I don't know enough about Python to understand the implications.

Not at all sure that this is your problem, but it might help you figure out why Python is so much slower than Rust.