You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For floating point values with more than 15 digits, this loses information. The mysqlclient equivalent preserves it:
defFloat2Str(o, d):
s=repr(o)
ifsin ('inf', 'nan'):
raiseProgrammingError("%s can not be used with MySQL"%s)
if'e'notins:
s+='e0'returns
Losing this precision can arise, for example, in sending the output of time.time() to the database, and sometimes those final digits make a difference. Here's one example, using a timestamp of 1564063129.1277142:
This was easy enough to fix by overriding the conv dict to the connect() method, but maybe the default could be to preserve all the digits, like MySQLdb does?
The text was updated successfully, but these errors were encountered:
The default float converter, defined in pymysql.converters.escape_float looks like this:
For floating point values with more than 15 digits, this loses information. The mysqlclient equivalent preserves it:
Losing this precision can arise, for example, in sending the output of
time.time()
to the database, and sometimes those final digits make a difference. Here's one example, using a timestamp of1564063129.1277142
:Notice PyMySQL lops off the final two digits.
This was easy enough to fix by overriding the
conv
dict to the connect() method, but maybe the default could be to preserve all the digits, like MySQLdb does?The text was updated successfully, but these errors were encountered: