我有以下 SQL:
SELECT
concat(UNIX_TIMESTAMP(date), '000') as datetime,
SUM(royalty_price) as sales
FROM
sales_raw
GROUP BY
datetime
结果看起来像:
datetime sales
1337151600000 1045.71 (decimal)
1337238000000 478.04
1337324400000 300.96
1337410800000 289.02
由此我得到以下错误:
Exception Type: TypeError at /ajax/graph/
Exception Value: Decimal('1045.71') is not JSON serializable
我如何将小数转换为 mysql 中可接受的格式以便能够序列化这些数据?