Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

DataFrameClient.query() ignores database parameter #539

Closed
witosx opened this issue Nov 29, 2017 · 1 comment · Fixed by #540
Closed

DataFrameClient.query() ignores database parameter #539

witosx opened this issue Nov 29, 2017 · 1 comment · Fixed by #540

Comments

@witosx
Copy link

witosx commented Nov 29, 2017

Worked with influxdb-python v4.1.1
Fails with influxdb-python v5.0.0

import influxdb

client = influxdb.DataFrameClient(host='localhost', port=18086)
client.query("select * from foo", database="test")
InfluxDBClientError                       Traceback (most recent call last)
<ipython-input-11-85af990ed2e6> in <module>()
      2 
      3 client = influxdb.DataFrameClient(host='localhost', port=18086)
----> 4 client.query("select * from foo", database="test")

~/.local/python/lib/python3.6/site-packages/influxdb/_dataframe_client.py in query(self, query, params, epoch, expected_response_code, database, raise_errors, chunked, chunk_size, dropna)
    176                           chunked=chunked,
    177                           chunk_size=chunk_size)
--> 178         results = super(DataFrameClient, self).query(query, **query_args)
    179         if query.strip().upper().startswith("SELECT"):
    180             if len(results) > 0:

~/.local/python/lib/python3.6/site-packages/influxdb/client.py in query(self, query, params, epoch, expected_response_code, database, raise_errors, chunked, chunk_size)
    403             ResultSet(result, raise_errors=raise_errors)
    404             for result
--> 405             in data.get('results', [])
    406         ]
    407 

~/.local/python/lib/python3.6/site-packages/influxdb/client.py in <listcomp>(.0)
    402         results = [
    403             ResultSet(result, raise_errors=raise_errors)
--> 404             for result
    405             in data.get('results', [])
    406         ]

~/.local/python/lib/python3.6/site-packages/influxdb/resultset.py in __init__(self, series, raise_errors)
     23 
     24         if self.error is not None and raise_errors is True:
---> 25             raise InfluxDBClientError(self.error)
     26 
     27     @property

InfluxDBClientError: database name required
@xginn8
Copy link
Collaborator

xginn8 commented Nov 29, 2017

Looks like this was introduced in 1a7c56c (from git bisect). I'll fix this today. Thanks for reporting @witosx!

xginn8 added a commit to xginn8/influxdb-python that referenced this issue Nov 29, 2017
@aviau aviau closed this as completed in #540 Dec 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants