Does Python Django support custom SQL and denormalized databases with no Foreign Key relationships?

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2010-06-17T23:07:06Z Indexed on 2010/06/17 23:13 UTC
Read the original article Hit count: 215

Filed under:
|
|

I've just started learning Python Django and have a lot of experience building high traffic websites using PHP and MySQL. What worries me so far is Python's overly optimistic approach that you will never need to write custom SQL and that it automatically creates all these Foreign Key relationships in your database. The one thing I've learned in the last few years of building Chess.com is that its impossible to NOT write custom SQL when you're dealing with something like MySQL that frequently needs to be told what indexes it should use (or avoid), and that Foreign Keys are a death sentence. Percona's strongest recommendation was for us to remove all FKs for optimal performance.

Is there a way in Django to do this in the models file? create relationships without creating actual DB FKs? Or is there a way to start at the database level, design/create my database, and then have Django reverse engineer the models file?

© Stack Overflow or respective owner

Related posts about python

Related posts about mysql