← Back to team overview

openstack team mailing list archive

Re: using objects returned from DB layer

 

On Dec 15, 2011, at 1:27 PM, Devin Carlen wrote:

> Matt, that answer is simple: so we can use things other than sqlalchemy.
> 

Except that we don't need to do that to use other things that sqlalchemy.  
We can have sqlalchemy map to plain python objects, and use those. 
And any other persistence layer  can then use the same model objects. 

As it currently is, the orm gets dicts back from the DB API, sqlalchemy maps them to objects, then we take pains to pretend they are dicts identical to what the  DBAPI returned. 


> 
> 
> On Dec 15, 2011, at 10:35 AM, Matt Dietz wrote:
> 
>> I have to confess to being confused here. We deliberately chose
>> sqlalchemy. Then we mapped everything away so it didn't look like the ORM
>> in question when in reality, we partially took some of said ORM's job away
>> from it. Now we're complaining that the ORM we likely aren't using
>> correctly isn't working for us. In short, we chose to use an ORM, and now
>> we're complaining about the O
>> 
>> I'm not seeing what taking everything to a dictionary-centric model buys
>> us, and I also don't see anyone actually justifying it. Can we get some
>> actual examples of why one approach is better than the other?
>> 
>> 
>> On 12/15/11 10:54 AM, "Johannes Erdfelt" <johannes@xxxxxxxxxxx> wrote:
>> 
>>> On Thu, Dec 15, 2011, Kevin L. Mitchell <kevin.mitchell@xxxxxxxxxxxxx>
>>> wrote:
>>>>    2. However, I violently disagree with the idea that the DB layer
>>>>       must return dicts.  It does not, even if you start talking about
>>>>       allowing use of other kinds of databases.  We can, and should,
>>>>       wrap these things in objects, upon which we can call methods
>>>>       that do things‹i.e., we should, you know, actually use
>>>>       object-oriented programming.
>>> 
>>> What kinds of things?
>>> 
>>> I'm not against returning back a standardized object that provides
>>> __getattr__ so we don't have to use dict notation. Any database backend
>>> can do something similar easily.
>>> 
>>> I'm just trying to better understand what is object-oriented about the
>>> data returned from a database? What methods would we want to use?
>>> 
>>> JE
>>> 
>>> 
>>> _______________________________________________
>>> 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
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp

--
	Monsyne M. Dragon
	OpenStack/Nova 
	cell 210-441-0965
	work x 5014190



References