On Aug 27, 2007, at 2:05 AM, Kugutsumen wrote:
> cursor.execute("""SELECT id,name from "DNS_domain" WHERE name='%s'
> """
> % domain)
> row = cursor.fetchone()
If you do just need those two fields, and no object methods, you can
use the "values" queryset method. Something like:
d = Domain.objects.filter(name=domain).values('id', 'name')[0]
from: http://www.djangoproject.com/documentation/db-api/#values-fields
That will still likely be slightly slower than a direct sql call, but
should speed things up by eliminating the object creation.
-johnnnnnn
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---