About This Talk
Have you ever used model inheritance and been surprised by the resulting database schema and queries that were generated? Or perhaps you have lived by the age-old Object Oriented design mantra suggesting that one must “favor composition over inheritance” and wondered why the Django Object Relational Mapping (ORM) provides not just one but, three different styles of model inheritance!
In this talk, we will start with an overview of Django models and then take an in-depth look at:
- Abstract Models
- Multi-table Inheritance (Concrete Inheritance)
- Proxy Models (Single-table Inheritance)
In addition to discussing best practices and the potential pitfalls of each approach, we will dive under the hood and examine the database mappings and query results Django creates. We will discuss helpful toolkits and libraries such as those that can perform downcasting. And of course, we will spend ample time discussing when to choose inheritance over alternate design patterns such as composition with foreign keys.
This talk is designed primarily for folks with some familiarity with an ORM and/or any relational database. However, if you are curious about model inheritance, excited by data modeling and model design patterns, or interested in exploring the underlying database tables and queries generated by Django, then this adventure is for you!
Blythe J Dunham
Ever since Blythe graduated with an MS & BS from Carnegie Mellon in 2000, she has been moving data with ORMs. Although she almost became a DBA after becoming certified, she has spent most of her career in web development squeezing performance out of various web frameworks. When she is not advocating for or creating maintainable software, she is snowboarding, enjoying various types of sportsball, and hanging out with her best friend, Sounders the Cat, in Seattle. Blythe previously was co-founder and principal architect at Spongecell (Flashtalking merger). She has been Django-ing at Rover.com for over 3 years.