1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35294 -- Fixed TEXT format of QuerySet.explain() for long plans.

co-authored-by: Gordon <gordon.wrigley@gmail.com>
co-authored-by: Simon Charette <charette.s@gmail.com>
This commit is contained in:
Adam Johnson
2024-03-13 18:10:54 +00:00
committed by Mariusz Felisiak
parent 593067a8ee
commit cbf1e87398
2 changed files with 15 additions and 5 deletions

View File

@@ -1621,11 +1621,12 @@ class SQLCompiler:
# tuples with integers and strings. Flatten them out into strings.
format_ = self.query.explain_info.format
output_formatter = json.dumps if format_ and format_.lower() == "json" else str
for row in result[0]:
if not isinstance(row, str):
yield " ".join(output_formatter(c) for c in row)
else:
yield row
for row in result:
for value in row:
if not isinstance(value, str):
yield " ".join([output_formatter(c) for c in value])
else:
yield value
class SQLInsertCompiler(SQLCompiler):