I do not really get what you mean under reusable raw query factory.
But object manager's method raw() returns RawQueryManager, which is
pretty useless.
When you first mentioned raw SQL I considered it and made method I
write to get SQL query after all join() and extra() calls were done
and return raw() called with modified SQL query.

But the whole point of my work now is to change object manager method
implementation, leaving it's interface untampered. Otherwise there
will be really a lot of work.

I commented it, the method is covered with tests, so I hope for a
best.

On 2 июл, 01:31, Michal Petrucha <[email protected]> wrote:
> > Example, yes. As Haroon said, it is LEFT OUTER JOIN.
>
> Yeah, of course, must have been the lack of caffeine as I said. (-:
>
> > Unfortunately, join and friends  are off use because SQLCompiler's
> > get_from_clause() creates join conditions on dumb string template.
> > I monkeypatched compiler's get_from_clause in connection.ops._cache.
> > Now it calls original method saved under another name on compiler and
> > after that replaces join condition with required one in one of data
> > chunks.
>
> > How do you think, will there be problems?
>
> First, if you look at the extent of changes required to force the ORM
> to solve your problem, a question that comes to mind: Was it worth the
> effort? I mean, if it were me, I'd probably try to do something like
> this only if I needed it quite often, like, half of the queries I make
> require this or something like that, otherwise I'd just stick to a raw
> query. And even then, it might be easier to just create a reusable raw
> query factory, if you get what I mean... But, of course, I don't know
> your app nor what problem you're dealing with, so I may be off by
> miles.
>
> Second, the mechanisms you're altering aren't part of the public API;
> they may change between versions just like that. Though this doesn't
> usually happen, I already had to make some changes in this area in my
> branch and I'll definitely have to also modify the joining code in
> question. All I'm saying is, once you go this route, you shouldn't be
> surprised if stuff breaks upon upgrade.
>
> Michal
>
>  signature.asc
> < 1KбПросмотретьЗагрузить

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to