You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into this via kvesteri/sqlalchemy-utils#392 and wanted to see if I could get it working simply. Digging deeper, it looks like this fails because native date objects don't easily parse string input into dates. Since DateInterval's type property is set to date, this causes coerce_string to fail.
I tried working around this by subclassing date, but my solution broke the creation of DateInterval instances through other means. It looks like coerce_value expects a lot out of type. I could probably get everything working but only in a hacky, sub-par way. Also, my solution relied on date.fromisoformat(), which is Python 3.7+.
I would probably take refuge in arrow because I love how much it makes date-handling and parsing easier, but that would add another dependency. Even then I'm not familiar enough with how intervals wants to use the type property to make sure it's handled gracefully.
Anyway, I hope this helps someone braver/better/with more time than me to tackle this when they have a chance.
Problem & Codes
Running following codes, a type error will be raised:
DateInterval.from_string('[(2000-01-01),]')
Error Details
self = <[AttributeError("'DateInterval' object has no attribute 'lower_inc'") raised in repr()] DateInterval object at 0x3730ef0>
value = '2000-01-01'
E TypeError: an integer is required (got type str)
The text was updated successfully, but these errors were encountered: