How do I get a list of namespaces on google app engine?

后端 未结 4 1564
孤独总比滥情好
孤独总比滥情好 2021-02-04 08:51

I would like to make a backup of all user data in the datastore. My application is using the new namespace feature to provide multi tenanting on a per user basis (as per the ex

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 09:22

    Since SDK 1.4.0 you can use Metadata Queries:

    from google.appengine.ext.db import metadata
    
    for ns in metadata.get_namespaces():
        print "namespace: '%s'" % ns.namespace_name
    

    For NDB the import is slightly different:

    from google.appengine.ext.ndb import metadata
    

提交回复
热议问题