On Jan 15, 2008 6:54 PM, Michael Bayer <[EMAIL PROTECTED]> wrote:
> > The last commit fails with:
> > sqlalchemy.exceptions.IntegrityError: (IntegrityError)
> > Referers.objectId may not be NULL u'UPDATE "Referers" SET "objectId"=?
> > WHERE "Referers".id = ?' [None, 1]
>
> right thats because the instance doesnt exist yet.  its better for you
> to just use the straight ahead query.get(), if None then save()
> approach.

Do you mean obj2 (id of which should go to objectId column in this
UPDATE)? If so, why it doesn't exist? It's saved (updated in fact)
just several lines above, so it must be both in DB and in session.

The last lines of the original test case for convenience:
[...]
obj2 = replace(session, ModelObject(1, u'title2'))
session.commit()

ref2 = ModelReferer(1, obj2)
replace(session, ref2)
session.commit()

--~--~---------~--~----~------------~-------~--~----~
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