Yassen Damyanov wrote:
>
>     def _storeProfileToCache(self, profile):
>         # this creates the object in memory, out of a dictionary:
>         newRecord = CbRecord.createFromJsonDict(self.site, profile)
>
>         # this gets a SA session:
>         sess = OrmManager().newSession()
>
>         cbRecord = sess.merge(newRecord)
>         cbRecord.modified = None      # a timestamp field that must be updated
>         sess.commit()
>         sess.close()
>
> The sess.merge() call raises that error. The test that fails tries to
> merge a CbRecord with five persons, two of which are identical to those in
> the database (same primary key). I would expect the result to be the
> database having the five persons stored and related to the same CbRecord.

I cant see here where the CbPerson record is created or how it is
associated or not with the parent CbRecord.   The error means you have a
CbPerson in your session that was just created as a pending (non-inserted)
record, and is not attached to a CbRecord.   If you require CbPerson
objects to be inserted without this attachment, don't use "delete-orphan"
cascade.

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to