Friday, June 29, 2012

Re: advantages and disadvantages of Raw sql queries in django

I firmly believe in using the ORM for everything until i am forced to use handwritten SQL.

The main reason is transparency of intentions when the source is examined by a non-DBA.

I want my code to be maintainable by other people and provably correct. I suppose you can unit-test code with embedded SQL but it adds an extra layer of complexity.

I could also argue against custom SQL because it contains business logic and i prefer to keep that all in one place, ie., in models in python code.

So the bottom line for me is to avoid it where possible.  Once everything is profiled and the last remaining bottlenecks are significant and cannot be removed unless I use custom SQL, that's when I'll do it.

Haven't gotten there yet.

-----Original message-----
From: vijay shanker <vshanker.88@gmail.com>
To:
Django users <django-users@googlegroups.com>
Sent:
Sat, 30 Jun 2012, 14:35:54 AEST
Subject:
advantages and disadvantages of Raw sql queries in django

hi
i want to know pros and cons associated with running raw sql queries
over django's ORM .
googled it out but couldn find many useful links.

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment