[ 
https://issues.apache.org/jira/browse/AVRO-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17406505#comment-17406505
 ] 

Michael A. Smith commented on AVRO-3066:
----------------------------------------

I think we should also consider adding `dateutil` as an optional dependency, 
and only supporting `duration` logicaltype if `dateutil` is installed. If it's 
not installed, we can still read documents with that type, but they would fall 
back to the `fixed size=12` type.

> Add support for duration logical type to Python implementation
> --------------------------------------------------------------
>
>                 Key: AVRO-3066
>                 URL: https://issues.apache.org/jira/browse/AVRO-3066
>             Project: Apache Avro
>          Issue Type: New Feature
>          Components: python
>            Reporter: Spencer Nelson
>            Priority: Minor
>
> The duration logical type was added back in \AVRO-739, but it still isn't in 
> the Python implementation.
> Because durations encode an integer number of months in addition to days and 
> seconds, the standard library's {{datetime.timedelta}} is insufficient for 
> representing an Avro duration.
> One option is to return a tuple - the triplet of months, days, and seconds. 
> Another option is to use a 
> [relativedelta|https://dateutil.readthedocs.io/en/stable/relativedelta.html] 
> from the well-known, but third-party, {{dateutil}} library. I would lean 
> towards the latter, but I understand the downsides of adding a dependency.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to