Skip to content

Instantly share code, notes, and snippets.

@iffy
Created June 29, 2011 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iffy/1054853 to your computer and use it in GitHub Desktop.
Save iffy/1054853 to your computer and use it in GitHub Desktop.
Buffer stuff
(1, <read-write buffer ptr 0x698860, size 4 at 0x698840>)
(2, u'0.00')
sqlite 2.4.1
storm 0.17
import storm
from storm.locals import *
from decimal import Decimal as Dec
class Foo(Storm):
__storm_table__ = 'foo'
id = Int(primary=True)
val = Decimal(default=Dec('0.00'))
db = create_database('sqlite:foo.db')
store = Store(db)
store.execute('create table foo (id integer primary key, val text)')
store.commit()
# make one
f = store.add(Foo())
store.commit()
# open with sqlite
import sqlite3
db = sqlite3.connect('foo.db')
c = db.cursor()
c.execute('insert into foo (val) values(?)', ('0.00',))
db.commit()
c.execute('select * from foo')
for row in c.fetchall():
print row
print 'sqlite', sqlite3.version
print 'storm', storm.version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment