sqlite empty inserts

Peter Otten __peter__ at web.de
Sat Aug 16 08:22:36 CEST 2008


sapsi wrote:

> I created a table like:
> 
> create table __saved_query__ (vdb_name text , query_table_name text
> PRIMARY KEY, query text)
> 
> and then I insert as follows
> 
>     self.cursor.execute( "insert into __saved_query__(vdb_name,
> query_table_name, query) values (?,?,?)", (vdbname,
> foldername,where_query))
>   self.conn.commit()
> Now for some reason, the first insert works, but thereafter all
> inserts result in empty rows
> e.g
> sqlite> select * from __saved_query__;
> TestVDB|test_b|title regexp 'boo'
> ||
> ||
> 
> The last two rows are from the 2nd and 3rd inserts. The values i;m
> inserting are non null.
> 
> Any ideas?

Change the query to ... query_table_name text PRIMARY KEY NOT NULL ... to
verify that assertion before you look any further.

Peter



More information about the Python-list mailing list