[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? > 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) I currently have no idea on how to make it better (less writing?) Also documenting extension interface is in to do list. > 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. > think of generic report calculations/aggregations, and putting those > into some cacheing table. > Eventualy getting the report being built on-the-run - distributing the > big wait over the atomary updates. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
