Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-escaping the \ character when converting to line protocol #302

Closed
sar009 opened this issue Jul 28, 2021 · 1 comment · Fixed by #303
Closed

re-escaping the \ character when converting to line protocol #302

sar009 opened this issue Jul 28, 2021 · 1 comment · Fixed by #303
Labels
bug Something isn't working
Milestone

Comments

@sar009
Copy link

sar009 commented Jul 28, 2021

  • InfluxDB version: 1.8.5
  • InfluxDB-python version: 1.18.0
  • Python version: 3.6.9
  • Operating system version: Ubuntu 18.04

influx is re-escaping \ character when converting to line protocol.
here is my python code

from influxdb import InfluxDBClient
connection = InfluxDBClient(host='localhost', database='telegraf')
points = [{
    "measurement": "test",
    "tags": {
        "tag1": "value1",
        "tag2": "value\2",
        "tag3": "value\\3",
        "tag4": r"value\4",
        "tag5": r"value\\5"
    },
    "time": 1624989000000000000,
    "fields": {
        "value": 10
    }
}]
connection.write_points(points)

influx db

> select * from test;
name: test
time                tag1   tag2   tag3     tag4     tag5       value
----                ----   ----   ----     ----     ----       -----
1624989000000000000 value1 value value\\3 value\\4 value\\\\5 10
> INSERT test,tag1=value1,tag2=value\2,tag3=value\3,tag4=value\4,tag5=value\\5 value=10i 1624999000000000000
> select * from test;
name: test
time                tag1   tag2    tag3     tag4     tag5       value
----                ----   ----    ----     ----     ----       -----
1624989000000000000 value1 value  value\\3 value\\4 value\\\\5 10
1624999000000000000 value1 value\2 value\3  value\4  value\\5   10

This was reported on slack before some days please check the conversation link below
https://influxcommunity.slack.com/archives/CHQ5VG6F8/p1625576669051600

@bednar bednar transferred this issue from influxdata/influxdb-python Aug 13, 2021
@bednar bednar added the bug Something isn't working label Aug 13, 2021
@bednar
Copy link
Contributor

bednar commented Aug 13, 2021

Hi @sar009,

thanks for using our client.

I've prepared PR #303. If you would like to use dev version of client then install client via:

pip install git+https://github.com/influxdata/influxdb-client-python.git@fix/escaping_backslash

Regards

@bednar bednar added this to the 1.20.0 milestone Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants