Re: [sqlalchemy] Strange behaviour while trying to swap related records, or am I doing it wrong?

2013-01-08 Thread Alexey Vihorev
Thanks for the detailed explanation and the workarounds, works nicely. 2013/1/8 Michael Bayer mike...@zzzcomputing.com assuming you can try 0.8 which provides inspect(), this will show what is happening: from sqlalchemy import inspect print p.children[2] = c2 print

[sqlalchemy] Strange behaviour while trying to swap related records, or am I doing it wrong?

2013-01-07 Thread Alexey Vihorev
Hi all! I'm trying to use sqlalchemy.ext.orderinglist as per instructions here http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/orderinglist.html , and but I've encountered a loss of data while trying to swap positions of related records inside a related property list. I thought it was

Re: [sqlalchemy] Strange behaviour while trying to swap related records, or am I doing it wrong?

2013-01-07 Thread Michael Bayer
On Jan 7, 2013, at 7:05 PM, Alexey Vihorev wrote: p.children[1], p.children[2] = p.children[2], p.children[1] print(p.children) #prints [Mary, Kenny, John] yeah, without looking too deeply I'm fairly certain this is this trac ticket: http://www.sqlalchemy.org/trac/ticket/1103

RE: [sqlalchemy] Strange behaviour while trying to swap related records, or am I doing it wrong?

2013-01-07 Thread Alexey Vihorev
Tried to replace this with this, but results are the same temp1 = p.children[1] temp2 = p.children[2] p.children[2] = temp1 p.children[1] = temp2 From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: Tuesday, January 08, 2013 2:23 AM

Re: [sqlalchemy] Strange behaviour while trying to swap related records, or am I doing it wrong?

2013-01-07 Thread Michael Bayer
assuming you can try 0.8 which provides inspect(), this will show what is happening: from sqlalchemy import inspect print p.children[2] = c2 print p.children print inspect(c2).attrs.parent.history print inspect(c3).attrs.parent.history print