Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#11654 closed (wontfix)

Allow query objects to be passed into the extra ORM method

Reported by: erikcw Owned by: nobody
Component: Database layer (models, ORM) Version:
Severity: Keywords: extra
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


It would be really handy (and probably also make ORM querys that use extra more portable) if extra() allowed "query" objects to be passed in addition to raw SQL.

For example:

In addition to:

Blog.objects.all().extra(select={'blah': 'SELECT foo FROM bar WHERE created < NOW()'})


Blog.objects.all().extra(select={'blah': Bar.objects.filter('foo').query})

Seems like a great addition to me. :-)

Change History (2)

comment:1 Changed 7 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

This is already possible using query.as_sql(), however that's an internal. In any event extra() is a down to the metal pure SQL thing, we aren't going to build up a ton of infastructure around it.

comment:2 Changed 5 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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