469,312 Members | 2,496 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

sqlite empty inserts

Hello,
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
sqliteselect * 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?

Thank you for your time
Saptarshi

Aug 16 '08 #1
2 1397
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
sqliteselect * 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
Aug 16 '08 #2
I forgot to mention that i was creating a view just before this i.e
sql="create view %s as %s" % (foldername, query)
# self.cursor.execute(sql)
self.cursor.execute(sql)

Now if i remove this, the insert code works fine.
Regards
Saptarshi

Aug 16 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by stan k. | last post: by
2 posts views Thread by Alexander Stuckenholz | last post: by
2 posts views Thread by Christian Stooker | last post: by
12 posts views Thread by John Salerno | last post: by
11 posts views Thread by ra294 | last post: by
reply views Thread by smitty1e | last post: by
8 posts views Thread by Gilles Ganault | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.