-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datastore.select - does it work with column names that have solely integers? #810
Comments
// @pcostell |
Projection queries in Datastore are a little different compared to a traditional SQL projection. In particular, the projection only works if it is being run on an index (in fact, this is why we offer projection queries, so that the query only needs to perform an index scan and not the accompanied entity lookup). In the case of |
Taking your advice and using Datastore.query({
namespace: 'accounts',
path: [ pathmap[ req.query.metric ] ],
select: [n],
filter: {
"date >=": req.query.ds || m.startOf('month').unix(),
"date <=": req.query.de || m.endOf('month').unix()
}
}, function (error, stats) {
console.dir(error);
}); Here is the transaction object before it is sent to the Datastore servers: {
namespace: 'accounts',
kinds: [ 'analytics' ],
filters:
[ { name: 'date', op: '>=', val: 1438408800 }, { name: 'date', op: '<=', val: 1441087199 } ] ]
orders: [],
groupByVal: [],
selectVal: [ '5666823336886272' ],
autoPaginateVal: true,
startVal: null,
endVal: null,
limitVal: -1,
offsetVal: -1,
... [fns]
} And here is the response: {
error: {
code: 412,
message: 'Precondition Failed'
}
} Using the same code I can make a query and select the |
You can query by In order to answer this query, you would need an index on |
Okay, I get it, thank you. |
Source-Link: googleapis/synthtool@d229a12 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:74ab2b3c71ef27e6d8b69b1d0a0c9d31447777b79ac3cd4be82c265b45f37e5e
Hey dev team, we have a Datastore table like this:
As you can see, the column names are integers, i.e. IDs mapping to individual rows within another
namespace > path
.Using the code found in this issue, I am able to select a column with a name like
date
, but not a column with a name like4820477751066624
.Is it generally assumed that column names are
strings
with at least one letter as the starting character? Or can there be solely integer column names?Here is my Datastore response:
I have double-triple checked to make sure I run the query using an integer that is definitely a column name for the table pictured above.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: