Fractional second support for MySQL 5.6.5
MySQL database connector for Python programming
Brought to you by:
adustman
Fractional second support up to microseconds has recently been added in MySQL 5.6.4 and higher. I was hoping that MySQLdb will add support for this feature with timedelta. Currently, to bypass this issue I have modified MySQLdb/times.py and it seems to be working for my purposes.
def format_TIMEDELTA(v):
microseconds = v.microseconds seconds = float(v.seconds) % 60 minutes = int(v.seconds / 60) % 60 hours = int(v.seconds / 3600) % 24 return '%d %d:%d:%d.%06d' % (v.days, hours, minutes, seconds, microseconds)
Although my patch seems to be working, to be more robust I expect that timedelta millisecond support might also be needed.