Hi,
  I'm trying to create a mapped class that allows parent/child
relation of itself. I've spent the last 3 hours searching and reading
the other posts on this, but can't get anything to work.

I'm on 0.5rc4 and just want to declare this in a mapped class as such:

class Conversion(Base):
    __tablename__ = 'conversion'

    id = Column(Integer, primary_key=True)
    name = Column(String(20))

    parent_id = Column(Integer, ForeignKey('conversion.id'))
    parent = relation("Conversion", backref="child")

    children = relation('Conversion', secondary=conversion_conversion,
backref='parents')

I was hoping to use the same style many-to-many declarations I do
elsewhere. It creates fine, but doesn't work when adding objects.

The other posts and examples I saw do not use the class Conversion
(Base): style of automapping, which I'd like to maintain.

Anyone have good tips for this?

Darren

PS. I've seen the documentation links and base_tree.py, but I don't
want to mix mapping styles If possible.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to