snower / TorMySQL

The highest performance asynchronous MySQL driver by PyMySQL
MIT License
308 stars 63 forks source link

Error on JSON field #38

Closed 0x55AAh closed 6 years ago

0x55AAh commented 6 years ago

I have a table:

CREATE TABLE `stores` (
  `store_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `gamespace_id` int(11) NOT NULL,
  `store_name` varchar(255) DEFAULT NULL,
  `json` json NOT NULL,
  PRIMARY KEY (`store_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Sql query:

SELECT *
FROM `stores`
WHERE `store_id`=%s AND `gamespace_id`=%s;

NOTE: json field have data over 200 KB

PROBLEM: Sometimes i get this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/venv/live/local/lib/python2.7/site-packages/tornado/ioloop.py", line 458, in run_sync
    return future_cell[0].result()
  File "/opt/venv/live/local/lib/python2.7/site-packages/tornado/concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "/opt/venv/live/local/lib/python2.7/site-packages/tornado/gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "<stdin>", line 10, in test
  File "/opt/venv/live/local/lib/python2.7/site-packages/tornado/gen.py", line 1055, in run
    value = future.result()
  File "/opt/venv/live/local/lib/python2.7/site-packages/tornado/concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
TypeError: ord() expected string of length 1, but int found

Tested on 2 separated systems. mysql-server 5.7 (5.7.23-1debian8) tormysql==0.3.8 PyMySQL==0.8.0

snower commented 6 years ago

Can you use pymysql directly? Just re-connection implementation of pymysql, the protocol is completely pymysql implementation.

0x55AAh commented 6 years ago

Yes. I've tried pymysql directly and no errors detected after multiple testings. I've faced with some correlation between size of field and error arising. After replacing json data with somethin' much more shorter, problem disappeared.

snower commented 6 years ago

Already fixed. You can try to install the latest version 0.4.0. Thanks.

0x55AAh commented 6 years ago

Problem is gone. Thanks.