On 06/01/2014 07:30 AM, big stone wrote:
There is indeed an iterdump function in sqlite3 module, that I didn't
notice.
The one in APSW is far more thorough. If you just have some regular
data tables then it won't make any difference. However if you are about
correctness then be wary of the pysqlite implementation.
The APSW implementation is 250 lines long while pysqlite is 64. These
are the problems I see in the pysqlite implementation at
https://github.com/ghaering/pysqlite/blob/master/lib/dump.py
- Doesn't do the dump inside a transaction so changes while database is
being dumped may or may not be present and may or may not be consistent
- Deletes all sqlite_sequence contents (APSW only deletes/updates for
tables in the dump)
- Runs analyze whenever the sqlite_stat1 table is found rather than when
contents of all tables have been restored
- Only knows about the original analyze (ie not STAT3, STAT4)
- Will create an almighty mess if there are any virtual tables
- Very sloppy with quoting and reserved names, will truncate string
values at first null
- Doesn't disable/enable foreign key checking during restore
- Doesn't restore various things like user version, or settings like
page size, auto vacuum
I got bored at this point, but there will be more of these issues.
> - then understand the "transaction" strange default settings of SQlite3.
pysqlite tries to follow DBAPI which in turn is modelled on other
databases like Postgres. That mainly means that transactions are
automatically started, but must be manually ended.
SQLite 3 also automatically starts transactions, but then automatically
ends them at the end of the statement.
Personally I find the SQLite behaviour more sensible. In either case
when you care about transactions you should manually do the transaction
boundaries yourself.
pysqlite implements the DBAPI semantics by parsing supplied SQL and does
occasionally get outwitted. APSW just lets SQLite do its thing.
http://rogerbinns.github.io/apsw/pysqlite.html
Roger
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users