Skip to content

Fix: Reinstate dateparser==1.2.2 with a workaround for the upstream issue#5076

Closed
erindru wants to merge 1 commit intomainfrom
erin/fix-dateparser
Closed

Fix: Reinstate dateparser==1.2.2 with a workaround for the upstream issue#5076
erindru wants to merge 1 commit intomainfrom
erin/fix-dateparser

Conversation

@erindru
Copy link
Collaborator

@erindru erindru commented Jul 30, 2025

dateparser==1.2.2 introduced a regression that essentially causes the following to fail:

>>> import dateparser
>>> dateparser.parse("1 minute ago")
# (returns None instead of a datetime)

This breaks a bunch of tests in SQLMesh.

However, dateparser==1.2.2 also introduced a cache that shaves several seconds off SQLMesh startup time which can add up over many invocations of SQLMesh.

So this PR adds a workaround for the upstream regression until it can be resolved upstream. The workaround is simply deleting the dateparser_tz_cache.pkl pickle file that is distributed with dateparser==1.2.2 and allowing it to be regenerated on first load.

However, we need to be careful just to delete the one that was distributed from upstream and not one that has been generated locally, since it's the source of the startup time performance improvement.

"croniter",
"duckdb>=0.10.0,!=0.10.3",
"dateparser<=1.2.1",
"dateparser>=1.2.2",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pin forces SQLMesh to use the version of dateparser that contains the performance enhancements (which dont exist in any other version), but also the parsing regression that this PR provides a workaround for

@erindru erindru force-pushed the erin/fix-dateparser branch from 8750370 to eba8345 Compare July 30, 2025 22:58
@erindru erindru force-pushed the erin/fix-dateparser branch from eba8345 to 05ba4a1 Compare July 30, 2025 23:12
@erindru erindru marked this pull request as ready for review July 30, 2025 23:19
@erindru
Copy link
Collaborator Author

erindru commented Jul 31, 2025

Closing in favour of keeping the <= 1.2.1 pin and accepting the performance penalty until dateparser is fixed upstream.

@erindru erindru closed this Jul 31, 2025
@erindru erindru deleted the erin/fix-dateparser branch August 20, 2025 03:12
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.

1 participant