graehl / pygr

Automatically exported from code.google.com/p/pygr
0 stars 0 forks source link

SQLTable.new doesn't add new rows. #131

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
from pygr import sqlgraph

si = sqlgraph.SQLiteServerInfo("/tmp/foo.sqlite")
tbl = sqlgraph.SQLTable("foo", serverInfo=si, writeable=True, 
createTable="CREATE TABLE foo (cid INT PRIMARY KEY, foo VARCHAR(40));")

tbl.new(cid=0, foo="ABC")
tbl.new(cid=1, foo="DEF")

What is the expected output? What do you see instead?
I would expect that there would be two rows in my new table; there are none 
added.

This functionality also does not work if I use MySQLServerInfo (or 
DBServerInfo).

Please use labels and text to provide additional information.
Using pygr-0.8.1, python 2.6.2, sqlite 3.6.23.1.

Original issue reported on code.google.com by kmda...@gmail.com on 15 Nov 2010 at 9:47

GoogleCodeExporter commented 9 years ago
Adding this to the end fixes it, for sqlite:

si._connection.commit()

Original comment by kmda...@gmail.com on 18 Nov 2010 at 7:14