Skip to content

Spaces and double quotes #52

@satirebird

Description

@satirebird

I have some trouble with spaces in the tags. The following code results in an error:

let write_query = WriteQuery::new(Timestamp::Now, "temperature") .add_field("value", 25) .add_tag("tag1", "ABC DEF".to_string()); 

The error contains: Err(DatabaseError { error: "influxdb error: \"{\"error\":\"unable to parse \'temperature,tag1=\\\"ABC DEF\\\" value=25\': invalid field format\"}\n\"" })

By replacing the spaces with a backslash influxdb accepts the request:

let write_query = WriteQuery::new(Timestamp::Now, "temperature") .add_field("value", 25) .add_tag("tag1", "ABC DEF".replace(" ", "\\ ")); 

The second issue is that the influxdb stores the double quotes of the tags as follows:

time tag1 value ---- --- ----- 1583008260693608605 "ABC DEF" 25 

If I use the python influxdb client the double quotes are not stored. So I tested it without surrounding double quotes. I changed write_query.rs as follows:

-Text(text) => write!(f, "\"{text}\"", text = text), +Text(text) => write!(f, "{text}", text = text), 

It works as expected. So I guess that the spaces must be handled by escaping with backslash instead of surrounding with quotes.

influxdb version is 1.3.6-1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions