Skip to content

Reading date '0000-00-00' from db does not result in python datetime.date objet but is converted to string #607

Open
@txicos

Description

@txicos

A date value of 0000-00-00 is apparently valid in mysql. When attempting to read this value from the db no conversion is made to a valid python date. it should at least be converted to None, instead of keeping the '0000-00-00' string.

follows an exemple:
mysql> select DT_TESTE from TABLE_TEST;
+-------------------+
| DT_TESTE |
+-------------------+
| 0000-00-00 |
| 0000-00-00 |
| 0000-00-00 |
| 2021-03-18 |
| 2021-03-18 |
| 2021-04-01 |

result after:
row = await cur.fetchall()
print(row)

('0000-00-00')
('0000-00-00')
('0000-00-00')
(datetime.date(2021, 3, 18))
(datetime.date(2021, 3, 18))
(datetime.date(2021, 4, 1))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions