Help fixing in schema/data mess

This is one of those problems that’s hard to fix…
I know what you can do in InfluxDB1, and as far as I know, it should be valid also for InflxDB2, I’ve never worked with InflxDB Cloud, therefore I don’t know if there are additional limitations

I’ll put here some references and a quick summary.

here is how InfluxDB behaves, and why you have different data types:

  • mixed data types for fields - FAQ link
  • changing data type - FAQ link, it also explains how to fin the time intervals with messed up data types

here is a post that had the very same problem (kind of unsolved as far as I can see).

The process is just one, Export - Delete - Insert back

  • Export the measurement data, the one you need to change if you can identify them
  • delete the “wrong” data points
  • Insert the data you previously exported (after fixing them ofc)

you may not need to actually export/download the data, you can write a query to select the data and manage/cast them to the proper data type, and write them to a temp/support measurement. (making a partial or full copy of the data)
Up to what you’ve chosen to do, you can drop the whole “old” measurement or just the wrong data points.
Insert the data form your temp/support measurement to the old one (if it has been deleted, it will just be re-created).

hope it helps

edit:
I forgot to add that the only way to avoid this kind of issue is casting/enforcing data types in the inputs (as InfluxDB is not strongly typed) if you are using Telegraf you can use the converter processor, otherwise you will need to serialize the data correctly before sending them to the DB.