mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-01 21:38:55 -04:00
baked: Support initial args for cache key
When making baked query in classmethod of declarative base,
cls should be added in cache key.
@as_declarative
class Base(object):
@classmethod
def baked_query(cls):
return bakery(lambda: session.query(cls), (cls,))
This commit is contained in:
@@ -49,8 +49,8 @@ class BakedQuery(object):
|
||||
|
||||
_bakery = util.LRUCache(size)
|
||||
|
||||
def call(initial_fn):
|
||||
return cls(_bakery, initial_fn)
|
||||
def call(initial_fn, args=()):
|
||||
return cls(_bakery, initial_fn, args)
|
||||
|
||||
return call
|
||||
|
||||
|
||||
Reference in New Issue
Block a user