This talk will show you how to combine SQL and ORM in Django applications. Both ORM methods and SQL have their place. ORM and Django's model classes give us a great development experience. We get an easy-to-use and powerful way to define, migrate, and use our database. SQL gives us access to all the features our database has to offer. It
The talk will be structured as follows:
- Why care about SQL?
- Working with data in Django - Common ORM use cases
- Creating complex queries: Q, F, annotations
- Creating and Addressing the N+1 query problem with Django ORM.
- Everything works, so why use SQL?
- Minimize Database access for maximal Performance
- Use Features of complex sequel queries; Sub-Selects
- Benefit from the SQL Know-How and documentation
- Best of both worlds: Getting objects with raw queries
- If all else fails: Directly using database connections for updates and analytics
- Drawbacks of SQL in Django
- Review: SQL, Django - How and Why