On 03/04/2014 12:08 PM, Robin Lery wrote:
> Hello,
> 
> I am really being confused. How to use sql in django? I found two:
> 1. Performing raw queries.
> 2.Executing custom SQL directly.
> 
Do you have links for those? I know there is a the raw query mode of
Django, and I'm guessing the other method you refer to is creating your
own db connection directly with the python driver for a particular
database? The raw queries will at least be more similar to the results
you get from the ORM in terms of object types returned, where direct SQL
would require you to take the results, and iterate them into a useful
object.

> Does it have better performance than the django's orm? And how is the
> performance the same between those two?
> 

Probably not better performing than the ORM, I expect the ORM to behave
better. The key is the ORM returns results in an easy to use object that
can be then passed to the templates. It also has options to pre-cache
some results, only query when you actually need it, etc.
However there are some types of queries the ORM can't do, that's
typically when you need the direct SQL methods.

> And lastly, what is sqlalchemy? Are sqlalchemy and django's orm the same?
> In the website of sqlalchemy it says "*SQLAlchemy is the Python SQL toolkit
> and Object Relational Mapper that gives application developers the full
> power and flexibility of SQL*".
> 

No, Django ORM is a competitor of SQL Alchemy. Though you can use either
or both it's just more work for you.


> So I am confused. I will really appreciate very much, if you could help me
> understand the above.
> 
> Thank you!
> 

Enjoy,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5316376D.6040808%40wildintellect.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to