convert sqlalchemy query result to a list of dicts

后端 未结 4 1426
慢半拍i
慢半拍i 2021-02-08 03:54

I want to have the result of my query converted to a list of dicts like this :

result_dict = [{\'category\': \'failure\', \'week\': \'1209\', \'stat\': \'tdc_ok         


        
4条回答
  •  执念已碎
    2021-02-08 04:42

    There's no .all()

    You can try:

    result_dict = [u.__dict__ for u in my_query.fetchall()]
    

提交回复
热议问题