Thanks for quick response.
Yes we had a discussion on this list
(http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg12897.html),
but I didn't went deeper into why it happens and just used
"dependencies" what worked great for me.

I will try to use the code you gave.
What I can do later is I can prepare a test case for you with my db
schema + relations, everything else stripped, so you can see (or I
can) why and where the issue occurs.

Thanks - Tomasz

PS. Can I upload files to the list somehow? As attachments maybe?



On Wed, May 19, 2010 at 4:15 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> ah, you should be able to get the same effect using 
> uowtrans.dependencies.add((parent_mapper, child_mapper)).
>
> did we already have a big discussion about why you can't get your relation()s 
> to handle this for you ?
>
>
>
> On May 19, 2010, at 4:00 AM, Tomasz Nazar wrote:
>
>> On Sat, Jan 17, 2009 at 3:40 AM, Michael Bayer <mike...@zzzcomputing.com> 
>> wrote:
>>> On Jan 16, 2009, at 6:13 PM, Tomasz Nazar wrote:
>>>
>>>>
>>>> Do I have control over this behaviour? Or am I doing sth wrong?
>>>> Thanks for any help..Tomasz
>>>
>>>
>>> you can !   its an exposed internal API but its pretty stable for
>>> now.  Build a SessionExtension like this:
>>>
>>> from sqlalchemy.orm.interfaces import SessionExtension
>>>
>>> class SetupDependencyExt(SessionExtension):
>>>     def before_flush(self, session, flush_context, instances):
>>>         flush_context.register_dependency(class_mapper(A),
>>> class_mapper(B))
>>>
>>> where "A" is the mapper that should execute first.   then configure
>>> that extension with your sessionmaker(extension=SetupDependencyExt()).
>>
>> Hi Mike,
>> I'm migrating from 0.4 to 0.6 and this API has been removed - at least
>> looks like this. Is there any replacement?
>> I'd still like SQLA to generate some INSERT statements before others,
>> as it looks SQLA0.4 could'nt handle mappers/relations/dependencies I
>> have...
>> This code worked well for me till now...
>>
>> Code I have is:
>>
>> sessionmaker(...extension=SetupDependencyExt())
>>
>> class SetupDependencyExt(SessionExtension):
>>    
>> """http://groups.google.com/group/sqlalchemy/browse_thread/thread/2420cbf64ff5a74f
>>    For controlling order of inserts generation for dependent children
>> by relation
>>    """
>>    def before_flush(self, session, flush_context, instances):
>>        flush_context.register_dependency(mapper_conference_lang,
>> mapper_conference_participant)
>>        flush_context.register_dependency(mapper_conference_lang,
>> mapper_conference_interpreter)
>>
>> AttributeError: 'UOWTransaction' object has no attribute 
>> 'register_dependency'
>>
>> I'd really appreciate any help, as I can't move forward without it.
>> Thanks - Tomasz
>>
>>
>> --
>> _i______'simplicity_is_the_key'__________tomasz_nazar
>> _ii____'i_am_concern_oriented'________________JKM-UPR
>> _iii__'patsystem.sf.net'___________________linux_user
>> _'aspectized.com'___________________________prevayler
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To post to this group, send email to sqlalch...@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.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
>
>



-- 
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'________________JKM-UPR
_iii__'patsystem.sf.net'___________________linux_user
_'aspectized.com'___________________________prevayler

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