SQL Alchemy vs. ORM in django

If you are not using Django, then SQL Alchemy is probably your better choice. While in theory you can use Django's ORM as a standalone ORM, it is probably more work then it is worth. 

If you are using Django, then the choice isn't as clear.  If you use SQL Alchemy instead of Django's ORM, it makes it difficult to use some of Django's functionality. As an example, its built in admin capabilities. 

If performance is a large concern, I believe SQL Alchemy will probably provide better performance, but that always depends on the structure of your data and types of queries. However, I would recommend not judging the two on raw performance alone.  There are plenty of large Django sites out there using the ORM.  Proper use of caching can help you out a lot more then swapping out the ORM. 

My recommendation is pretty simple. If you are building a Django application, use the native ORM unless there are glaring reasons it won't work for you.  You can always fine tune things later if you are not getting the performance you need.   If you are not using Django, then go with SQL Alchemy.

No comments:

Post a Comment