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

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

Reply via email to