[EMAIL PROTECTED] wrote:
> some comments...
>   
> - u can at least get that 'if...mysql' out of the actual code, just 
> define a global if_func( usualargs, aggregator=None) and do swicthing 
> inside there. Or, better, define the if_func() as method on the 
> aggregator itself (that is, the mapperExtension?) thus separating 
> somewhat implementation from usage.
>   
Moved min and max to the aggregator. I woder if I can cache
database type in MapperExtension, or it can be changed
sometimes (e.g. ".tometadata()", or metadata.bind = eng) ?
> - Max.onupdate will recurse forever in the else:
>   
Fixed
> - the min/max has to be redone not to use maxint (or any other 
> machine/value limit) - one 'if' more..
>   
Fixed with max(ifnull(a, b-1), b). Should be ok. There is no
"IF" in sqlite.
> - why returning a dict if it never contains more than 1 value? 
> it clutters your code a lot... maybe 'return something' or None (or 
> raise something) would be better.. eventualy making some generic 
> updater like:
>
> def do_updates( self, instance, table, fields, method, condition):
>    updates = {}
>    for f in fields:
>       r = getattr( f, method)( self, instance)
>       if r is not None: updates[ f.target.name] = r
>    table.update( condition, values=updates).execute()
>   
Were done with average() in mind, which needs to update 2 fields.
Above solution don't work for that. I thought about passing
dict and allow mutating it, or yielding key,value pairs, but that
whould do even more cluttered code.
> ah, nevermind.
Thanks for great review!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to