sqlite3 bug??

Peter Otten __peter__ at web.de
Sun Jun 17 08:09:33 EDT 2007


mark carter wrote:

> I hesitate to ask, but ...

Don't :-)

> 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?

How about conn.commit()?

Peter



More information about the Python-list mailing list