I would like to import older data points (dump from MariaDB) into a new influxdb 1.8.10 installation (Home Assistant - Hassio) and unfortunately, I am not able to import tag keys - they get imported as new field keys instead.
I am testing the following:
influx -user=REDACTED -password=REDACTED -database="home_assistant" -import -path=test.line -precision=ns
where cat test.line
# DML
# CONTEXT-DATABASE: home_assistant
test,domain=sensor,entity_id=ebusd_returntemp,source=hass device_class_str="temperature",state="on",friendly_name_str="ebusd ReturnTemp",unit_of_measurement_str="˚C",value=30.31 1660229763340000000
The test
measurement is a partial copy of real measurement created by Home Assistant (influxdb recorder).
Unfortunately, the the tag keys are imported as new field keys (those suffixed by _1
in SELECT command):
> select * from test order by time DESC limit 3
name: test
time device_class_str domain domain_1 entity_id entity_id_1 friendly_name_str icon_str source source_1 state unit_of_measurement_str value
---- ---------------- ------ -------- --------- ----------- ----------------- -------- ------ -------- ----- ----------------------- -----
1660229763340000000 temperature sensor ebusd_returntemp ebusd ReturnTemp hass on ˚C 30.31
1641072387911000000 temperature sensor ebusd_returntemp ebusd ReturnTemp hass °C 26.06
1641072322980000000 temperature sensor ebusd2_roomtemp ebusd2 RoomTemp hass °C 20.69
Why does his happen and how to avoid it?
More info:
> show series from test
key
---
test
test,domain=sensor,entity_id=ebusd_returntemp,source=hass
> show tag keys from test
name: test
tagKey
------
domain
entity_id
source
Here, the domain
, entity_id
and source
field keys were created only after import:
> show field keys from test
name: test
fieldKey fieldType
-------- ---------
device_class_str string
domain string
entity_id string
friendly_name_str string
icon_str string
source string
state string
unit_of_measurement_str string
value float