Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#11654 closed (wontfix)

Allow query objects to be passed into the extra ORM method

Reported by: ErikW 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: no UI/UX: no

Description

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()'})

accept:

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

Seems like a great addition to me. :-)

Change History (2)

comment:1 by Alex Gaynor, 15 years ago

Resolution: wontfix
Status: newclosed

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 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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