vercel / cosmosdb-query

A SQL parser and executor for Cosmos DB
MIT License
18 stars 8 forks source link

OFFSET & LIMIT not supported #5

Open asleire opened 4 years ago

asleire commented 4 years ago

Attempting to execute the following query

SELECT VALUE root
FROM root
WHERE (root["value"] = "value2")
OFFSET 0 LIMIT 1

will throw the following exception

{
  "message": "Expected \"!=\", \"%\", \"&\", \"*\", \"+\", \"-\", \"--\", \".\", \"/\", \"<\", \"<<\", \"<=\", \"<>\", \"=\", \">\", \">=\", \">>\", \">>>\", \"?\", \"??\", \"AND\", \"BETWEEN\", \"IN\", \"OR\", \"ORDER\", \"[\", \"^\", \"|\", \"||\", [ \\t\\n\\r], or end of input but \"O\" found.",
  "expected": [], // omitted for brevity
  "found": "O",
  "location": {
    "start": {
      "offset": 61,
      "line": 4,
      "column": 1
    },
    "end": {
      "offset": 62,
      "line": 4,
      "column": 2
    }
  },
  "name": "SyntaxError"
}
elbasan commented 2 years ago

did you ever figure this out? I have the same issue

asleire commented 2 years ago

I was trying to use this in order to run automated integration tests in a linux environment without setting up a real cosmos database. Unfortunately I gave up since I faced too many quirks. Fortunately Microsoft now supports running the CosmosDB Emulator in Docker for Linux! https://docs.microsoft.com/en-us/azure/cosmos-db/linux-emulator?tabs=ssl-netstd21

elbasan commented 2 years ago

I'm trying to run integration tests as well with jest, I guess that the created databases do not support offset & limit. Too bad

but thanks for the link!