Matthieu Imbert wrote:
> Hi,
>
> sqlalchemy.exc.ArgumentError: Entity.creator and back-reference
> Client.entities_created are both of the same direction <symbol
> 'ONETOMANY>.
> Did you mean to set remote_side on the many-to-one side?
>
> relation(Client,
> collection_class = set,
> primaryjoin = entity_table.c.id_creator ==
> entity_table.c.id,
> foreign_keys = [entity_table.c.id_creator],
> backref = sqlalchemy.orm.backref('entities_created',
> foreign_keys = [entity_table.c.id]))})
>
> I looked at other mails mentionning this exception (notably:
> http://groups.google.com/group/sqlalchemy/browse_thread/thread/232305afeab6ea18/6d10fe9712b3fdef?lnk=gst&q=both+of+the+same+direction#6d10fe9712b3fdefand
> http://groups.google.com/group/sqlalchemy/browse_thread/thread/d183b378c38448bf/0d96e44d92d7a45d?lnk=gst&q=both+of+the+same+direction#0d96e44d92d7a45d)
> so i added the explicit foreign_keys declaration in the backref
> 'entities_created', but the problem is still there.
"remote_side" referenced in the error message as well as the google groups
messages you reference is an actual option you can set on relation() and
backref(), and is required any time you have a self-referential
many-to-one relation. Since Client->Entity is self-referential and m2o
its required, as "remote_side=Entity.id" (or entity_table.c.id).
>
> any help appreciated [?]
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---