On Wed, Jan 4, 2012 at 12:16 PM, Venkatraman S <venka...@gmail.com> wrote:

> SQL is highly flexible provided you know to write good sql (its like the
> way Russell mentions 'It Depends' :P ); atleast i have been writing sqls
> for the past 8 years and i find it easy to write them when the
> relationships are complex. I come from a database family, and writing
> highly database cohesive apps is what i have been doing for quiet sometime.
> And it is very much given that, if you are writing a reporting app with
> 30-40 tables, then you would end up writing raw sqls(this is NOT the norm
> for a non-reporting app).



You, sir, are correct.

SQL is a powerful tool, and one that must indeed be used if we are to write
enterprise-grade applications. I should have probably picked a better word
than "flexible". In reality, SQL's great flexibility is precisely what
enables the creation of tools like the ORM. With enough time and knowledge,
you can use SQL to slice your data in any way you can imagine, as long as
we're talking about relational information.

What I meant to emphasize is that hard coding your queries in python
strings will most likely mean they will break as soon as you do some
refactoring, schema migration and many other possible changes in your
database. This is why raw SQL, while incredibly powerful, can be skipped in
most everyday cases, especially for a beginner. The ORM allows for a good
deal of tweaking that can be used to speed up the most common kinds of
queries.

That said, learning SQL is a fundamental step in becoming a "full-fledged"
Django developer, as dealing with databases will your everyday task. It is
also the only way you will understand what's happening "behind the
curtains". It is a necessary step in building scalable apps and keeping
them as light as possible.


TL;DR I shouldn't have said SQL isn't flexible; the lack of flexibility
lies in hard coded strings, but that can even impact the python side of a
Django app.


Cheers,
AT

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

Reply via email to