summaryrefslogtreecommitdiff
path: root/anotherBug.py
blob: ce52cf44c3c898df3391b2ab92a7ed224f41918a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""
another bug?
in 2016/07/23 18:37:37 InfluxDB starting, version 0.13.0, branch 0.13, commit e57fb88a051ee40fd9277094345fbd47bb4783ce
the escaping of the 'key' or 'name' is strange
"""
from pyinflux.client import Influx, Line

influxdb = Influx('localhost')

print(influxdb.execute('DROP DATABASE test').as_text())
print(influxdb.execute('CREATE DATABASE test').as_text())


def write(line):
    print(repr(line))
    print(str(line))
    return influxdb.write_db('test', [line])


print(write(Line('asd\\', {'tag1': ''}, {'field1': ''})))
print(write(Line('asd\\\\', {'tag1': ''}, {'field1': ''})))


def query(q):
    print(q)
    try:
        return influxdb.query_db('test', q).as_json()
    except Exception as e:
        return str(e)

# at least some of these query must return something...
print(query('SELECT * FROM asd'))
print(query('SELECT * FROM asd\\'))
print(query('SELECT * FROM asd\\\\'))
print(query('SELECT * FROM "asd"'))
print(query('SELECT * FROM "asd\\\\"'))