Hi Storm developers,

Recently, I have been trying your great product, Storm.   Many nice features
are found there :-)  But I encounter a weird and messing database integrity
error.  To see how, just run the attached test.py.  I am using storm trunk
version.

Could you help me?  Thanks a lot in advance.

Best regards,

Xizeng Mao
from storm.locals import *
from storm import database
database.DEBUG = True

class A(object):
    __storm_table__ = 'as_'
    id = Int(primary=True)
    slug = Unicode()
    
    def __init__(self, slug):
        self.slug = slug

class B(object):
    __storm_table__ = 'bs'
    id = Int(primary=True)
    slug = Unicode()
    a_id = Int()
    a = Reference(id, A.id)

    def __init__(self, slug):
        self.slug = slug

s = Store(create_database('sqlite:'))

s.execute('create table as_ (id integer primary key, slug text)')

s.execute('create table bs (id integer primary key, slug text, a_id integter references as_(id))')

s.commit()

a = s.add(A(u'A1'))

b = s.add(B(u'B1'))
b.a = a

b = s.add(B(u'B2'))
b.a = a

s.commit()

print b.id
-- 
storm mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/storm

Reply via email to