Please note: this project is inactive since early 2006

 
4.5 Fetching objects

We will now see how you can fetch specific objects from the database. Note that once you fetched one or more objects, you do not need to explicitly fetch the objects in relations, this is done automatically. For example, once you have fetched a Writer object (see ), its pygmalion or its books will be transparently and automatically fetched when you ask for them (aWriter.getBooks(), so you do not have to worry about this. Moreover, these objects in relation to 'aWriter' are only fetched against the database where they are needed, so the memory footprint of your application remains reasonable (and the whole database is not fetched into memory when you access a single object!).

Naturally, before traversing relationships just like you normally do in python code, you need to fetch at least one object. We will see now how this is done.

In this section, we use the model described here: , which is one of the model used in the unittests of the framework.


Subsections
Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by:SourceForge.net Logo