6 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Column name override...
FromSent OnAttachments
kremlan28 May 2008 15:10 
Michael Bayer28 May 2008 15:16 
kremlan28 May 2008 16:16 
Michael Bayer28 May 2008 17:46.py
Brad Wells29 May 2008 08:58.py
Michael Bayer29 May 2008 10:55 
Subject:[sqlalchemy] Re: Column name override with a relation requiring a primaryjoin
From:Brad Wells (krem@gmail.com)
Date:05/29/2008 08:58:27 AM
List:com.googlegroups.sqlalchemy
Attachments:

Thank you very much for your help. The post_update=True addition is what I was missing.

The test case I was using was c1.created_by = c1 where created_by was previously null. (c1 having previously been saved and flushed) This seems to be the one corner case where post_update=True was necessary.

I have attached a script to demonstrate the problem I encountered. I don't know if this is expected or known behavior or not, but it was certainly confusing to me. I would assume that saving against a null vs non-null value should not result in different behavior.

Thank you again.

-brad

On May 28, 8:47 pm, Michael Bayer <mike@zzzcomputing.com> wrote:

Here's a script which exercises your mapping against 0.4 - the remote_side should be on the "many-to-one" side of "updated_by".

Addtionally, depending on what kind of combinations of Contact objects you want to store, you might run into the scenario where ContactA references ContactB, and ContactB references ContactA. Theres no way to INSERT data like that without an UPDATE (assuming FK integrity and no sequences), so SQLA wants you to use a flag called "post_update" if that occurs. It needs the flag if the co-dependent items are being UPDATEd too since it works out dependencies for UPDATE and INSERTs in the same way...this is something that could perhaps be improved upon. So the second half of the script illustrates that mapping as an alternative.

cyclical_contacts.py 3KDownload