On Wednesday 08 August 2007 12:18:24 Paul Colomiets wrote: > [EMAIL PROTECTED] wrote: > > hi, i have similar idea/need within dbcook, although on a > > somewhat higher level: > > <pre> > > cache_results/: (dbcook/SA) add-on for automaticaly-updated > > database denormalisation caches of intermediate results, each one > > depending on particular pattern of usage. Wishful syntax: > > > > class SomeCacheKlas( Base): > > fieldname = cache_aggregator( klas.field, > > AggrFilterCriteria) #e.g. > > #class Cache4averagePerson( Base): > > #age = cache_agregators.Average( Person.age, Filter1 ) > > #salary = cache_agregators.Sum( Person.salary, Filter2 ) > > </pre> > > i was thinking on using triggers and/or sql-functions but then > > this is just one way to do it - and the idea is to hide the > > implementation. > > I've seen that, but found no code. > Is it something only planned for dbcook? yes, to-be-done, as a way to avoid DB to become denormalized in some particular unplanned/uncontrolled way, that fits some reports and screws all else. It takes me a great fight to convince users that denormalization is out of app's bare model... its something u lay over it.
> > Can your implementation be extended to use: > > a) more complex aggregator expressions (e.g. average(), that is > > sum() / count(), and similar dependencies) > > Definetly can. Now you can just use property for that: > avg = property(lambda self: self.sum / self.count) naaah, sorry, that was too easy. i mean more complex aggregation functions... i guess it can, if u can do sum=sum+x, then u could do sq=sq+x*x/2 > > b) more complex filters - e.g. not max() on all rows, but on > > some subset/select > > Yes. I'm looking for syntax for that. Functionality seems > very similar for `relation()` so may be > `a.Max(...,primaryjoin=...)` would do. hmmm... relation... yess, it is like a plural relation but getting a singular result out of it, and never ever loading the items. Are u using something along PropertyLoader? ciao svil --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---