[openstack-dev] [Glance] Replacing Glance DB code to Oslo DB code.

Jay Pipes jaypipes at gmail.com
Mon Aug 19 01:58:13 UTC 2013

On 08/18/2013 07:44 PM, Joshua Harlow wrote:
> Using an ORM how does the ORM know what attributes u might access (forgive me if this is a documented sqlalchemy pattern/solution). Doesn't it have to give u back the full model since the ORM layer can't predict what u might do with the model object?

Depends on how you use SQLAlchemy. If you load a model object and then 
use that model object to get related information, you have little 
control over the fields in the relation that are loaded; you only really 
have control over when the relation is loaded into a model.

However, for the most part, code in Nova/Glance/Cinder that uses 
SQLAlchemy does not use this pattern of finding relations. Instead, code 
generally uses the SQLAlchemy Query interface to explicitly -- more or 
less -- ask for the columns in the underlying models that need to be 
returned or processed.


More information about the OpenStack-dev mailing list