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

Method _gen_cache_key

lib/sqlalchemy/sql/elements.py:4485–4505  ·  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

4483 }
4484
4485 def _gen_cache_key(
4486 self, anon_map: anon_map, bindparams: List[BindParameter[Any]]
4487 ) -> Optional[typing_Tuple[Any, ...]]:
4488 """generate a cache key for the given element, substituting its bind
4489 values for the translation values present."""
4490
4491 existing_bps: List[BindParameter[Any]] = []
4492 ck = self.element._gen_cache_key(anon_map, existing_bps)
4493
4494 bindparams.extend(
4495 (
4496 bp._with_value(
4497 self.translate[bp.key], maintain_key=True, required=False
4498 )
4499 if bp.key in self.translate
4500 else bp
4501 )
4502 for bp in existing_bps
4503 )
4504
4505 return ck
4506
4507
4508_FrameIntTuple = tuple[int | None, int | None]

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