简体   繁体   中英

multi-tenancy with NDB using Namespace API and also be able to query across all the data?

OK here is my current situation. I am building an app that will interface with both businesses and end-users. I am building the system on google app engine. Using Endpoints for my APIs. For the business facing application (angular webapp) I'd like to support multi tenant arc. I can easily do this with the Namespace API. On the end-user side I am building a mobile app that needs the info from all the businesses.

If I went with the Namespace API, I don't believe it is possible to query across namespaces. My next thought is to use ancestor property on NDB models to separate and group the data into groups.

I am looking for ideas or thoughts on how to go about implementing this with the key point being minimizing data leaking across businesses in the webapp, while leveraging as much of the GAE arc as possible.

Is it possible with the Namespace API? How would you go about implementing something similar?

This is dirty, but you can get the list of namespaces and then iterate through them using get_namespaces.

https://developers.google.com/appengine/docs/python/datastore/metadataentityclasses#get_namespaces

http://gaelyk.appspot.com/tutorial/app-engine-shortcuts

I'm new to GAE, but from I understand from the documentation you are supposed to setup indexes for your entities and then you should be able to query on the indexes, but I can't get that to work and I may be misinformed on how it works. Someone else can clarify.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM