Delete namespace

494 views
Skip to first unread message

Startworld67

unread,
Aug 27, 2012, 11:46:35 PM8/27/12
to objectify...@googlegroups.com
Hi -

I use namespaces for implementing multitenancy in my application. When a user wishes to cancel the service, I would like to delete all entities in a given namespace.

I am out of ideas on how to delete all entities in a given namespace using objectify. Is there a way to delete all in a namespace?

The only alternate way I see is to use a taskqueue job to switch to a namespace, iterate through all kinds and delete all entities in them.

Better way would have been to use mapreduce but I hear that I cannot invoke from API to iterate through all records in a given namespace.

Thanks.

Jeff Schnitzer

unread,
Aug 28, 2012, 9:38:04 PM8/28/12
to objectify...@googlegroups.com
I wrote an "extended datastore admin" for a client which allows you to
delete and copy entities on a namespace-by-namespace basis. It uses
the python mapreduce framework and some code from the normal datastore
admin; you install it as a special version under your appid.

The code belongs to the client but I believe they would be willing to
license it to recoup some of their investment. If you (or anyone
else) are interested, email me offline and I'll put you in touch.

Jeff

Startworld67

unread,
Aug 30, 2012, 11:51:52 PM8/30/12
to objectify-appengine
Hi Jeff,

Thanks for your email.

We do not use python. So, I will have to write the code the tough way
using task queues.

I am willing to write on my own - I was thinking to get all entities
in a give namespace using meta queries and just iterate through all
the entities and delete them..

Mapreduce IMO is not available to be invoked as an API call with
namespace string as parameter for it to iterate upon. At least in
Java!

Thanks.

Jeff Schnitzer

unread,
Aug 31, 2012, 4:45:20 PM8/31/12
to objectify...@googlegroups.com
It doesn't matter what platform you use; the Shovel (the enhanced
datastore admin) installs as a separate version and you access it via
shovel.yourapp.appspot.com. You could also give it a REST api and hit
it from a task or urlfetch.

Yeah, the problem with the Java map/reduce framework is that it isn't
namespace-aware. The Python version is, which is why I wrote the
Shovel in Python.

If you just want something simple, you can iteratively delete entities
from a namespace. It just might take a while without the map/reduce.

Jeff
Reply all
Reply to author
Forward
0 new messages