Chapter A.5. How Objects Are Cached in SQLAlchemy

SQLObject includes some options (lazyUpdate and cacheValues) to control how SQLObject caches values. Most people don’t use these options, and SQLAlchemy doesn’t offer the equivalent options because its caching is simpler.

SQLAlchemy is built around a “unit-of-work” pattern, as described by Martin Fowler in Patterns of Enterprise Application Architecture. This means that you typically work with various objects while accomplishing a specific task. In SQLAlchemy, you have session objects that hang on to all the objects you’re working with in a unit of work. TurboGears maintains one for you as turbogears.database.session. When an object needs to be retrieved from the database, its primary ...

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.