Saturday 2:35 p.m.–3:05 p.m.
To ORM or not to ORM
- Audience level:
Database ORMs make it really convenient to pythonically query a database, but it's difficult to decide when to use them and when not to---and what the alternatives are. In this talk you'll learn strategies for deciding when and where to use an ORM, when to be cautious, and how to tell that you're doing the right thing, drawn from real-world lessons learned building the Inbox email platform.
Every web framework out there comes with an ORM, but should you actually use it? An ORM makes it super easy to get up and running really quickly, but maintainers of growing database-backed applications almost always run into performance problems down the road. When this happens, what do you do? This talk's goal is to show you what actually happens under the hood when you make a query in an ORM like SQLAlchemy, and, by giving you the power to de-mask which SQL queries are being executed, build your intuition for when to use caution with an ORM. Sometimes, like in schema migrations, you may even want to just hand-craft the raw SQL yourself. This talk is based off of real-world examples learned while building the [Nilas Sync Engine](https://github.com/inboxapp/inbox), which is available free and open source, so you'll be able to take a look at the results of these lessons and how the codebase has evolved to become more performant.