Hi

Using SQLAlchemy 0.5.8.

I have the following model...


class Link(DeclarativeBase):
    __tablename__ = 'link'

    linkId = Column(Integer, autoincrement=True, primary_key=True)
    name = Column(Unicode(50), nullable=False)
    parentLinkId = Column(Integer, ForeignKey('link.linkId'))
    url = Column(Unicode(255))
permissionId = Column(Integer, ForeignKey('tg_permission.permission_id'))
    description = Column(Text())
    parentLink = relation(Link, primaryjoin=parentLinkId==Link.linkId)
permission = relation(Permission, primaryjoin=permissionId==Permission.permission_id)

The problem is with the second to the last line. I'm trying to create a relation to point to the parent link, which points back to the same table. I'm using TurboGears and when I try to start my server I get the following error:

parentLink = relation(Link, primaryjoin=parentLinkId==Link.linkId)
NameError: name 'Link' is not defined

I'm new to SA.  Can someone help me out with this relation?

    -Jim

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

Reply via email to