Created
June 29, 2011 20:23
-
-
Save iffy/1054853 to your computer and use it in GitHub Desktop.
Buffer stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1, <read-write buffer ptr 0x698860, size 4 at 0x698840>) | |
(2, u'0.00') | |
sqlite 2.4.1 | |
storm 0.17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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