[sqlalchemy] Re: moving an object

2009-04-18 Thread jean-philippe dutreve
Hi, any chance to have a fix for this? On 6 avr, 17:16, Michael Bayer mike...@zzzcomputing.com wrote: OK in fact this can possibly be implemented if the initiator passed during attribute mutation operations consisted of not just an AttributeImpl but also a target instance, so that

[sqlalchemy] Re: moving an object

2009-04-18 Thread Michael Bayer
if we had some help. the next time I have time to work on SQLAlchemy the 0.6 release is my top priority. this particular issue is a behavioral quirk with multiple, straightforward workarounds, and it also not entirely clear if continuing event chains in the manner I'm proposing is even

[sqlalchemy] Re: moving an object

2009-04-06 Thread jean-philippe dutreve
Currently, I use accountA.remove(entry) and I have rewritten insort to bypass the bug you say. So, AFAIK, whereas an entry has only one account (via entry.account_id), SA can't remove the first relation. It's dangerous, because if developer forget to remove the first relation, the entry is

[sqlalchemy] Re: moving an object

2009-04-06 Thread Mike Conley
So, we would like SA to have some kind of operation like reparent_item() that would move an object from one relation to another. It seems to me that this is is better handled as a piece of application business logic. In this case, provide a move_entry() function that properly encapsulates

[sqlalchemy] Re: moving an object

2009-04-06 Thread jean-philippe dutreve
The object doesn't move from one relation to another : this is the same relation 'entries' but on a different parent. This is common to any parent.child pattern, not a business specific case. The current behavior is not consistent because as soon as we commit() + refresh(), the object is not on

[sqlalchemy] Re: moving an object

2009-04-06 Thread Michael Bayer
im slightly confused. the backref should be automatically reparenting, not sure if ordering_list interferes with that, but in any case after you flush()/expire() or commit(), it will definitely happen since all collections will load fresh. Mike Conley wrote: So, we would like SA to have

[sqlalchemy] Re: moving an object

2009-04-06 Thread jean-philippe dutreve
It would be fine/safe that accountA has entry removed BEFORE any reload (with explicit refresh/expire/commit). I can't remember, but a previous version of SA had this behavior. On Apr 6, 4:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: im slightly confused.  the backref should be

[sqlalchemy] Re: moving an object

2009-04-06 Thread Michael Bayer
OK in fact this can possibly be implemented if the initiator passed during attribute mutation operations consisted of not just an AttributeImpl but also a target instance, so that append/remove/set operations can have the information they need continue down the chain of events without exiting

[sqlalchemy] Re: moving an object

2009-04-05 Thread jason kirtland
jean-philippe dutreve wrote: Hi all, I wonder if SA can handle this use case: An Account can contain Entries ordered by 'position' attribute. mapper(Account, table_accounts, properties = dict( entries = relation(Entry, lazy=True, collection_class=ordering_list ('position'),