INSERT error with simple data

I am new to setting up my own InfluxDB but have used it a lot with Hass.IO, my LoRa gateway and Node-Red. But now I am after something even easier, but am stumped, I have read the documentation 5 times and tried the same INSERT 5 different ways but cannot get a new measurement created.

 INSERT SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure TagDescription='Pump 1 Suction Pressure' Units=m value=3.098737 1546254060
ERR: {"error":"unable to parse 'SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure TagDescription='Pump 1 Suction Pressure' Units=m value=3.098737 1546254060 ': invalid boolean"}

> INSERT SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure TagDescription='Pump 1 Suction Pressure',Units=m,value=3.
098737 1546254060
ERR: {"error":"unable to parse 'SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure TagDescription='Pump 1 Suction Pressure',Units=m,value=3.098737 1546254060 ': invalid boolean"}

> INSERT SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription='Pump 1 Suction Pressure',Units=m value=3.
098737 1546254060
ERR: {"error":"unable to parse 'SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription='Pump 1 Suction Pressure',Units=m value=3.098737 1546254060 ': invalid field format"}

> INSERT SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription='Pump 1 Suction Pressure',Units=m value=3.
098737 1546254060
ERR: {"error":"unable to parse 'SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription='Pump 1 Suction Pressure',Units=m value=3.098737 1546254060 ': invalid field format"}

> INSERT SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription="Pump 1 Suction Pressure",Units=m value=3.
098737 1546254060
ERR: {"error":"unable to parse 'SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription=\"Pump 1 Suction Pressure\",Units=m value=3.098737 1546254060 ': invalid field format"}

> INSERT SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription="Pump 1 Suction Pressure",Units="m" value=
3.098737 1546254060
ERR: {"error":"unable to parse 'SPK-ABGRASSO-PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription=\"Pump 1 Suction Pressure\",Units=\"m\" value=3.098737 1546254060 ': invalid field format"}```
What an I doing wrong?

Hi ,

it’s a question of the Line Protocol :slight_smile:
insert measurement,tagkey1=tagvalue1,tagkey2=tagvalue2 fieldkey1=fieldvalue1,fieldkey2=fieldvalue2 timestamp
( be carefull with comma’s and spaces )
have you read this ?

Line Protocol

this line works for example :

IINSERT SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure TagDescription=“Pump 1 Suction Pressure”,Units=“m”,value=3.0986855 1548163296778633237

best regards

The single quotes around the string

'Pump 1 Suction Pressure'

Should be double quotes as in Marc’s example. I think thats where the invalid boolean error comes from.

Tags don’t need quoting, Influx assumes these are strings anyway

ERR: {"error":"unable to parse 'SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription=\"Pump 1 Suction Pressure\",Units=m value=3.098737 1546254060 ': invalid field format"}

This is because you are quoting a tag value, removing the space between Type and TagDescription turns it into a tag. That one will insert everything as a tag value though, well. It won’t but if the syntax was correct then that would be the end result.

Is TagDescription meant to be a field or tag?

INSERT SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription="Pump 1 Suction Pressure",Units=m value=3.098737 1546254060

This was one of my tests. It has the double quotes, otherwise the spaces in TagDesription wil be misinterpreted as the start of values. I read very carefully the Line Protocol and cannot see where I have gone wrong with this line. I wanted TagDescription as a field, but I see your example has it as a value. Not sure why you use one over the other? I suppose if it is unique to the measurement then it should be a field? Both Tag Description and Units never change, and I wanted to be able to sort through all measurements of “units=m” so that I can see all of my pressure readings regardless of site.
Can I do this if it is a field?
Thanks

I am actually after the ability to show tags first listed by site, then type, then possibly units.
The only way I can see to do this is to create one single measurement, say called “Client” with one Insert that has the 980 value fields and then repeat this 200,000 times to enter my data at each time step as I have 6 months of historical data at minute intervals to enter.

Then when querying the database it will just say I have one measurement called “Client” from which I can then filter by site or type.

That seems incredibly clumsy so I am again missing something.

Hi if you want to use blanks in a tag value , you must escape the spaces with a backslash \ … and not use quotes.
If you use quotes in a tag value , the quotes will be part of the value.
So your insert would be :
INSERT SPK_ABGRASSO_PASP1Mm,Site=Abbiategrasso,Type=Pressure,TagDescription=Pump\ 1\ Suction\ Pressure,Units=m value=3.098737 1546254060

PS: you said : “I wanted TagDescription as a field, but I see your example has it as a value.”
i think you mean : “I wanted TagDescription as a TAG , but I see your example has it as a FIELD.”

there are tag key-tag value pairs and field key - field value pairs , tags are always strings and indexed , fields can be floats , integers , Booleans or strings and are never indexed.
Tag values never have quotes , field values need double quotes if they are strings and these can contain spaces without escaping them with a \ .
Boolean values also never have quotes else they will be inserted as strings , for example :

insert boolexample bool1=“t”
insert boolexample bool2=t
show field keys from boolexample
name: boolexample
fieldKey fieldType
bool1 string
bool2 boolean