472,126 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

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 1428
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.