influxdb-python icon indicating copy to clipboard operation
influxdb-python copied to clipboard

JSONDecodeError in client.query()

Open Vanclief opened this issue 8 years ago • 9 comments

I am trying to perform a valid query to a remote influx database. It will fail for certain time frames.

query = "SELECT * FROM {} WHERE \
            time > '{}' and time < '{}'".format(metric, str(start_date)[:10],
                    str(end_date)[:10])

    raw_tweets = client.query(query, database=dbname)

Will fail with:

File "/usr/lib/python3.6/site-packages/influxdb/client.py", line 400, in query
    data = response.json()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Why would be the response not be a valid JSON object?

Vanclief avatar Mar 10 '18 01:03 Vanclief

If you execute that same query via the CLI, is there data returned? Also, what version(s) of InfluxDB and this python library are you currently running?

xginn8 avatar Mar 11 '18 21:03 xginn8

Closing due to lack of response -- we can reopen if needed.

xginn8 avatar Jul 01 '18 17:07 xginn8

I am having the same issue

cemanughian avatar Aug 13 '19 21:08 cemanughian

Facing the same issue. Please reopen..

vshah-lifesize avatar Oct 10 '19 04:10 vshah-lifesize

Same issue here

rbdm-qnt avatar Mar 26 '20 01:03 rbdm-qnt

same problem

william-allen-harris avatar May 01 '20 11:05 william-allen-harris

same problem here using influxdb 2.0.1. Please reopen.

salvapinyol avatar Nov 13 '20 17:11 salvapinyol

same problem 2.0.3

TheOneValen avatar Mar 04 '21 21:03 TheOneValen

Same problem, could not reopen, filed #915 with more details (and a patch/workaround)

harmv avatar Feb 17 '22 15:02 harmv