← Back to team overview

openstack team mailing list archive

Re: using objects returned from DB layer

 

I agree except I though the preference was for

> instance_uuid = instance['uuid']

not

> instance_uuid = instance.uuid

(use dict's and don't assume sqlalchemy)


On Wed, Dec 14, 2011 at 11:19 PM, Devin Carlen <devin.carlen@xxxxxxxxx> wrote:
> Yes, we should absolutely push to make this more consistent across the board.  We are severely limiting possible future implementations.
>
> So, yea. +1!
>
> Devin
>
>
> On Dec 14, 2011, at 11:10 PM, Chris Behrens wrote:
>
>>
>> I've seen a number of patches lately that have code like this:
>>
>> instance = db.instance_get(...)
>> instance_uuid = instance.uuid
>>
>> instead of:
>>
>> instance_uuid = instance['uuid']
>>
>> There's a mix of usage throughout the code, and I know some people are just matching the surrounding code.  But, in a number of cases, I've asked for these to be corrected to the latter, on assumption that the DB layer will be returning dictionaries at some point vs the models.  It also pushes the code towards consistent usage.  But I might be the only Nova Core member looking at this and/or maybe my assumption is wrong.
>>
>> So, I ask here:  Should Nova Core make an effort to reject patches with the former format?   Or did I miss any DB layer plans where the former format is now preferred?
>>
>> - Chris
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openstack
>> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~openstack
>> More help   : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References