[CONPY-45] Incorrect conversion of time/datetime values Created: 2020-03-25  Updated: 2020-03-25  Resolved: 2020-03-25

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 0.9.54
Fix Version/s: 0.9.55

Type: Bug Priority: Major
Reporter: Georg Richter Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

When converting time types with microseconds, the number of microseconds is incorrect.

Example:

    def test_time(self):
        con= create_connection()
        cursor = con.cursor()
        cursor.execute("CREATE TEMPORARY table t1 (a time(3))")
        cursor.execute("INSERT INTO t1 VALUES ('13:12:24.05111')")
        cursor.execute("SELECT a FROM t1");
        row= cursor.fetchone()
        self.assertEqual(row[0], datetime.time(13, 12, 24, 51000)) 
        del cursor
        del con

Output:

AssertionError: datetime.time(13, 12, 24, 51) != datetime.time(13, 12, 24, 51000)


Generated at Thu Feb 08 03:29:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.