Chapter 12.4.1. Transactions and Connections

SQLObject relies on the underlying DB for transaction processing and provides a simple application programming interface (API) for transaction management. Before diving into the murky waters of the implementation, let’s see transactions in action.

The background story is that you want to buy some groceries in the store. Your database contains two tables: Store and Basket. The rows in both tables contain the name of the item and its quantity:

groceries = ['Apple', 'Bread', 'Milk', 'Enchilada'] class Store(SQLObject): class sqlmeta: cacheValues = False item = EnumCol(enumValues=groceries, unique=True) quantity = IntCol() class Basket(SQLObject): class sqlmeta: cacheValues = False item = EnumCol(enumValues=groceries, ...

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.