Strange sqlite3 library behavior
Guilherme Polo
ggpolo at gmail.com
Sat Feb 2 06:37:47 EST 2008
2008/2/2, Roel Schroeven <rschroev_nospam_ml at fastmail.fm>:
> Victor Lin schreef:
>
> > Now I am now developing a program that base on sqlite3 in python.
> > But there is a strange problem.
> > That is, all data I insert into sqlite database do not goes into file
> > in disk.
> > It is really strange....
> > Why do these data just keep in memory and discarded?
>
>
> sqlite3 works according to PEP 249, which means among other things that
> transactions are by default not auto-committed.
>
> There are two possible solutions:
> - manually commit the transaction when it's finished with db.commit()
> (perhaps the cursor object also has a commit() method; I'm not sure
> about that)
> - enable auto-commit.
While these solutions are correct I wouldn't suggest enabling
auto-commit, you will have serious performance issues.
>
> For more info, see the sqlite3 docs (especially the section on
> controlling transactions:
> http://docs.python.org/lib/sqlite3-Controlling-Transactions.html) and
> PEP 249 (http://www.python.org/dev/peps/pep-0249/)
>
> --
> The saddest aspect of life right now is that science gathers knowledge
> faster than society gathers wisdom.
> -- Isaac Asimov
>
>
> Roel Schroeven
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
-- Guilherme H. Polo Goncalves
More information about the Python-list
mailing list