Hi ,
This is driving me crazy. I’ve looked everywhere but everything i try wont seem to work.
I’m reading data from a SenseHat device - temperature, pressure, humdity.
the relevant sections of Py code is this:
datapoints = [
{
“measurement”: session,
“tags”: {
“runNum”: runNo
},
“time”: timestamp,
“fields”: {
“temperaturevalue”:temperature,“humidityvalue”:humidity,“pressurevalue”:pressure,“compass”:north
}
}
]
…
datapoints=get_data_points()
bResult=client.write_points(datapoints)
When the code runs, I get this:
raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {“error”:“partial write: field type conflict: input field “pressurevalue” on measurement “test1” is type float, already exists as type integer dropped=1”}
whatever i do, its the pressurevalue that causes the error - all others are fine.
Does anyone know how i can solve this?
Thanks muchly in advance - this is so confusing.
Dan
You’ve previously written that field as a float, but now you’re sending an integer. Make sure you continue to send a float.
If you continue with an integer, it will eventually work when the shard rolls over; as type checks are only enforced within a shard. This can lead to longer term problems.
Thanks, mate - much appreciated.
cheers
d
rawkode - how do i stop sending an integer? is there some syntax that i am not using correctly?
Thanks and cheers
Dan
It’s actually the other way around, I misread the error. You initially sent an integer and now it’s a float.
I’m assuming you actually want a float for the temperature value, so this is slightly more complicated now.
Do you need the old data in the DB?
nup - dont need the old data
when i changed “pressurevalue” to “pressure”, it worked. I stopped the script, then restarted, and the same error came up.
I then changed the “pressure” back to “pressurevalue”, and it worked again.
this has happened a few times. whenever i get the error, i change the field name, and it seems to work - it only happens with the pressure, none of the others.
just seems weird.
Thanks for your time.
Cheers, Dan
You should try forcing a float:
float(pressure)