influxdata / influxdb-client-python

InfluxDB 2.0 python client
https://influxdb-client.readthedocs.io/en/stable/
MIT License
721 stars 187 forks source link

Python Client append fields error #239

Closed ayaghini closed 3 years ago

ayaghini commented 3 years ago

I am trying to write to influxDB, using python the following information:

`point = ( Point("myMeasuremnt") .tag("device", "myDevice) .field("data", [a flatten() array of 270 x,y,z points) .time(datetime.utcnow(), WritePrecision.NS) )

self.write_api.write(bucket=bucket, record=point)`

and getting following error: File "C:\Python37\lib\site-packages\influxdb_client\client\write\point.py", line 168, in _append_fields raise ValueError() builtins.ValueError:

the extended version of the error:

--- --- File "C:\Python37\lib\site-packages\twisted\internet\base.py", line 913, in runUntilCurrent call.func(*call.args, call.kw) File "c:\XXX\influxdb_logger.py", line 49, in _write_to_db self.write_api.write(bucket=self.bucket, record=point) File "C:\Python37\lib\site-packages\influxdb_client\client\write_api.py", line 243, in write self._serialize(record, write_precision, payloads, kwargs) File "C:\Python37\lib\site-packages\influxdb_client\client\write_api.py", line 290, in _serialize self._serialize(record.to_line_protocol(), record.write_precision, payload, **kwargs) File "C:\Python37\lib\site-packages\influxdb_client\client\write\point.py", line 115, in to_line_protocol _fields = _append_fields(self._fields) File "C:\Python37\lib\site-packages\influxdb_client\client\write\point.py", line 168, in _append_fields raise ValueError() builtins.ValueError:

Apologies if this is not relevant, but I did google and could not find any answer to this issues.

Thanks for your help.

bednar commented 3 years ago

Hi @ayaghini,

the error is caused by unsupported type of field that you want to append to Point.

This expression: .field("data", [a flatten() array of 270 x,y,z points) seems to be invalid.

Regards

bednar commented 3 years ago

This issue has been closed because it has not had recent activity. Please reopen if this issue is still important to you and you have additionally information.