python查询mysql数据库,执行sql后查询结果数据类型为Decimal,解决方法

案例一:

使用python查询mysql:select  money from amount where amount_

此时查询出的money结果为10000,类型为Decimal。

无法进行后续的运算和字符串拼接操作。

解决方法:

将sql改造为:select CAST(money as CHAR) as money from amount where amount_

此时查询出的money结果为10000,类型为str。

后续可将str转换为int或直接拼接