Chapter 10.4. Summary
SQLObject implements the Active-Record pattern.
Use ?debug=True to have SQLObject print the SQL queries it generates to the console.
SQLObject manages your database connections for you, and in TurboGears it gets the connection string from dev.cfg or prod.cfg.
In addition to defining your classes first and generating you database tables from those classes the way we’ve been doing it in this book, you can also use _fromDatabase=true.
SQLObject provides several different ways to define queries. The simplest of these is get(ID), but select() is just about as easy.
Only slightly more complex is the selectBy() method, which you can use to get records matching specific criteria.
Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.