On Tue, 2007-12-18 at 00:16 -0800, Rufman wrote:
> Hey guys
> 
> Is there a way to return a QuerySet object, when I make my own custom
> sql?

No. Part of the reason is that it's not particularly useful in the
general case and very easy to get into trouble. A QuerySet has a lot of
methods that can be called on it that modify the eventual query. These
methods are almost useless after custom SQL has been run, because we
don't want to have to try and work out what your custom SQL was doing.

What I suspect you are needing (since you don't explain your use-case,
I'm obviously guessing a little bit) is something that has a few of the
QuerySet methods -- primarily being an iterator that returns some kind
of Python object instances and maybe supports the caching that QuerySets
do. There are (low-priority) plans to write something like that so you
can run custom SQL and pass it a dictionary or some functions that will
map result rows to a Python object and support the iterator and cache.
Anything beyond that is probably not useful, but I'd be interested in
hearing the use-case you're wanting to solve.

Malcolm

-- 
Two wrongs are only the beginning. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to