google-app-engine


golang datastore projection query returning empty strings from a populated entity


I'm currently working on golang http-based handler running on Google App Engine.
As part of this, I'm trying to pull back all the values I'm interested in via a Projection query looking at a number of fields in a given kind, with the intention of storing each entity load in a struct that mirrors the field types.
This is my query:
source := datastore.NewQuery("CacheEntry").Project("Campaign", "Creative", "Impressions", "Operator", "Publisher", "Slot").Limit(50)
Unfortunately, all I get back from this is empty strings (worse, returning empty strings does not throw an error of any kind so I've only just worked out that it's doing this).
Google's documentation and error reporting is pretty bad when it comes to Datastore so it hasn't been much help. I can see the populated fields on my Datastore viewer in the Google Cloud Console - some fields are actually empty but I should be returning some data at least.
I'm running it in a for loop with the appropriate pointers setup:
for t := source.Run(ctx); ; {
_, err := t.Next(&x)
log.Println(count)
if err == datastore.Done {
log.Println("failed on Datastore:done, count \n")
log.Println(count)
break
}
if err != nil {
log.Println("failed on \n")
log.Println(count)
http.Error(w, err.Error(), http.StatusInternalServerError)
break
}
// fmt.Fprint(w, x.Campaign)
if &x != nil {
fmt.Fprintln(w, "Strings:\n")
fmt.Fprintln(w, x.Operator)
if x.Operator == "" {
fmt.Fprintln(w, "Campaign string is empty")
}
}
count = count + 1
'X' being:
type Row struct {
Campaign string
Creative string
Impressions int
Operator string
Publisher string
Slot string
}
Any ideas where I'm going wrong?
Figured it out, turns out a number of issues were happening in the background:
For whatever reason, indexes were not being updated, and the error message indicating this was not being piped to the Http response, hence the query was not running
After clearing this, I didn't realise that the results I was pulling back included large numbers of events that had blank property values and lacking any kind of ordering, hence they were literally whatever happened to come back before the .Limit(50) was being reached ... in that case, the query was running, but I was interpreting the empty string returns as errors when in fact they were correct, just not from the part of the dataset I'd expected - adding Filters for "<property> >", "" fixed it
Datastore sorely needs better feedback measures than the ones it has. Compared to a lot of similar dbs I've worked with, it's needlessly minimal in it's feedback.

Related Links

Google App Engine : JDO deletePersistent not consistent
Objectify 4 throwing strange error in GAE
How can I use my Google API email #developer.gserviceaccount.com
How to log messages in GAE go runtime?
Error with PHP SDK (Windows)
Increase Per-User Limit for Google API: Saving not possible, always error message “Your input was invalid”
GWT: form post works only on the local server, not with the app engine
NoClassDefFoundError: com/google/api/client/util/Lists when setting up oauth2 on app engine
Objectify with Cloud Endpoints
Access extrenal db service from App engine
“Sample DB” for Google App Engine Datastore
What is the Entity Key for in the Datastore Viewer?
How to get custom attribues of User using Admin Sdk.?
'Model is not immutable' TypeError
How to store data from SmartGWT ListGrid?
BigQuery OAuth access token on Java App Engine dev server

Categories

HOME
windows
turing-machines
fuelux
c99
mjml
mstest
vscode-extensions
recordrtc
teechart
pega
nancy
shared-libraries
parameter-passing
package-managers
red5
forgot-password
google-container-registry
shortest-path
rubymotion
imageresizer
mongoid6
event-store
short-url
jboss6.x
game-theory
expressionengine3
siri
handler
userdefaults
autolisp
rselenium
login-script
android-maps-extensions
vue-chartjs
dynamic-jasper
reactjs.net
lubridate
linq-to-objects
trigonometry
vmware-fusion
laravel-elixir
smoothstate.js
http-request
xmldocument
drupal-theming
magento-2.0.7
automapper-5
bluez
convex-optimization
spring-data-couchbase
headless
sundials
reshape
py2neo
juice-ui
choice
visual-studio-2008-sp1
cubism.js
qtplugin
vulcanize
watch-os-2
nservicebus5
spreadjs
boost-serialization
turbo-prolog
nio2
zen-cart
rubaxa-sortable
eoferror
pyobjc
bufferedinputstream
mruby
viewer
paw
file-not-found
menubar
git-repo
hibernate-entitymanager
jammer
isqlquery
inappsettingskit
kaleidoscope
abstract-data-type
patricia-trie
veracity
inkcanvas
umra
xui
instantiationexception
blender-2.49
sifr
spread
lxr
filesystemobject
int64
soappy

Resources

Encrypt Message