Skip to content

Commit 3ae251c

Browse files
committed
re-added version retrieval from session
1 parent bed09cb commit 3ae251c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pymysqlreplication/binlogstream.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ def __connect_to_ctl(self):
305305
self._ctl_connection_settings["cursorclass"] = DictCursor
306306
self._ctl_connection_settings["autocommit"] = True
307307
self._ctl_connection = self.pymysql_wrapper(**self._ctl_connection_settings)
308+
self._ctl_connection._get_dbms = self.__get_dbms
308309
self.__connected_ctl = True
309310
self.__check_optional_meta_data()
310311

@@ -744,6 +745,19 @@ def _allowed_event_list(
744745
pass
745746
return frozenset(events)
746747

748+
def __get_dbms(self):
749+
if not self.__connected_ctl:
750+
self.__connect_to_ctl()
751+
752+
cur = self._ctl_connection.cursor()
753+
cur.execute("SELECT VERSION();")
754+
755+
version_info = cur.fetchone().get("VERSION()", "")
756+
757+
if "MariaDB" in version_info:
758+
return "mariadb"
759+
return "mysql"
760+
747761
def __log_valid_parameters(self):
748762
ignored = ["allowed_events", "table_map"]
749763
for parameter, value in self.__dict__.items():

pymysqlreplication/row_event.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
782782
self.column_count = self.packet.read_length_coded_binary()
783783

784784
self.columns = []
785+
self.dbms = self._ctl_connection._get_dbms()
785786
# Read columns meta data
786787
column_types = bytearray(self.packet.read(self.column_count))
787788
self.packet.read_length_coded_binary()

0 commit comments

Comments
 (0)