Skip to content

Commit

Permalink
✨ use dateutil to parse SQLite dates
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Jul 20, 2024
1 parent 5d23476 commit f4abb77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mysql_to_sqlite3/sqlite_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import date, timedelta
from decimal import Decimal

from dateutil.parser import parse as dateutil_parse
from dateutil.parser import parse as dateutil_parse, ParserError
from pytimeparse2 import parse


Expand Down Expand Up @@ -51,7 +51,7 @@ def convert_date(value: t.Union[str, bytes]) -> date:
"""Handle SQLite date conversion."""
try:
return dateutil_parse(value.decode() if isinstance(value, bytes) else value).date()
except ValueError as err:
except ParserError as err:
raise ValueError(f"DATE field contains {err}") # pylint: disable=W0707


Expand Down

0 comments on commit f4abb77

Please sign in to comment.