Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes and no. I've used Django and Django's ORM for many years (along with others, but Django is probably the easiest for me to discuss).

Django's ORM doesn't stop you from using database-specific features (JSON fields, full text search, PostgreSQL's geo extensions, etc.) It also makes it very straightforward to bypass parts of the ORM and write your own SQL either just as the WHERE part of a query or as the whole SQL statement. If you build a large enough app that deals with enough data, you'll eventually find some hot spots where you need to do that for performance reasons. When you do that, you obviously can lose portability.

If you avoid those things though, you pretty much can switch the database. In practice, I've never really found a need to do that for a production system, but it still has some major advantages. First, I regularly run PostgreSQL in production, but I can use SQLite as an in-memory database for unit tests, which makes those much faster (and simpler to run unit tests without having to also spin up a full DBMS).

The other huge advantage is that it enables Django's whole ecosystem of reusable applications. Eg, the built-in admin interface, popular third party applications for authentication, tagging, CMS-type stuff, etc. are generally written using the ORM and as a result can be added to any Django project with a couple lines of config and will work no matter what database you use. That large ecosystem of fairly polished components has been a major reason that Django has remained so popular for such a long time. If it had to be split up by supported database ("MySQL admin" vs "PostgreSQL admin", etc), I don't think it would've been as successful.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: