Delete the 3rd class and use ManyToMany it will create the 3rd table automagically
--
You received this message because you are subscribed to the Google Groups "SQLElixir" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlelixir+...@googlegroups.com.
To post to this group, send email to sqle...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlelixir.
For more options, visit https://groups.google.com/groups/opt_out.
So if I create a ManyToMany relationship, I see it creates the intermediate table, but now I don't know how to query, join, or even create now.class User(Entity):email = Field(UnicodeText)image = ManyToMany('Image')class Image(Entity):url = Field(UnicodeText, unique=True)So before I just created a relationship entity for reference from the user to the the image. What's the syntax to do that now? Am I just using normal sqlalchemy then on the intermediate table for inserts and queries? If not, how do I use the user entity to add a link to a given image? And how do I query the created links for a given user? Just use the user id?
On Sun, Jan 19, 2014 at 3:14 AM, Josh Stratton <stratto...@gmail.com> wrote:
So if I create a ManyToMany relationship, I see it creates the intermediate table, but now I don't know how to query, join, or even create now.class User(Entity):email = Field(UnicodeText)image = ManyToMany('Image')class Image(Entity):url = Field(UnicodeText, unique=True)So before I just created a relationship entity for reference from the user to the the image. What's the syntax to do that now? Am I just using normal sqlalchemy then on the intermediate table for inserts and queries? If not, how do I use the user entity to add a link to a given image? And how do I query the created links for a given user? Just use the user id?Please see the tutorial:Section 6: ManyToMany...There you will see the example how to use it. the join is implicit, you use the properys as lists.
Is this helpful?