【发布时间】:2019-04-17 05:17:42
【问题描述】:
我在 mysql 数据库中有存储过程,并使用 sqlalchemy 来获取结果。
connection = db.engine.raw_connection()
cursor = connection.cursor()
cursor.callproc('catalog_get_products_on_catalog', [2000, 10, 0])
results = cursor.fetchall()
cursor.close()
print(results)
我得到元组的结果:
(10, 'abcd')
对于普通的sqlalchemy结果,marshmallow可以用来将结果序列化为字典,是否可以通过在marshmallow中定义一个模式来将元组转换为字典?
【问题讨论】:
标签: python stored-procedures flask sqlalchemy cursor