MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _gen_cache_key

Method _gen_cache_key

lib/sqlalchemy/sql/lambdas.py:395–421  ·  view source on GitHub ↗
(self, anon_map, bindparams)

Source from the content-addressed store, hash-verified

393 return expr
394
395 def _gen_cache_key(self, anon_map, bindparams):
396 if self.closure_cache_key is _cache_key.NO_CACHE:
397 anon_map[_cache_key.NO_CACHE] = True
398 return None
399
400 cache_key = (
401 self.fn.__code__,
402 self.__class__,
403 ) + self.closure_cache_key
404
405 parent = self.parent_lambda
406
407 while parent is not None:
408 assert parent.closure_cache_key is not CacheConst.NO_CACHE
409 parent_closure_cache_key: Tuple[Any, ...] = (
410 parent.closure_cache_key
411 )
412
413 cache_key = (
414 (parent.fn.__code__,) + parent_closure_cache_key + cache_key
415 )
416
417 parent = parent.parent_lambda
418
419 if self._resolved_bindparams:
420 bindparams.extend(self._resolved_bindparams)
421 return cache_key
422
423 def _invoke_user_fn(self, fn: _AnyLambdaType, *arg: Any) -> ClauseElement:
424 return fn() # type: ignore[no-any-return]

Callers 1

getMethod · 0.45

Calls 1

extendMethod · 0.45

Tested by

no test coverage detected