Skip to content

add PyMySQL 0.10.0 support #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pymysqlreplication/binlogstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pymysql
import struct

from pkg_resources import parse_version
from pymysql.constants.COMMAND import COM_BINLOG_DUMP, COM_REGISTER_SLAVE
from pymysql.cursors import DictCursor
from pymysql.util import int2byte
Expand Down Expand Up @@ -259,7 +260,7 @@ def _register_slave(self):

packet = self.report_slave.encoded(self.__server_id)

if pymysql.__version__ < "0.6":
if parse_version(pymysql.__version__) < parse_version("0.6"):
self._stream_connection.wfile.write(packet)
self._stream_connection.wfile.flush()
self._stream_connection.read_packet()
Expand Down Expand Up @@ -407,7 +408,7 @@ def __connect_to_stream(self):
# encoded_data
prelude += gtid_set.encoded()

if pymysql.__version__ < "0.6":
if parse_version(pymysql.__version__) < parse_version("0.6"):
self._stream_connection.wfile.write(prelude)
self._stream_connection.wfile.flush()
else:
Expand All @@ -424,7 +425,7 @@ def fetchone(self):
self.__connect_to_ctl()

try:
if pymysql.__version__ < "0.6":
if parse_version(pymysql.__version__) < parse_version("0.6"):
pkt = self._stream_connection.read_packet()
else:
pkt = self._stream_connection._read_packet()
Expand Down
4 changes: 2 additions & 2 deletions pymysqlreplication/row_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json

from pymysql.util import byte2int
from pymysql.charset import charset_to_encoding
from pymysql.charset import charset_by_name

from .event import BinLogEvent
from .exceptions import TableMetadataUnavailableError
Expand Down Expand Up @@ -215,7 +215,7 @@ def __read_fsp(self, column):
def __read_string(self, size, column):
string = self.packet.read_length_coded_pascal_string(size)
if column.character_set_name is not None:
string = string.decode(charset_to_encoding(column.character_set_name))
string = string.decode(charset_by_name(column.character_set_name).encoding)
return string

def __read_bit(self, column):
Expand Down