Use Namespaces, not Ancestor paths
What you need is a Multitenant structure. In Datastore, you do that by using Namespaces, not ancestor paths. See Multitenancy in Datastore docs.
Instead of /shop_info/catalog/item(x), you would have:
Entities:
- owner
- owner/shop (I suggest shop as a child of owner)
- catalog_item (top-level, not child of shop)
Namespaces:
Example:
Let's say John subscribes to your app and creates a 'SuperElectro' store. You would have two entities:
- owner: 'John'
- shop: 'SuperElectro' (could be a child of owner: 'John')
And one namespace:
- SuperElectro (or its unique ID)
When you add a new item to SuperElecto's catalog, don't provide any ancestor/parent. Instead, provide a namespace which is a combination of the owner and shop:
In Python:
from google.appengine.api import namespace_manager
from google.appengine.ext import ndb
class CatalogItem(ndb.Model):
name = ndb.StringProperty()
category = ndb.StringProperty()
namespace_manager.set_namespace('SuperElectro')
item = CatalogItem(name='iPhone', category='Smartphone')
item.put()
In real world, you'd want to use something unique for the namespace: instead of 'SuperElectro', I'd suggest using the shop ID.
Hope it helps. Read more at Implementing Multitenancy Using Namespaces.