swl10/pyslet

$filter fails when querying fieldnames matching OData literal types

soundstripe opened this issue · 0 comments

I am working on connecting influxdb databases via odata using your project. All influxdb databases have a field called time so when I filter the data the filter string looks like this:

$filter=time ge datetime'2016-01-01T00:00:00' and time le datetime'2016-12-31T00:00:00'

Here's the responses that I get

 <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
   <code>InvalidSystemQueryOption</code>
   <message> 
     Invalid System Query Option: $filter : ParserError: expected time literal at [4]
   </message>
 </error>

This is caused by incorrectly parsing all filterstrings starting with time as time literals, even if they are not followed by single quotes. Parsing Code Here

For now I plan to work around this, but I wanted to raise the issue here in case there are others with a similar issue. I'm assuming I'd run in to the same problem with other names that clash with odata literals (datetime, guid, and binary would be the ones I'd think might occur 'in the wild').