Michael Bayer wrote:
> any chance we can see an example of what kind of usage youre looking for ?
>  i thought we just were talking about adding an "order by" property to an
> ActiveMapper relation (which is pretty trivial) ?

It's pretty trivial, except that the order_by value is expected to be a 
a table column (or a list of table columns) rather than a string -- so 
it needs the same kind of logic that's done for resolving relations 
(since using ActiveMapper allows classes to be specified before all the 
Table objects they refer to exist, parts of the class initialization may 
need to be deferred until the relevant tables are defined; the same 
thing applies here, since the tables whose columns we're ordering by may 
not exist yet[*]).

Adding support for arbitrary additional values (as opposed to just 
sort_order) is even more hairy, since we don't know which arguments the 
mapper may accept in the future -- hence, support for search-and-replace 
to find reference objects and replace them with actual tables or columns 
once the tables and their columns have been defined.

My work-in-progress code is at home right now and I'm at work, so I 
don't have ready access to examples; if the above hasn't answered your 
questions adequately, I'll be able to post again w/ examples this evening.


[*] - Thinking about it further, though, such tables may in fact always 
exist by this point since the class which is referencing them for sort 
order will also be referencing them via a relation, which causes a deferral.


_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to