Write multiple fields at the same timestamp

I tried to write with the python client and the dictionary style mapping this kind a data, e.g.

record = [
{
‘measurement’: ‘monitoring’,
‘fields’:
{
‘user_id’: ‘1’,
‘zone_id’: ‘11’,
‘device_id’: ‘abc’,
‘missing_values’: 10.0
},
‘time’: ‘2021-11-21T00:00:00Z’
},
{
‘measurement’: ‘monitoring’,
‘fields’:
{
‘user_id’: ‘1’,
‘zone_id’: ‘12’,
‘device_id’: ‘def’,
‘missing_values’: 5.0
},
‘time’: ‘2021-11-21T00:00:00Z’
},

]

I can have multiple zone_id for a user_id and multiple device_id for a zone_id. I can’t set user_id, zone_id or device_id as tags because there are two many values which will give a cardinality too high.

When I write the record in the database only the last elements for a given time is stored because all previous elements are replaced. I know that I can solve the problem by increasing a little bit time for a given day but I don’t think it is an elegant solution.

Is it possible to write multiple fields for a given timestamp in Influxdb or Influxdb is not meant to be used like this?

Thank you.

Loïc

Hi @LoicRaillon,

thanks for using our client.

Is it possible to write multiple fields for a given timestamp in Influxdb or Influxdb is not meant to be used like this?

No, there is no option how to write multiple same fields with same tags for a given timestamp.

Regards

Thank you for your fast and clear response.

Have a nice day.

1 Like