Hi! 

There is any option to select JOIN result as dict?
For example I have:

*table1*

 t1c1| t1c2
-----+--------
   1 | one
   2 | two
   3 | three


*table2*

 t2c1 | t2c2 | t2c3
-----+-------+-------
   11 | qwe  | 1
   22 | rty  | 2
   33 | zxcvb| 1


where 
t2c3 from *table2 *is a foreign key to *table1*.

I want to show JOIN result 
q = db.session.query(table1.t1c2, table2).join(table2).all() 

as one dict:
[{
  't1c2': 'one',
  't2c2': 'qwe',
  't2c1': '11',
  't2c3': '1'
},
{
  't1c2': 'two',
  't2c2': 'rty',
  't2c1': '22',
  't2c3': '2'
},
...]


But above query returns me result as tuple. I tried covert this result 
using *asdict() *method, but it can't make from this one dictionary. I 
can't create any query to resolve my problem.

I use latest SqlAlchemy with Postgres 9.5.

Thanks!

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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.

Reply via email to