[Sqlalchemy-tickets] Issue #3506: difference in label with first() or db.session.execute().first()
Brought to you by:
zzzeek
|
From: Sandeep S. <iss...@bi...> - 2015-08-03 19:44:23
|
New issue 3506: difference in label with first() or db.session.execute().first() https://bitbucket.org/zzzeek/sqlalchemy/issues/3506/difference-in-label-with-first-or Sandeep Srinivasa: we have a fairly complex query with inner and outer joins and aliases. we normally use the following syntax ``` #!python q = db.session.query(UserCarts,Merchant,Organization).join(Merchant,Merchant.c.id == UserCarts.c.merchant_id).outerjoin(Organization,Organization.c.id == Merchant.c.organization_id).filter(db.and_(UserCarts.c.cart_id == '0f05b5e25ce946af9e0a3b37f0843870')) ``` if we use ``` #!python q.first().keys() ``` , we get repeated keys "name" between Merchant and Organization. I tried this with "with_labels()" at the end as well. however if I do this: ``` #!python p = db.session.execute(q) s = p.first() ``` in that case, I get labeled keys. Why is there a difference ? |