On Nov 9, 2007, at 4:23 PM, Manlio Perillo wrote:

>
> Michael Bayer ha scritto:
>> Sorry, I forgot to add that the mappers A and B must have a  
>> relation()
>> specified in order for unit of work to determine the order of
>> operations.  this has always been the case in all versions.
>> illustrated in the attached script.
>>
>
> But I have a piece a code that works with SQLAlchemy 0.3.6 and fails
> with never versions.
>
> The schema is at:
> http://hg.mperillo.ath.cx/nweb/nauth/file/68ab5b8e71f8/nauth/schema.py
> and the code is at:
> http://hg.mperillo.ath.cx/nweb/nauth/file/68ab5b8e71f8/test/test_nauth.py
>
> in the test suit named RealmTestCase (in the setUp method) column 248.

Well thats a lot of code to read, but I can see that your mappers have  
no relations set between them.  SQLAlchemy has never made any  
guarantees of insert order among two different tables that have no  
explicitly defined relation to each other at the mapper level; and in  
fact the test case I posted earlier still inserts into B before A even  
on 0.3.6.  If your application save()s A and B, which have no  
relation() to each other, and it requires that A be inserted before B,  
you are relying on behavior that is currently undefined.  If your app  
runs on 0.3.6 with linux, I bet it would fail on OSX which usually  
orders dictionaries differently than the same app would on linux.

this is not to say it might be an *interesting* feature for mappers to  
take foreign keys on tables which have no corresponding relation()  
into account when flushing, although i think it might be somewhat  
surprising behavior and id be concerned about the feature adding  
unnecessary complexity.

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

Reply via email to