-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 13/07/14 14:05, Simon Slavin wrote: > But the examples of SQLite-via-Python code are clear and well written > and may be useful for Python users who want to learn SQLite.
Sadly it neglects one huge surprising area. The sqlite3 module shipped with Python (aka pysqlite) tries to emulate some transactioning behaviour from a random Python standard (DBAPI) to make it sort of look like other databases, and overrides what SQLite naturally does. It actually parses the SQL provided and auto-starts transactions that must be manually committed or rolled back. It also doesn't understand SQLite fully and hence gets confused by things like WITH and SAVEPOINTs. In other words the code you write is not the code that is executed, and if you aren't careful you will get bitten. For example the inserts go fast because it added a BEGIN, but without a commit at judicious points (including program exit) that data can be lost. My APSW doc includes a page on the differences between pysqlite and APSW, and also serves as a list of things that may be surprising about pysqlite. http://rogerbinns.github.io/apsw/pysqlite.html > Especially for the triple-quoting needed for .execute(). That is a regular Python thing and unrelated to pysqlite or execute. Single quoted strings end on the same line (you can backslash to continue to next line like in C but it is ugly). Triple quoted strings continue across lines until the matching triple quote to close the string. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlPETsAACgkQmOOfHg372QSdhgCgpYdrerB7nrE2F+tqRushIScm 3o0AoLLC9djTNUb9Kx4V75GJpHeF9Hl3 =2TNc -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users