2016-04-24 13:45-2016-04-24 14:45

Experience level


Session Track


An ORM Where the Database is the Boss


Database programmers tend to disdain Object-Relational Mappers (ORM's) due to their frequently simplistic or half-baked representation of database implementation details, often leading to awkward, redundant code and lousy performance. An ORM can rock though when the data model definition and data access definition (ie. functions) reside in the database itself and are inherited by the application's model.  PostgreSQL is fully equipped for this development pattern and Command Prompt has implemented it with great success in a large data-heavy Python web application.

I will demonstrate designs and code for a working Python application built under this paradigm, using the newly overhauled version of Simpycity. I'll show successful patterns for designing SQL accessor functions, effective use of PostgreSQL's powerful composite type system (including type inheritance), and seamless, automatic mapping of PostgreSQL types and type members to Python classes and class members.