Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. SqlSoup: An Automatic Mapper... > Using SqlSoup for ORM-Style Queries ...

10.2. Using SqlSoup for ORM-Style Queries and Updates

You may have noticed in the previous section that when we queried the db.product table, rather than being served with RowProxy objects as in regular SQLAlchemy, we were served with MappedProduct instances. This is because technically we’re not selecting from the product table; we’re selecting from the automatically created and mapped MappedProduct class, created from the product table.

The MappedProduct class provides a basic mapping of the columns of the table to the properties of the class. It also provides a query property, similar to the Elixir query property, which provides access to a session query for the MappedProduct. It also provides insert(), delete(), and update() methods for modifying the underlying data. To create a new product, for instance, we can do the following:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial