not a bad question. Those attributes are the mapper-assigned attributes
and I'd guess that because address_ has an alternate name, declarative
is setting it up in a different step. The attributes on a class can't
be ordered in any case.
To get the real order of columns at the Core level use the table:
Venue.__table__.columns.keys()
On 05/09/2016 08:11 AM, Denis Rykov wrote:
Hello.
Why "address_" key on first place of list, is it expected behaviour?
|
>>> from sqlalchemy.ext.declarative import declarative_base
>>> from sqlalchemy.inspection import inspect
>>> from sqlalchemy import Integer, Column, Unicode
>>>
>>> Base = declarative_base()
>>>
>>>
>>> class Venue(Base):
... __tablename__ = 'venue'
... id = Column(Integer, primary_key=True)
... name = Column(Unicode, nullable=False)
... address_ = Column('address', Unicode, nullable=False)
...
>>> inspect(Venue).columns.keys()
['address_', 'id', 'name']
|
--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.