Press Room

Press Release: June 24, 2008

Essential SQLAlchemy--New from O'Reilly: Mapping Python to Databases

Essential SQLAlchemy Sebastopol, CA—SQLAlchemy is far more than just another ORM. True, it's a powerful and flexible Python library that bridges the gap between relational databases and traditional object-oriented programming—which sounds pretty much like your average object-relational mapper—but most new users only see a fraction of what's available in this excellent library. When fully understood, SQLAlchemy can make a Python programmer's life much easier. In his new book, Essential SQLAlchemy (O'Reilly US $34.99), author Rick Copeland shows readers how to master SQLAlchemy's hidden power.

The SQLAlchemy library was created by Mike Bayer to provide a high-level, Pythonic (idiomatically Python) interface to relational databases such as Oracle, DB2, MySQL, PostgreSQL, and SQLLite. "SQLAlchemy attempts to be unobtrusive to your Python code, allowing you to map plain old Python objects (POPOs) to database tables without substantially changing your existing Python code," says Copeland. "It includes a database server-independent SQL expression language and an object-relational mapper that lets you use SQL to persist your application objects automatically."

According to Copeland, more and more Python programmers are getting into database programming, particularly in the context of web development. "SQLAlchemy is arguably the best library for using relational databases from Python," Copeland says. "In comparison with SQLAlchemy, one popular competing object-relational mapper was described by Jonathan Ellis at PyCon 2007 as 'feeble.'

"It's already the default database layer in both the Pylons and TubrboGears web frameworks," Copeland adds. "Understanding the library better—which this book will help with—will make people more productive and help them write more maintainable code."

Essential SQLAlchemy demonstrates how to use the library to create a simple database application, walks you through simple queries, and explains how to use SQLAlchemy to connect to multiple databases simultaneously with the same Metadata. You also learn how to:

  • Create custom types to be used in your schema, and when it's useful to use custom rather than built-in types
  • Run queries, updates, and deletes with SQLAlchemy's SQL expression language
  • Build an object mapper with SQLAlchemy, and understand the differences between this and active record patterns used in other ORMs
  • Create objects, save them to a session, and flush them to the database
  • Use SQLAlchemy to model object oriented inheritance
  • Provide a declarative, active record pattern for use with SQLAlchemy using the Elixir extension
  • Use the SQLSoup extension to provide an automatic metadata and object model based on database reflection

In addition, you'll learn how and when to use other extensions to SQLAlchemy, including AssociationProxy, OrderingList, and more.

"'Essential SQLAlchemy gives you both a good path to learning SQLAlchemy for the first tiem as well as providing a valuable reference for even veteran SQLAlchemy programmers," says Copeland.

Essential SQLAlchemy is the much-needed guide for every Python developer using this code library. Instead of a feature-by-feature documentation, the book takes an "essentials" approach that gives you exactly what you need to become productive with SQLAlchemy right away.

For a review copy or more information please email Please include your delivery address and contact information.

Rick Copeland is a senior software engineer with retail analytics firm Predictix, LLC, where he uses SQLAlchemy extensively, primarily for web application development. He has been using Python full-time for development since 2005, in projects as diverse as demand forecasting, business web applications, compilers, and hardware synthesis.

Additional Resources:
For more information about the book, including table of contents, index, author bios, and cover graphic, see:

Essential SQLAlchemy
Rick Copeland
ISBN: 9780596516147, 230 pages, $34.99 USD, £21.99 GBP

About O'Reilly

For almost 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed. Our unique network of experts and innovators share their knowledge and expertise through the company’s Safari training and learning platform and at O’Reilly conferences. As a SaaS learning platform, Safari delivers highly topical and comprehensive technology and business learning solutions to millions of users across enterprise, consumer, and university channels. For more information visit

Return to: O'Reilly Press Room

Press Contacts

Media Relations – Corporate & North America

Fama PR

Media Relations – Japan

Fumi Yamakawa
+81 3-3356-5227

Media Relations – United Kingdom

Helen Codling
+44 (0) 1252 721284