Hi, I would like to export a 'lookup' interface to programmers that does object caching (a bounded size cache with a LRU replacement policy) and prefetching of small tables for read-only reference data. This is a rewrite in Python over SQL Alchemy of similar functionality in Perl (originally implemented over Class::DBI)
I would like to use some general purpose and configurable mechanism such as Shove : http://pypi.python.org/pypi/shove for c in lookup(Country, [23, 45, 47, 48, 'CA', 'IE', 'FR']): print "%s %s" % (c.name, c.iso_code) Ideally, the above code should cause an initialization of a cache for 'Country' objects followed by a prefetch of all countries (as the table is small). The lookup() function would return a list of the same cardinality as the input list where the elements of the return list are the corrosponding object ref or -- in the case that the element could not be found -- None. I intend to use the session to retrieve the data, inflate the objects and so on. I am wondering where is a good place to put this kind of behavior in? a session or mapper extension? In the meantime, I will implement the behavior I want 'outside' of SA and hope that I can eventually use a native SA mechanism. thanks, pjjH --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---