Opened 6 years ago

Closed 6 years ago

#29962 closed Bug (invalid)

Queryset.explain(verbose=True) doesn't work on non-PostgreSQL backend

Reported by: Mohd. Shafikur Rahman Owned by: nobody
Component: Database layer (models, ORM) Version: 2.1
Severity: Normal Keywords:
Cc: shafikshaon@…, Mohd. Shafikur Rahman Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

print(User.objects.filter(is_active=True).explain(verbose=True)) if you run this, this may throw an exception

  • expect using but it doesn't describe in documentation
  • return self.query.explain(using=self.db, format=format, options)
  • raise ValueError('Unknown options: %s' % ', '.join(sorted(options.keys())))

ValueError: Unknown options: verbose

Doc link: https://docs.djangoproject.com/en/2.1/ref/models/querysets/#explain

Change History (2)

comment:1 by Mohd. Shafikur Rahman, 6 years ago

Cc: Mohd. Shafikur Rahman added
Component: DocumentationDatabase layer (models, ORM)

comment:2 by Simon Charette, 6 years ago

Resolution: invalid
Status: newclosed
Summary: queryset explain() doesn't work with verbose=TrueQueryset.explain(verbose=True) doesn't work on non-PostgreSQL backend

As documented explain() accepts backend specific options and the the verbose=True option is PostgreSQL specific.

Some databases accept flags that can return more information about the query. Pass these flags as keyword arguments. For example, when using PostgreSQL:

I managed to get the exact same error when trying to use verbose=True with SQLite, which I assume is what you tried doing there, and get a verbose output on PostgreSQL when using the same option.

In the future please use TicketClosingReasons/UseSupportChannels to confirm your issue is a legitimate bug before filling a ticket.

Note: See TracTickets for help on using tickets.
Back to Top