Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-09-04 Thread Michael Bayer
On Sep 4, 2013, at 7:08 AM, Paul Balomiri wrote: > > My problem is related to the fact that the list values of the GBK defaultdict > are plain list types, and thus cannot fire events for operations on them. The > testcase below does not work, and, as you mentioned, no other operation on > GB

Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-09-04 Thread Paul Balomiri
Hi, First off and again, thanks for the support here. I think I can work for the momement with your proposed implementation. My problem is related to the fact that the list values of the GBK defaultdict are plain list types, and thus cannot fire events for operations on them. The testcase below do

Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-09-03 Thread Michael Bayer
On Sep 3, 2013, at 8:47 AM, Paul Balomiri wrote: > I would like to install > > event.listen(list, 'append', append_listener) > event.listen(list, 'remove', rm_listener) > > on those lists, such that the GroupByKeyCollection can modify added objects > according to the relationship it implement

Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-09-03 Thread Paul Balomiri
Hi, Trying to advance on this issue i wrote an InstrumentedList which shall: * hold only values sharing the same key as defined by a property on the values * change that property to the list value upon insertion * set the property to whatever null value is defined when the value is removed from t

Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-08-17 Thread Michael Bayer
On Aug 15, 2013, at 7:32 AM, Paul Balomiri wrote: > Hi, > > Thank you for the elaborated Answer ! > > I am trying to implement a general solution for the key->list problem > using events. > > basically i want to instrument for GroupByKeyCollection any changes > relevant to the keyfunc. > > s

Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-08-15 Thread Paul Balomiri
Hi, Thank you for the elaborated Answer ! I am trying to implement a general solution for the key->list problem using events. basically i want to instrument for GroupByKeyCollection any changes relevant to the keyfunc. say we have p= Person() p._address_by_role['r1']= [PersonToAddress(address=A

Re: [sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-08-13 Thread Michael Bayer
On Aug 13, 2013, at 11:44 AM, Paul Balomiri wrote: > I would like to get a list as value for the dict, such that i can > assign more than one entity to any one key. The output should look > like this: > {u'home': [,] , > u'work': []} > > Now in the database whenever i set a new value for a key(

[sqlalchemy] attribute_mapped_collection use as a key->list dictionary

2013-08-13 Thread Paul Balomiri
sorry for having forgot to add a subject 2013/8/13 Paul Balomiri : > Hi, > > I am trying to build an attribute_mapped_collection reference from > table people (Mapped class is called Person). However, I would like to > get a list of entities for each key. > > I have the following tables with the r