The word "name" is a keyword within InfluxQL, so you have to wrap it in
double-quotes. Do you get the same error if you update the query to the
following (wrapping 'name' in double-quotes)?

> SELECT * FROM bmspoint WHERE time > now() - 10m AND "name" =
'B10_Area3for2_E_MtrEl6_PwrActv'

You can find more information on proper quoting in the InfluxDB
documentation FEI here
<https://docs.influxdata.com/influxdb/v0.13/troubleshooting/frequently_encountered_issues/#single-quoting-and-double-quoting-in-queries>
.

Thanks,
Ross

On Mon, Jun 13, 2016 at 10:01 PM, <melissa.flores...@gmail.com> wrote:

> I'm trying to collect data from a particular sensor, so I used the
> following code to retrieve the data.
>
> data = client.query("SELECT * FROM bmspoint WHERE time > now() - 10m AND
> name = 'B10_Area3for2_E_MtrEl6_PwrActv'")
>
>
> Although data does exist for this sensor in this particular time frame, I
> receive the following error.
>
> InfluxDBClientError                       Traceback (most recent call last)
> <ipython-input-252-a8110907c888> in <module>()
>       4     if n.find(request) != -1:
>       5         print ("True")
> ----> 6         data2 = client.query("SELECT * FROM bmspoint WHERE time >
> now() - 10m AND name = 'B10_Area3for2_E_MtrEl6_PwrActv'")
>       7         print data2
>       8     else:
>
> /Users/3for2/anaconda/lib/python2.7/site-packages/influxdb/_dataframe_client.pyc
> in query(self, query, chunked, database)
>      77
>      78         """
> ---> 79         results = super(DataFrameClient, self).query(query,
> database=database)
>      80         if query.upper().startswith("SELECT"):
>      81             if len(results) > 0:
>
> /Users/3for2/anaconda/lib/python2.7/site-packages/influxdb/client.pyc in
> query(self, query, params, epoch, expected_response_code, database,
> raise_errors)
>     323             params=params,
>     324             data=None,
> --> 325             expected_response_code=expected_response_code
>     326         )
>     327
>
> /Users/3for2/anaconda/lib/python2.7/site-packages/influxdb/client.pyc in
> request(self, url, method, params, data, expected_response_code, headers)
>     246             return response
>     247         else:
> --> 248             raise InfluxDBClientError(response.content,
> response.status_code)
>     249
>     250     def write(self, data, params=None, expected_response_code=204):
>
> InfluxDBClientError: 400: {"error":"error parsing query: found NAME,
> expected identifier, string, number, bool at line 1, char 53"}
>
>
> I did not receive this error when I used other tags. Any advice?
>
> Thanks!
>
> --
> Remember to include the InfluxDB version number with all issue reports
> ---
> You received this message because you are subscribed to the Google Groups
> "InfluxDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to influxdb+unsubscr...@googlegroups.com.
> To post to this group, send email to influxdb@googlegroups.com.
> Visit this group at https://groups.google.com/group/influxdb.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/influxdb/b93de22f-af40-48df-804d-3c570bb01803%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to influxdb+unsubscr...@googlegroups.com.
To post to this group, send email to influxdb@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/CAD8sRLD46J39p0jcYYv%3DmSWcRGqWpKqa7H0TuP_twpFn%2BAq-MA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to