On Dec 31, 2005, at 8:00 PM, Jonathan Ellis wrote:
I don't understand the M-to-M use case. Do you just mean that it
makes the order of a list of related objects deterministic? If so
I would submit that the Right Thing would be to make the related
objects a set rather than a list; let the user create a sorted list
himself if he really wants it (presumably he will have a criterion
that makes sense), but imposing an arbitrary order on something
that is inherently setlike doesn't make sense to me.
the list of related objects is a Set already, it sort of has to be
for eager loading to work in all cases. The ordering I am going for
is the insert order, so its not so arbitrary, i.e.:
foo = Foo('foo1')
foo.stuff.append(Bar('one'))
foo.stuff.append(Bar('two'))
foo.stuff.append(Bar('three'))
objectstore.clear()
foo2 = Foo.mapper.get_by(name='foo1')
assert_(foo2.stuff == [Bar('one'), Bar('two'), Bar('three')])
So its not a big deal for Foo.stuff to have user-defined sorting
added to it, or the mapper/relations are set up with explicit
"order_by" parameter which I need to add to the docs, I was just
going for the extra wow/convenience factor on this one (also makes
the unit tests easier to write).
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users