Given that the python statement already includes double-quotes, I suspect
you need to escape the InfluxQL double-quotes.

Does this work?

data = client.query("SELECT * FROM bmspoint WHERE time > now() - 10m AND
\"name\" = 'B10_Area3for2_E_MtrEl17_PwrActv'")


On Thu, Jun 16, 2016 at 10:28 AM, Ross McDonald <[email protected]> wrote:

> That query doesn't trigger any errors when run from the InfluxDB CLI, so
> it might be referring to a Python syntax error. I would also expect to see
> an exception if it was an error returned from InfluxDB.
>
> Thanks,
> Ross
>
> On Wed, Jun 15, 2016 at 7:44 PM, Melissa Flores <[email protected]>
> wrote:
>
>> data = client.query("SELECT * FROM bmspoint WHERE time > now() - 10m AND
>> "name" = 'B10_Area3for2_E_MtrEl17_PwrActv'")
>>
>> Output:
>>
>> File "<ipython-input-587-bb9b83c27768>", line 1
>> data = client.query("SELECT * FROM bmspoint WHERE time > now() - 10m AND
>> "name" = 'B10_Area3for2_E_MtrEl17_PwrActv'")
>> ^ SyntaxError: invalid syntax
>>
>>
>> On Wed, Jun 15, 2016 at 8:39 PM, Ross McDonald <[email protected]> wrote:
>>
>>> Can you paste the full query and error output? It sounds like there
>>> might be something else off with the query syntax.
>>>
>>> Thanks,
>>> Ross
>>>
>>> On Tue, Jun 14, 2016 at 8:45 PM, Melissa Flores <[email protected]>
>>> wrote:
>>>
>>>> When I attempted to use double quotes around 'name' , I received
>>>> "SyntaxError: invalid syntax"
>>>>
>>>> On Tue, Jun 14, 2016 at 10:02 PM, Ross McDonald <[email protected]>
>>>> wrote:
>>>>
>>>>> 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, <[email protected]> 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 [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> 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 a topic in the
>>>>> Google Groups "InfluxDB" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/influxdb/1xO89WxckRs/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> 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
>>>>> <https://groups.google.com/d/msgid/influxdb/CAD8sRLD46J39p0jcYYv%3DmSWcRGqWpKqa7H0TuP_twpFn%2BAq-MA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Melissa Flores
>>>> The University of Texas at Austin
>>>> Cockrell School of Engineering | Architectural Engineering
>>>> Senate of College Councils | Co-Chair, Undergraduate Research Committee
>>>>
>>>> --
>>>> 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>> 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/CAHFqZhRg3N70ZVRad2BQJ5H948qEBm-w5_qNH266ChjENgBcyg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/influxdb/CAHFqZhRg3N70ZVRad2BQJ5H948qEBm-w5_qNH266ChjENgBcyg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> 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 a topic in the
>>> Google Groups "InfluxDB" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/influxdb/1xO89WxckRs/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To post to this group, send email to [email protected].
>>> 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/CAD8sRLCv-S_f67tpy35%2Bd9xoSd-fi%3DC3qY02F7%3DsX4z6vY23Lw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/influxdb/CAD8sRLCv-S_f67tpy35%2Bd9xoSd-fi%3DC3qY02F7%3DsX4z6vY23Lw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Melissa Flores
>> The University of Texas at Austin
>> Cockrell School of Engineering | Architectural Engineering
>> Senate of College Councils | Co-Chair, Undergraduate Research Committee
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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/CAHFqZhSwcWkT%2BnGkP%2B7g%2BaHKm09weLiqXj3WOSB5XVZcFPhSLQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/influxdb/CAHFqZhSwcWkT%2BnGkP%2B7g%2BaHKm09weLiqXj3WOSB5XVZcFPhSLQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/CAD8sRLC83DWU0NYyX7AJgminEj5y-nSS_A53U065MD3Gj5eaSw%40mail.gmail.com
> <https://groups.google.com/d/msgid/influxdb/CAD8sRLC83DWU0NYyX7AJgminEj5y-nSS_A53U065MD3Gj5eaSw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Sean Beckett
Director of Support and Professional Services
InfluxDB

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CALGqCvOc5frE4hDxFsGwDQuz167fztqV06RdgKDpvrgkYJp1Mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to