Try liteserver.commit() before the close() (well, you'll need to get a db 
handle somehow - liteserver may not be it.  More when I get to my laptop.)

--
C. Titus Brown, c...@msu.edu


On May 3, 2010, at 7:09 PM, jbiesinger <jake.biesin...@gmail.com> wrote:

> Hi!  I'm just trying out the tutorial on using sqlite as a backend as
> seen in
> http://biodb.bioinformatics.ucla.edu/pygr_docs/0.8.1/html/tutorials/db_basic.html#saving-data-to-a-sql-database
> It seems that the sqlite rows aren't being saved properly.  I'm
> running python2.6 on Ubuntu 10.04, pygr version 0.8.1.
> 
> # Set up the DB, add a few rows
> from pygr import sqlgraph
> liteserver = sqlgraph.SQLiteServerInfo('/home/wbiesing/test/
> slicedb.sqlite')
> txInfo = sqlgraph.SQLTable('annotations', serverInfo=liteserver,
>            writeable=True,
>            createTable='CREATE TABLE annotations (k INTEGER PRIMARY
> KEY, seq_id TEXT, start INT, stop INT, orientation INT);')
> txInfo.new(k=0,seq_id='chr1',start=0,stop=50,orientation=1)
> txInfo.new(k=1,seq_id='chrX',start=20,stop=250,orientation=-1)
> liteserver.close()
> 
> # there are no rows in the db.
> sqlite3 /home/wbiesing/test/slicedb.sqlite
> SQLite version 3.6.22
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> .tables
> annotations
> sqlite> .schema
> CREATE TABLE annotations (k INTEGER PRIMARY KEY, seq_id TEXT, start
> INT, stop INT, orientation INT);
> sqlite> select * from annotations;
> sqlite>
> 
> 
> I can add rows and wrap them in an annotation database, but as soon as
> I leave the python session, the data is lost.  It's not just being
> kept in-memory since sqlite file is created...
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pygr-dev" group.
> To post to this group, send email to pygr-...@googlegroups.com.
> To unsubscribe from this group, send email to 
> pygr-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/pygr-dev?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"pygr-dev" group.
To post to this group, send email to pygr-...@googlegroups.com.
To unsubscribe from this group, send email to 
pygr-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pygr-dev?hl=en.

Reply via email to