tomwalder / php-gds

Google Cloud Datastore Library for PHP
Apache License 2.0
164 stars 44 forks source link

KEY() not working on GAE Launcher datastore? #102

Open markdomansky opened 8 years ago

markdomansky commented 8 years ago

I want to do a where clause to return a range of entities (i.e. "select * from metrics where key >=KEY(metrics,100) and key <= KEY(metrics,200)")

This is the error I get: key filter value must be a Key

I've tried simplifying to just "select * from metrics where key = KEY(metrics,100)" where I can see in the datastore viewer shows an id = 100.

I saw the other issue that said you can drop an entity right into it, but the full query might not know that an ID=100 exists or ID=200 exists, but there are probably ID=110 or 163.

I've tried with and without apostrophes on both 'metrics' and '100' without success.

Am I doing it wrong? Perhaps I shouldn't even be using ID like this? Perhaps the key in a where clause only be a precise value?

To be fair, I haven't yet tried this on GAE + datastore, should I expect different behavior?

tomwalder commented 8 years ago

Hi there,

There are differences in the local system, as it uses a GQL parser I wrote (the local development server does not support GQL natively.

I would certainly try on App Engine and see what it does.

I'll also try and put some time into your specific query.

Tom