Open fcoetzee opened 4 years ago
@fcoetzee thanks for the issue. Does https://github.com/influxdata/influxdb-client-python suffer the same issue?
Yup. Problem is here in file
influxdb-client-python-master/influxdb_client/client/write/point.py
Hi @fcoetzee,
As you mentioned the datetime
has a precision to microseconds and also almost all time libraries are without supports of nanoseconds:
We will have to use something like pandas timestamp:
>>> import pandas as pd
>>> pd.to_datetime('1996-02-25T21:20:00.001001231Z', unit='ns')
Timestamp('1996-02-25 21:20:00.001001231+0000', tz='UTC')
Regards
Note that in the file client/write/point.py the ciso8601 library is used to convert timestamp strings to datetime.datetime objects,
However, the datetime.datetime format returned no longer supports nano-seconds, it ignores everything past microseconds
In [181]: ciso8601.parse_datetime('1996-02-25T21:20:00.001001231Z') Out[181]: datetime.datetime(1996, 2, 25, 21, 20, 0, 1001, tzinfo=datetime.timezone.utc)
Since nano-seconds are the default write precision for the DataBase, this is a major failure
No simple solution here -- the datetime libraries use dto support nanosecs, but in a streak of purism were changed to be POSIX compliant (and posix only talked about microseconds).