diff --git a/pymysqlreplication/row_event.py b/pymysqlreplication/row_event.py index 0e1c3feb..832c6688 100644 --- a/pymysqlreplication/row_event.py +++ b/pymysqlreplication/row_event.py @@ -57,7 +57,22 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) self.event_type == BINLOG.DELETE_ROWS_EVENT_V2 or \ self.event_type == BINLOG.UPDATE_ROWS_EVENT_V2: self.flags, self.extra_data_length = struct.unpack(' 2: + self.extra_data_type = struct.unpack('= 8.0 + @property def supportsGTID(self): if not self.isMySQL56AndMore(): diff --git a/pymysqlreplication/tests/test_data_type.py b/pymysqlreplication/tests/test_data_type.py index 6c4afed1..e94aa6ad 100644 --- a/pymysqlreplication/tests/test_data_type.py +++ b/pymysqlreplication/tests/test_data_type.py @@ -625,5 +625,21 @@ def test_zerofill(self): self.assertEqual(event.rows[0]["values"]["test4"], '0000000001') self.assertEqual(event.rows[0]["values"]["test5"], '00000000000000000001') + def test_partition_id(self): + if not self.isMySQL80AndMore(): + self.skipTest("Not supported in this version of MySQL") + create_query = "CREATE TABLE test (id INTEGER) \ + PARTITION BY RANGE (id) ( \ + PARTITION p0 VALUES LESS THAN (1), \ + PARTITION p1 VALUES LESS THAN (2), \ + PARTITION p2 VALUES LESS THAN (3), \ + PARTITION p3 VALUES LESS THAN (4), \ + PARTITION p4 VALUES LESS THAN (5) \ + )" + insert_query = "INSERT INTO test (id) VALUES(3)" + event = self.create_and_insert_value(create_query, insert_query) + self.assertEqual(event.extra_data_type, 1) + self.assertEqual(event.partition_id, 3) + if __name__ == "__main__": unittest.main()