From 6dc06ab9b9fc4254a9b63f6812cda64bf605f7fd Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Mon, 16 Feb 2015 19:56:30 +0100 Subject: [PATCH] Use table names instead of aliases to prevent unnecessary cache sets. --- cachalot/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cachalot/utils.py b/cachalot/utils.py index a22e3dc..89dc3df 100644 --- a/cachalot/utils.py +++ b/cachalot/utils.py @@ -89,7 +89,8 @@ def _get_table_cache_keys(compiler): query = compiler.query using = compiler.using - tables = set(query.tables) + tables = set([join_info.table_name + for join_info in query.alias_map.values()]) tables.add(query.model._meta.db_table) if query.extra_select or any([isinstance(c, ExtraWhere) for c in query.where.children]):