python-mysql-replication
python-mysql-replication copied to clipboard
Graceful exit when connect to mysql whose bin-log is not enable
When connect to a mysql whose bin-log is not enable, an error raise without any useful hint:
$ python dump_events.py
Traceback (most recent call last):
File "dump_events.py", line 33, in <module>
main()
File "dump_events.py", line 26, in main
for binlogevent in stream:
File "<the-python-site-packages>/pymysqlreplication/binlogstream.py", line 371, in fetchone
self.__connect_to_stream()
File "<the-python-site-packages>/pymysqlreplication/binlogstream.py", line 279, in __connect_to_stream
self.log_file, self.log_pos = cur.fetchone()[:2]
TypeError: 'NoneType' object is not subscriptable
From the source, we know this is because show master status
return Empty set
.
So, a graceful exit message or a custom exception here would be much nice.
pull requests welcome :)