[storm] self-referencing table
Wilson Freitas
wilson.freitas at gmail.com
Fri Feb 8 03:10:24 GMT 2008
Hi all,
Is it possible to use storm to handle self-referencing tables ?
I have made a trial with the following code:
class Category(object):
__storm_table__ = "category"
id = Int(name="id_category", primary=True)
name = Unicode()
id_parent = Int()
parent = Reference(id_parent, Category.id)
def __init__(self, name):
self.name = name
But I have got a NameError, because Category was already not defined.
I also have tried this code:
class Category(object):
__storm_table__ = "category"
id = Int(name="id_category", primary=True)
name = Unicode()
id_parent = Int()
parent = None
def __init__(self, name):
self.name = name
self.parent = Reference(self.id_parent, Category.id)
and it does not worked too.
Is there any way to make this work?
Thank you in advance.
--
Wilson Freitas
http://aboutwilson.net
More information about the storm
mailing list