1. Jason Moiron
  2. johnny-cache
  3. Issues
Issue #23 new

Raw Queries Feature Request...

created an issue

In my application I'm using database functions which require me to use raw SQL:

{{{ cur = connection.cursor() cur.execute('SELECT some_func(%s,%s);', (foo, bar)) row = cur.fetchone() return row[0] }}}

Which works perfectly well, but the result isn't cached. In this case, some_func() calculates a value based on a particular table (or set of tables). It'd be nice if there was a way to execute raw SQL with some kind of helper function that ties in to the table generation mechanism for data invalidation.

{{{ foo_helper = RawSQLCacheHelper(query = 'SELECT some_func(%s,%s)', models = (get_model('Foo'),))

i = 0 for row in foo_helper.execute(foo, bar): print '%s: %s' % (i, row) }}}

Something like that.

Comments (1)

  1. Log in to comment