Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Can't write point with numerical and string field keys #793

Open
@mattcarp12

Description

@mattcarp12
  • InfluxDB version: 1.7.10
  • InfluxDB-python version: 5.2.3
  • Python version: 3.8.2
  • Operating system version: Ubuntu 18.04
# python
Python 3.8.2 (default, Feb 26 2020, 15:17:37) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> foo = {1:2, 3:4, "foo":"bar"}
>>> from influxdb import InfluxDBClient
>>> idb = InfluxDBClient(
...     host="influxdb",
...     port=8086,
...     username="root",
...     password="root",
...     database="test",
... )
>>> point = [{"measurement": "test", "fields": foo}]
>>> idb.write_points(point)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 525, in write_points
    return self._write_points(points=points,
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 594, in _write_points
    self.write(
  File "/usr/local/lib/python3.8/site-packages/influxdb/client.py", line 331, in write
    data = make_lines(data, precision).encode('utf-8')
  File "/usr/local/lib/python3.8/site-packages/influxdb/line_protocol.py", line 156, in make_lines
    for field_key, field_value in sorted(iteritems(point['fields'])):
TypeError: '<' not supported between instances of 'str' and 'int'

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions