Removed leftover KeyError handling after Query.tables attribute cleanup.

Follow up from f7f5edd50d.
This commit is contained in:
nessita 2024-07-15 16:20:24 -03:00 committed by GitHub
parent 27043bde5b
commit 082fe2b5a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 7 deletions

View File

@ -1134,15 +1134,9 @@ class SQLCompiler:
"""
result = []
params = []
for alias in tuple(self.query.alias_map):
for alias, from_clause in tuple(self.query.alias_map.items()):
if not self.query.alias_refcount[alias]:
continue
try:
from_clause = self.query.alias_map[alias]
except KeyError:
# Extra tables can end up in self.tables, but not in the
# alias_map if they aren't in a join. That's OK. We skip them.
continue
clause_sql, clause_params = self.compile(from_clause)
result.append(clause_sql)
params.extend(clause_params)