[CONPY-150] Error when fetching results from a DATETIME with value NULL Created: 2021-04-06 Updated: 2021-08-20 Resolved: 2021-04-06 |
|
| Status: | Closed |
| Project: | MariaDB Connector/Python |
| Component/s: | DBAPI 2.0 |
| Affects Version/s: | 1.0.6 |
| Fix Version/s: | 1.0.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Kiusa Diakusen | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ubuntu 20.04 |
||
| Description |
|
Hello, I have a quite obvious bug to report: I have a table row that looks like this: The problem is that i have a DATETIME field that is NULL (the date_due date is not mandatory in my app) It seems that after passing values to the execute() method, the fetchall() method parses returned data differently. First case works great Second returns the "ValueError: year 0 is out of range"
I tried to list() the connector - same result I tried to change values and table column attributes - same result I though its a problem of versions so i updated to latest python, mariadb server and python connector (on ubuntu 20.04)- same result The result: 6, 'test 7', 10, datetime.datetime(2021, 4, 1, 21, 50, 21), None, 'content 7', 'strawsf9cdaf.txt', 16) The above exception was the direct cause of the following exception: Traceback (most recent call last): Process finished with exit code 1 I posted the issue for easy reading also to stackoverflow: |
| Comments |
| Comment by Kiusa Diakusen [ 2021-04-06 ] |
|
Tried this with the mysql connector and seems to work fine on the same database so i guess the problem is in the mariadb connector |
| Comment by Georg Richter [ 2021-04-06 ] |
|
Could you please also attach the sql definition of the table posts and provide the version of MariaDB server. Thanks! |
| Comment by Kiusa Diakusen [ 2021-04-06 ] |
|
Hello Georg, tried with null, not null and with or default value CREATE TABLE `posts` ( |
| Comment by Kiusa Diakusen [ 2021-04-06 ] |
|
Ooops i forgot mariadb --version |
| Comment by Georg Richter [ 2021-04-06 ] |
|
fixed in rev. 6e50bfcbe5c485937b152c516ce94e426229ca72 |
| Comment by Kiusa Diakusen [ 2021-04-06 ] |
|
Thank you, Georg! |
| Comment by Georg Richter [ 2021-04-06 ] |
|
You can download the sources from Github and build the package with python setup.py build and python setup.py install. |
| Comment by Kiusa Diakusen [ 2021-04-06 ] |
|
Thank you very much! |