(
self,
dialect: Dialect,
*,
compiled_cache: Optional[CompiledCacheType],
column_keys: List[str],
for_executemany: bool = False,
schema_translate_map: Optional[SchemaTranslateMapType] = None,
**kw: Any,
)
| 677 | return self |
| 678 | |
| 679 | def _compile_w_cache( |
| 680 | self, |
| 681 | dialect: Dialect, |
| 682 | *, |
| 683 | compiled_cache: Optional[CompiledCacheType], |
| 684 | column_keys: List[str], |
| 685 | for_executemany: bool = False, |
| 686 | schema_translate_map: Optional[SchemaTranslateMapType] = None, |
| 687 | **kw: Any, |
| 688 | ) -> typing_Tuple[ |
| 689 | Compiled, Optional[Sequence[BindParameter[Any]]], CacheStats |
| 690 | ]: |
| 691 | elem_cache_key: Optional[CacheKey] |
| 692 | |
| 693 | if compiled_cache is not None and dialect._supports_statement_cache: |
| 694 | elem_cache_key = self._generate_cache_key() |
| 695 | else: |
| 696 | elem_cache_key = None |
| 697 | |
| 698 | extracted_params: Optional[Sequence[BindParameter[Any]]] |
| 699 | if elem_cache_key is not None: |
| 700 | if TYPE_CHECKING: |
| 701 | assert compiled_cache is not None |
| 702 | |
| 703 | cache_key, extracted_params = elem_cache_key |
| 704 | key = ( |
| 705 | dialect, |
| 706 | cache_key, |
| 707 | tuple(column_keys), |
| 708 | bool(schema_translate_map), |
| 709 | for_executemany, |
| 710 | ) |
| 711 | compiled_sql = compiled_cache.get(key) |
| 712 | |
| 713 | if compiled_sql is None: |
| 714 | cache_hit = dialect.CACHE_MISS |
| 715 | compiled_sql = self._compiler( |
| 716 | dialect, |
| 717 | cache_key=elem_cache_key, |
| 718 | column_keys=column_keys, |
| 719 | for_executemany=for_executemany, |
| 720 | schema_translate_map=schema_translate_map, |
| 721 | **kw, |
| 722 | ) |
| 723 | compiled_cache[key] = compiled_sql |
| 724 | else: |
| 725 | cache_hit = dialect.CACHE_HIT |
| 726 | else: |
| 727 | extracted_params = None |
| 728 | compiled_sql = self._compiler( |
| 729 | dialect, |
| 730 | cache_key=elem_cache_key, |
| 731 | column_keys=column_keys, |
| 732 | for_executemany=for_executemany, |
| 733 | schema_translate_map=schema_translate_map, |
| 734 | **kw, |
| 735 | ) |
| 736 |
nothing calls this directly
no test coverage detected