On Fri, Feb 19, 2016 at 9:30 PM, <[email protected]> wrote:
>
> The issue seems to be occurring for queries where we use the add_entity()
> method
> to select a declarative model entity when a column from the same table is
> already in the query constructor and labeled.
>
just to make sure, here is that:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
x = Column(Integer)
e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)
Base.metadata.drop_all(e)
Base.metadata.create_all(e)
s = Session(e)
s.add(A(x=5))
s.commit()
print s.query(A.x.label("foo")).add_entity(A).all()
query output at the end:
BEGIN (implicit)
2016-02-19 23:12:33,455 INFO sqlalchemy.engine.base.Engine SELECT a.x AS
foo, a.id AS a_id, a.x AS a_x
FROM a
2016-02-19 23:12:33,455 INFO sqlalchemy.engine.base.Engine {}
[(5, <__main__.A object at 0x7f0c2fd94990>)]
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.