【发布时间】:2017-08-15 16:24:14
【问题描述】:
以下是数据示例:
{'rate': 0.008999, 'stamp': {'bids': [[117090.0, 11.78362353], [117075.0, 0.28], [116918.0, 0.5],[116820.0, 32.0]], 'asks': [[117104.0, 0.55206666], [117105.0, 1.11], [117142.0, 4.99974999], [117178.0, 1.0], [117191.0, 0.0669], [117348.0, 0.01], [117369.0, 1.05]]}}
我想在 PythonAnywhere 上托管记录器。我是mysql的新手。从版本 5.7.8 开始,添加了 JSON 对象,pythonanywhere 使用 5.6.27。
我得到这个错误:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syn
tax to use near 'JSON)' at line 1
所以我正在考虑将其存储为字符串 VARCHAR。但是,您必须指定长度,这因每个条目而异。那我应该把长度设为65,535吗?
【问题讨论】:
-
你可以使用TEXT来存储json数据
-
mysql 5.7 以后你有一个本地数据类型来存储 json dev.mysql.com/doc/refman/5.7/en/json.html
-
我实际上建议先进行数据清理等,然后正确保存订单簿数据(即,为每个投标价格和投标金额提供它自己的整数和小数字段等)
标签: mysql json pythonanywhere