you're missing a ForeignKey column back to your category_id.

Kees van den Broek wrote:
>
> Hi,
>
> This is a table setup in declarative style:
>
> class Category(DeclarativeBase):
>     __tablename__ = 'category'
>     category_id = Column(Integer, autoincrement=True,
> primary_key=True)
>     name = Column(Unicode(255), unique=True, nullable=False)
>     children = relation('Category', backref=backref('parent',
> remote_side=[category_id]))
>
> When creating the database, this is the error I see:
>
> sqlalchemy.exc.ArgumentError: Could not determine join condition
> between parent/child tables on relation Category.children.  Specify a
> 'primaryjoin' expression.  If this is a many-to-many relation,
> 'secondaryjoin' is needed as well.
>
> I suppose I could follow the examples and setup a separate mapper for
> the self referential part, but I'd like to know how to do it in the
> declarative style.
>
> Thanks,
> Kees
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
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