
data1 = db.session.execute("select * from table;")db.session.commit()list0 = []for i in list(data1):for循环
这里只说原生的可以list(),没有说怎么配置,因为我是在导入flask-SQLAlchemy一起混了,具体大家试一下
sql = "select aa,bb ..."data0 = db.session.execute(sql)data = list(map(dict11, data0))print(data[0])print(data[0]["aa"])print(data[0]["bb"])
def dict11(self):return dict(aa=self.aa, bb=self.bb)
sql = "select aa,bb ..."data0 = db.session.execute(sql)data = list(map(allsheetlist, data0))print(data[0])print(data[0]["aa"])print(data[0]["bb"])
def allsheetlist(self):return self.name