Re: [Sqlalchemy-tickets] [sqlalchemy] #2914: sqlalchemy.orm.mapper.Mapper.attrs doesn't maintain or
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2014-01-20 20:52:13
|
#2914: sqlalchemy.orm.mapper.Mapper.attrs doesn't maintain order
-----------------------------------+----------------------------------
Reporter: tisdall | Owner: zzzeek
Type: defect | Status: closed
Priority: low | Milestone: 0.9.xx
Component: orm | Severity: minor - half an hour
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Comment (by tisdall):
yeah, I'm seeing the `attrs` is not maintaining the order that attributes
are defined in the object. I was looking through the code and thought
that was the reason, but I'm wrong.
Here's the object I'm defining:
{{{
#!python
class Person(Base):
__tablename__ = 'persons'
id = Column(Integer, primary_key=True)
name = Column(Unicode(128), nullable=False)
surname = Column(Unicode(128), nullable=False)
phones = relationship(Phone)
}}}
The order I consistently get back is
{{{
Person.phones
Person.id
Person.name
Person.surname
}}}
When I'm expecting to get `Person.phones` at the end of the list. Does
the OrderedDict not maintain the order the attributes are defined in the
class?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2914#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|