MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _gen_cache_key

Method _gen_cache_key

lib/sqlalchemy/sql/elements.py:4189–4209  ·  view source on GitHub ↗

generate a cache key for the given element, substituting its bind values for the translation values present.

(
        self, anon_map: anon_map, bindparams: List[BindParameter[Any]]
    )

Source from the content-addressed store, hash-verified

4187 }
4188
4189 def _gen_cache_key(
4190 self, anon_map: anon_map, bindparams: List[BindParameter[Any]]
4191 ) -> Optional[typing_Tuple[Any, ...]]:
4192 """generate a cache key for the given element, substituting its bind
4193 values for the translation values present."""
4194
4195 existing_bps: List[BindParameter[Any]] = []
4196 ck = self.element._gen_cache_key(anon_map, existing_bps)
4197
4198 bindparams.extend(
4199 (
4200 bp._with_value(
4201 self.translate[bp.key], maintain_key=True, required=False
4202 )
4203 if bp.key in self.translate
4204 else bp
4205 )
4206 for bp in existing_bps
4207 )
4208
4209 return ck
4210
4211
4212class _OverRange(Enum):

Callers

nothing calls this directly

Calls 3

_with_valueMethod · 0.80
_gen_cache_keyMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected