Morning All,

 

I've got an issue here which I'm looking to get some advice on. I have an
object which has multiple relations with the same child object and when
saving it I get a duplicate key error. The relationship looks something like
this:

 

Company -----------------> Address. (one)

|

|

|

V

Staff (many)

|

|

|

|

V

Address (one)

 

Notice how Company object contains one instance of a Address object and
multiple instances of Staff objects, each Staff object then has an instance
of an Address object within it.

 

All I'm doing here is adding Company object to a session and then committing
it, however, if the company objects Address object is the same as one of the
staffs Address objects then I get the key error.

 

Is there any way to easily avoid this? Or is this because my object
relations are poorly designed and I shouldn't have this double relationship
chain to an Address object?

 

I'd really appreciate your input on this one guys,

 

Many thanks,

 

Heston


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to