sqlite3 bug??
David Wahler
dwahler at gmail.com
Sun Jun 17 08:05:14 EDT 2007
On 6/17/07, mark carter <me at privacy.net> wrote:
> I hesitate to ask, but ...
>
> I'm using Ubuntu Feisty:
> * Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> * SQLite version 3.3.13
>
> Suppose I run the following program:
> import sqlite3
>
> conn = sqlite3.connect('example')
>
>
> c = conn.cursor()
>
> # Create table
> c.execute('''create table stocks
> (date text, trans text, symbol text,
> qty real, price real)''')
>
> # Insert a row of data
> c.execute("""insert into stocks
> values ('2006-01-05','BUY','RHAT',100,35.14)""")
>
> and then I go into sqlite:
> % sqlite3 example
> sqlite3> select * from stocks ;
>
> It returns 0 rows. I'm in the right directory. I have experienced this
> problem with some other sqlite3 database work I have done with python,
> so I'm figuring there is something fishy going on. I've tried doing
> similar exercises with Ruby, and they have worked OK.
>
> Anyone else getting these problems?
See http://www.python.org/dev/peps/pep-0249/ (emphasis mine):
.commit()
Commit any pending transaction to the database. *Note that
if the database supports an auto-commit feature, this must
be initially off.* An interface method may be provided to
turn it back on.
(This really should be a FAQ...)
-- David
More information about the Python-list
mailing list