Marcin is correct. The plan is to extend the concept of expressions so that you have more control over crafting your own queries.
What we have: - select expressions - aggregation expressions - case/when - order by - where expressions (lookups/transforms) - column expressions (representing model fields) What we need: - more control over joins - more control over subqueries - maybe analytical structures? row_number (over ..) I'd be very interested in seeing proposals that aim to improve user control over joins and subqueries specifically. Once we've locked those down, we can remove .extra and probably .raw. Personally, the SQL template isn't something I like or would use. You might have some success with users that need highly tailored queries until we implement the missing constructs above, but I would not consider it appropriate for django core. We're not trying to rid ourselves of work arounds (extra() and raw()) just to introduce newer work arounds. I would encourage you to develop this as a 3rd party library if it's something you'd find useful. I'm certain there will be others that'll find it useful. Regards, On Friday, 28 August 2015 06:20:28 UTC+10, Marcin Nowak wrote: > > > > On Thursday, August 27, 2015 at 9:43:40 PM UTC+2, Alexey Zankevich wrote: >> >> For such cases it's great to have DSL to build SQL queries, but it's a >> big question how low- or high-level language should be. >> > > Take a look at SQLAlchemy`s expressions API. The ORM is built top of it. > I think that Django` developers will continue extending expressions API > (F(), Q(), Func(), and so on) to make query language more flexible. > > Regards, > Marcin > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9a285b63-0539-4a35-878a-a25794a1f56c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.