Hi,

I have the following model.

class Tag(Entity):
  tag=Field(String,unique=True)

class Link(Entity):
  address=Field(String)
  tags=ManyToMany('Tag')

Let's say I execute the following instructions:
Link(address='http://
www.google.com',tags=[Tag(tag='search'),Tag(tag='engine')])
session.commit()

In this moment (if everything goes as expected) my model_tag table has
two entries search and engine and also the model_link has one record,
the google page.

Now let's say that I want to add another link. Now is the place where
my issue starts.

Link(address='http://
www.yahoo.com',tags=[Tag(tag='search'),Tag(tag='site')])
session.commit()

The problem is that in this form, Elixir will try to insert into the
tags table another entry of the 'search' tag, which is unacceptable
due to the unique constraint. I would like to know how to tell Elixir
to fetch transparently the id of the 'search' tag  and add it to the
realation table for address-tag.

Thank you,
Mihai
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to