diff options
| author | Adam Johnson <me@adamj.eu> | 2021-09-14 18:08:19 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-17 07:15:12 +0200 |
| commit | fc91ea1e50e5ef207f0f291b3f6c1942b10db7c7 (patch) | |
| tree | ca675d46dcd256ad638d30e48763361e6eb2dd3d /django/db/models/sql/query.py | |
| parent | 2931d847c246b6f499993e370f6d9a53a83120d2 (diff) | |
Refs #27624 -- Changed Query.explain_info to namedtuple.
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 433824044d..9427c05c21 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -136,6 +136,9 @@ class RawQuery: self.cursor.execute(self.sql, params) +ExplainInfo = namedtuple('ExplainInfo', ('format', 'options')) + + class Query(BaseExpression): """A single SQL query.""" @@ -227,9 +230,7 @@ class Query(BaseExpression): self._filtered_relations = {} - self.explain_query = False - self.explain_format = None - self.explain_options = {} + self.explain_info = None @property def output_field(self): @@ -545,9 +546,7 @@ class Query(BaseExpression): def explain(self, using, format=None, **options): q = self.clone() - q.explain_query = True - q.explain_format = format - q.explain_options = options + q.explain_info = ExplainInfo(format, options) compiler = q.get_compiler(using=using) return '\n'.join(compiler.explain_query()) |
