class documentation

class CacheKey(namedtuple('CacheKey', ['key', 'bindparams'])):

View In Hierarchy

The key used to identify a SQL statement construct in the SQL compilation cache.

Method to​_offline​_string Generate an "offline string" form of this .CacheKey
Class Method ​_diff​_tuples Undocumented
Method __eq__ Undocumented
Method __hash__ CacheKey itself is not hashable - hash the .key portion
Method __str__ Undocumented
Method ​_apply​_params​_to​_element Undocumented
Method ​_diff Undocumented
Method ​_generate​_param​_dict used for testing
Method ​_whats​_different Undocumented
def to_offline_string(self, statement_cache, statement, parameters):

Generate an "offline string" form of this .CacheKey

The "offline string" is basically the string SQL for the statement plus a repr of the bound parameter values in series. Whereas the .CacheKey object is dependent on in-memory identities in order to work as a cache key, the "offline" version is suitable for a cache that will work for other processes as well.

The given statement_cache is a dictionary-like object where the string form of the statement itself will be cached. This dictionary should be in a longer lived scope in order to reduce the time spent stringifying statements.

@classmethod
def _diff_tuples(cls, left, right):

Undocumented

def __eq__(self, other):

Undocumented

def __hash__(self):
CacheKey itself is not hashable - hash the .key portion
def __str__(self):

Undocumented

def _apply_params_to_element(self, original_cache_key, target_element):

Undocumented

def _diff(self, other):

Undocumented

def _generate_param_dict(self):
used for testing
def _whats_different(self, other):

Undocumented