# INSERT error with simple data

**URL:** <https://community.influxdata.com/t/insert-error-with-simple-data/8237>\
**Category:** Systems\
**Created:** [January 22, 2019, 4:06am UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237 "2019-01-22T04:06:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![smbunn](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/smbunn/32/1469_2.png) [@smbunn](https://community.influxdata.com/u/smbunn)\
**Post date:** [January 22, 2019, 4:06am UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237/1 "2019-01-22T04:06:40Z")

</div>

I am new to setting up my own InfluxDB but have used it a lot with [Hass.IO](http://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.

````auto
 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?
````

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [January 22, 2019, 1:45pm UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237/2 "2019-01-22T13:45:34Z")

</div>

Hi ,

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

[Line Protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/)

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

---

<div class="post-metadata">

**Author:** ![philb](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/philb/32/1805_2.png) [@philb](https://community.influxdata.com/u/philb)\
**Post date:** [January 22, 2019, 4:16pm UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237/3 "2019-01-22T16:16:32Z")

</div>

The single quotes around the string

```auto
'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?

---

<div class="post-metadata">

**Author:** ![smbunn](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/smbunn/32/1469_2.png) [@smbunn](https://community.influxdata.com/u/smbunn)\
**Post date:** [January 22, 2019, 7:29pm UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237/4 "2019-01-22T19:29:50Z")

</div>

```auto
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

---

<div class="post-metadata">

**Author:** ![smbunn](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/smbunn/32/1469_2.png) [@smbunn](https://community.influxdata.com/u/smbunn)\
**Post date:** [January 22, 2019, 8:22pm UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237/5 "2019-01-22T20:22:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [February 20, 2019, 3:19pm UTC](https://community.influxdata.com/t/insert-error-with-simple-data/8237/6 "2019-02-20T15:19:41Z")

</div>

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
