Namespaced Datastore queries fail with google.golang.org/appengine/datastore

16 views
Skip to first unread message

Aaron Taylor

unread,
May 3, 2015, 11:01:34 AM5/3/15
to google-ap...@googlegroups.com
I am working on an application with multiple modules and I want to introduce namespacing in order to separate access to the datastore for each module. I added the following line to the top of my methods that accessed the datastore (and are passed in a context.Context value) but my datastore queries ceased to find any entities. Other methods on the datastore work file, it is just the queries that are failing.

c, _ = appengine.Namespace(c, DBNamespace)

Is this a bug, or is there something that I am missing?

Glenn Lewis

unread,
May 3, 2015, 11:11:55 AM5/3/15
to Aaron Taylor, google-appengine-go
If you saved the data in the datastore without a namespace, then you will not be able to query them with a namespace.
In other words, if you want to be able to query the data in the datastore with a namespace, the data must also have been saved using that same namespace.
I hope that helps.
-- Glenn

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages