The manual says this. "The Python sqlite3 module by default issues a BEGIN statement implicitly before a Data Modification Language (DML) statement (i.e. INSERT/UPDATE/DELETE/REPLACE)." > If you did NOT specify "isolation_level = None" in the .connect() call then > you probably ARE in a transaction if you've been running queries.
I just use the default .connect() without specifying isolation_level explicitly. Then I am in a transaction? import sqlite3 conn=sqlite3.connect(f) c=conn.cursor() import zlib c.execute('SELECT name FROM sqlar') result = c.fetchall() for x in result: print(x[0]) > But why do I need to commit my transaction if I'm just reading? Is there any .commit() implied in the SELECT statement? > If you're just reading then you can commit or rollback. So I should close the `conn` immediately after `c.fetchall()` to release resources used by sqlite3? > If the database is not in WAL mode In the above example, should I use WAL mode or not? https://charlesleifer.com/blog/going-fast-with-sqlite-and-python/ -- Regards, Peng _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users