Cannot insert historic data with two different data types for field

#1

I’m currently trying to migrate some historic data into an influx db. To insert the historic data I’m running a python script using the write_points() method in the influxdb python library. the json structure for a single point is as follows

f_value = float(value)
json_body = {
            "measurement": measurement,
            "tags": {
                "host": host,
                "topic": topic,
            },
            "time": time,
            "fields": {
                " value_float": f_value,
            }
        } 

The measurement that I’m trying to insert this json data into is called mqtt_consumer. The problem I’m having is when I try to insert the measurements I get the following message
influxdb.exceptions.InfluxDBClientError: 400: {“error”:“field type conflict: input field “value” on measurement “mqtt_consumer” is type float, already exists as type string dropped=1000”}
when I run the “SHOW FIELD” KEYS I get the following for mqtt_consumer

name: mqtt_consumer
fieldKey fieldType


value string
value float

Is there any way I can insert the data as floats? In theory the table is just meant to contain floats as values is there any way I can find out what values are strings and remove them or convert them to floats?

1 Like