I don't use Elixir but I think it's strange that you are creating both
"inverse" as well as distinct OneToMany/ManyToOne's with the same name each
time here ("owned_projects", "created_projects", "client", "creator"). I
think you probably only have to specify "inverse", assuming that's the same as
a backref.
Note the examples at
http://docs.sqlalchemy.org/en/latest/orm/relationships.html#one-to-many and
similar illustrate how "backref" replaces the usage of relationship(). Elixir
is likely similar.
As far as how to specify use_alter and post_update with "inverse", I'm not
sure. In plain SQLAlchemy you use the backref() function.
On Feb 17, 2012, at 9:30 AM, Jakob D. wrote:
> Finally found a link that wasn't broken:
> http://docs.sqlalchemy.org/en/rel_0_5/mappers.html#rows-that-point-to-themselves-mutually-dependent-rows
>
> But I tried using post_update=True as well, but it gave the same error:
>
> class Project(Entity):
> id = Field(String(100), primary_key=True)
> workers = OneToMany('User')
> client = ManyToOne('User', post_update=True,
> inverse='owned_projects')
> creator = ManyToOne('User', post_update=True,
> inverse='created_projects')
>
> class User(Entity):
> username = Field(String(80), primary_key=True)
> assigned_project = ManyToOne('Project', post_update=True,
> use_alter=True, inverse='workers')
> owned_projects = OneToMany('Project', use_alter=True,
> inverse='client')
> created_projects = OneToMany('Project', use_alter=True,
> inverse='creator')
>
> Am I missing something?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sqlalchemy/-/xDVBO-iBoRIJ.
> 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.
--
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.