On Dec 17, 2009, at 2:35 PM, Daishy wrote:
> Hi again,
>
> I took the approach with creating a Mixin with 4 staticmethods and
> call them in each of my models, which works quite good. But now i face
> another, i think related, problem.
> i get the following columns produced:
>
> created_by_id = Column(Integer, ForeignKey('worker.id',
> onupdate="cascade", ondelete="restrict"))
> updated_by_id = Column(Integer, ForeignKey('worker.id',
> onupdate="cascade", ondelete="restrict"))
> created_by = relation('worker')
> updated_by = relation('worker')
>
> Now sqlalchemy is throwing an exception, because the join-conditions
> are not clear. Ok, so i have to add a primaryjoin-expression on the
> relations. But how?
> They should be specified like relation('worker',
> primaryjoin=worker.c.id==???.c.created_by_id), but in my Mixin-Class i
> dont know what ??? is, because it changes depending on the class using
> the mixin. I could specify a parameter for these two static methods,
> but thats another step making things more complicated, so i want to
> avoid that if possible. Any advice?
right. see why I recommend just placing the Column objects on each class
explicitly ?
--
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.