Skip to content

Conversation

vtermanis
Copy link

The logic to convert microseconds in mytopy_datetime does not work properly (i.e. MySQL to Python conversion when using C extension). E.g. a value of 2016-10-20 15:40:23.8 from MySQL results in a datetime.datetime(2016, 10, 20, 15, 40, 23, 8).
The correct value should be: datetime.datetime(2016, 10, 20, 15, 40, 23, 800000).

This change uses the logic in mytopy_time to address this issue.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@vtermanis
Copy link
Author

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=83479 for updates.
Thanks

@vtermanis vtermanis deleted the cext_datetime_usec branch October 21, 2016 13:59
@lefred
Copy link

lefred commented Oct 25, 2016

A developer has been assigned to your contribution and will verify it.

@dikang123
Copy link

this bug is still not fixed right now?

@vtermanis
Copy link
Author

@dikang123 - I'd comment on https://bugs.mysql.com/bug.php?id=83479 if you're affected by this to get more attention.

@philip
Copy link

philip commented Nov 5, 2020

Fixed as of the upcoming MySQL Connector/Python 8.0.23 release, and here's the proposed changelog entry from the documentation team:

Fixed the microsecond conversion from MySQL datetime to Python datetime
when using fractional values with the C extension enabled. For example,
2016-10-20 15:40:23.8 from MySQL resulted in datetime.datetime(2016, 10,
20, 15, 40, 23, 8) instead of datetime.datetime(2016, 10, 20, 15, 40, 23,
800000). Thanks to Vilnis Termanis for the patch.

Thank you for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants