[sqlalchemy] Re: JOIN result as dict

2016-10-25 Thread Joasia
q.all()._asdict() It does not work. It is a kind of a mental shortcut (sorry for that!). It is only possible in (like you said): for r in q.all(): r._as_dict() Thank you for your reply! I had hope that I don't have to do any casting or explicity query enumerate. W dniu czwartek, 20 paź

[sqlalchemy] Re: JOIN result as dict

2016-10-18 Thread Joasia
q.all() returns me a result in format: [('one', {'t2c2': 'qwe', 't2c1': '11', 't2c3': '1'}), ('two', {'t2c2': 'rty', 't2c1': '22', 't2c3': '2'}), ..] The result of q.all()._asdict() is [{ 't1c2': 'one', 'table2': { 't2c2': 'qwe', 't2c1': '11', 't2c3': '1' } }, { 't1c2'

[sqlalchemy] JOIN result as dict

2016-10-17 Thread Joasia Truszkowska
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