»Building ORMs from scratch with advanced Python«
2019-06-04, 12:00–12:25, Hall 3
Did you ever wonder how do ORM systems do their magic? In this talk we'll cover the Python features that enabled us to implement an ORM for a new DB system in less than a day.
In our work at Magic Leap, we needed to work an experimental graph database system, meaning that we barely had any python code to work with for clients. Specifically, there wasn't any stable ORM we can use, meaning that all object de/serialization had to happen by manual queries, tracking changes to be written had to be manual, and batching writes was cumbersome. After working with it for a while, we decided to invest in building our own ORM system, even though it might take a while.
To our surprise, we had our first working ORM in ~500 lines of code and less than a day of work, thanks to advanced features of the Python language. Therefore, we decided to share our insights on the process.
In this talk we'll cover python metaclasses and descriptors with an actual use-case, going step by step through correct usage and design considerations, supporting nested data types, and more. At the end of the talk, attendees should be able to go on and implement their own ORMs for their favorite database systems.