On Apr 25, 2010, at 1:38 PM, Torsten Landschoff <torsten.landsch...@dynamore.de > wrote:

Hi everybody.

After reading the documentation on dictionary based collections at <http://www.sqlalchemy.org/docs/mappers.html#dictionary-based-collections >, I am wondering if I am the only one who things that this code is intuitive:
item = Item()
item.notes['color'] = Note('color', 'blue')
print item.notes['color']
I'd rather write
item.notes['color'] = Note('blue')
That the key is stored with the value should be an implementation detail I think. I extended sqlalchemy.orm.collections.MappedCollection with a few lines to implement this (attached).

Shouldn't something like is be included with SQLAlchemy? Or is this a bad id

You should be able to roll this yourself as a custom dictlike collection class .


Greetings, Torsten

--
DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
Torsten Landschoff

Office Dresden
Tel: +49-(0)351-4519587
Fax: +49-(0)351-4519561

mailto:torsten.landsch...@dynamore.de
http://www.dynamore.de

Registration court: Mannheim, HRB: 109659, based in Karlsruhe,
Managing director:  Prof. Dr. K. Schweizerhof, Dipl.-Math. U. Franz
--
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 .
<dictmapping.py>

--
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