-
Notifications
You must be signed in to change notification settings - Fork 318
Closed
Description
Original bug on https://sourceforge.net/p/mysql-python/bugs/325/
When SELECT datatime field which contained microseconds from DB(MariaDB 5.5 and MySQL 5.6). Result can not be converted to datetime.datetime and data in that field shows as None. I use MariaDB 5.5.27.
For example:
Make table in DB and fill its
import MySQLdb
db=MySQLdb.connect(host="localhost",user="test",passwd="test",db="test")
c=db.cursor()
c.execure("""DROP TABLE IF EXISTS `t1`""")
c.execure("""CREATE TABLE `t1` (
`id` int(11)
`date` datatime(6) NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8""")
c.execure("""INSERT INTO t1 VALUES(1,now(6)), VALUES(2,NOW(6)), VALUES(3,NOW(6))""")
Now we can get data.
c.execute("""SELECT * FROM t1""")
r = c.fetchall()
print r
OUT:
((1L, None), (2L, None), (3L, None))
After patch:
c.execute("""SELECT * FROM t1""")
r = c.fetchall()
print r
OUT:
((1L, datetime.datetime(2012, 10, 3, 10, 56, 47, 800462)), (2L, datetime.datetime(2012, 10, 3, 10, 56, 47, 800462)), (3L, datetime.datetime(2012, 10, 3, 10, 56, 47, 800462)))
Metadata
Metadata
Assignees
Labels
No labels