On May 15, 3:12 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > First off: support for GROUP BY, SUM and other aggregation functions > is a work in progress. The new QS-RF code contains placeholders to > hold GROUP BY statements, but there isn't a public API to get a GROUP > BY into your queries at present. There is a GSOC code aiming to > implement aggregates in the Django ORM, which will obviously involve > introducing GROUP BY statements into the generated SQL. > > However, other than that point, I'm afraid I don't understand what > you're proposing. You seem to be suggesting a new kind of model/query > base class that will have all the capabilities of QuerySet/Model, but > will be "raw SQL". You are evidently having some sort of performance > problem, but I'm not sure how this new "raw SQL Model" will fix this > problem. > > At the end of the day, a QuerySet is just a mechanism for producing > SQL statements. If that SQL is inefficient for some reason, we're open > to suggestions. However, I'd be highly surprised if reimplementing > QuerySet turned out to be the right solution to your problem. > > Can you give a concrete example of something that doesn't work the way > you expect? What exactly are you proposing to implement? How would > this address the problem you are having? We're not opposed to > considering any idea - but first, we need to understand what the idea > is :-)
Hello Russ, I'll try to explain my problem in-depth;) As described above the SQL-query which is used to return the data uses aggregated fields, some fields using IF and other SQL-Commands and some JOINs (also two times accessing the same tables but aliasing them which does AFAIK not work with extra(tables=[...])). The database view performs really bad, so I'm trying to relocate the SQL into the Django ORM. The problem is now, that I can't use the default QuerySet-functions to build the query I need (to use it in a custom manager) and by falling back to raw SQL I can't use the extra- and filter-commands which are supplied by Django. - Adrian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---