赞
踩
如果mysql的字段设置了 无符号类型unsigned=True,一旦出现负数,就会如下错误提示
- # 自定义无符号类型的Decimal
- class OwnUnsignedDecimal(DECIMAL):
- # 指定unsigned为True代表无符号类型【不能是负数】,默认长度20为、小数点保留后6位
- def __init__(self, precision=20, scale=9, asdecimal=True, unsigned=True, **kw):
- super().__init__(precision=precision, scale=scale, asdecimal=asdecimal, unsigned=unsigned, **kw)
"description": "<p>全局异常错误捕捉:(pymysql.err.DataError) (1264, "Out of range value for column 'freeze_amount' at row 1")\n[SQL: UPDATE asset_trade_model SET eth_balance=%(eth_balance)s, freeze_token_amount=%(freeze_token_amount)s WHERE asset_trade_model.id = %(asset_trade_model_id)s]\n[parameters: {'eth_balance': Decimal('10.28200000000000000066613381'), 'freeze_token_amount': Decimal('-100.000000000'), 'asset_trade_model_id': 3}]\n(Background on this error at: http://sqlalche.me/e/9h9h)</p>",
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。