@@ -40,7 +40,7 @@ def __init__(self, connection_settings, server_id, resume_stream=False,
4040 filter_non_implemented_events = True ,
4141 ignored_events = None , auto_position = None ,
4242 only_tables = None , only_schemas = None ,
43- freeze_schema = False ):
43+ freeze_schema = False , skip_to_timestamp = None ):
4444 """
4545 Attributes:
4646 resume_stream: Start for event from position or the latest event of
@@ -54,6 +54,7 @@ def __init__(self, connection_settings, server_id, resume_stream=False,
5454 only_tables: An array with the tables you want to watch
5555 only_schemas: An array with the schemas you want to watch
5656 freeze_schema: If true do not support ALTER TABLE. It's faster.
57+ skip_to_timestamp: Ignore all events until reaching specified timestamp.
5758 """
5859 self .__connection_settings = connection_settings
5960 self .__connection_settings ["charset" ] = "utf8"
@@ -82,6 +83,7 @@ def __init__(self, connection_settings, server_id, resume_stream=False,
8283 self .log_pos = log_pos
8384 self .log_file = log_file
8485 self .auto_position = auto_position
86+ self .skip_to_timestamp = skip_to_timestamp
8587
8688 def close (self ):
8789 if self .__connected_stream :
@@ -259,6 +261,9 @@ def fetchone(self):
259261 self .__only_schemas ,
260262 self .__freeze_schema )
261263
264+ if self .skip_to_timestamp and binlog_event .timestamp < self .skip_to_timestamp :
265+ continue
266+
262267 if binlog_event .event_type == TABLE_MAP_EVENT and \
263268 binlog_event .event is not None :
264269 self .table_map [binlog_event .event .table_id ] = \
0 commit comments