[google-appengine] Error while Deleting all entities in the namespace

2012-09-18 Thread Aswath Satrasala
Hi,
I am struggling to clear up my unused namespaces.  The datastore admin
console does not provide this feature.

I am using the following code.  This is assumed that the namespace has few
entities, and hopefully will execute with in the 1min appengine time limit.

String oldNamespace = NamespaceManager.get();
try {
  NamespaceManager.set(namespaceToDelete);
  DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
  Query q = new Query().setKeysOnly();

  final ArrayListcom.google.appengine.api.datastore.Key keys =
new ArrayListcom.google.appengine.api.datastore.Key();

  for (final Entity entity: ds.prepare(q).asIterable()) {
   keys.add(entity.getKey());
  }
  ds.delete(keys);
} finally {
  NamespaceManager.set(oldNamespace);
}


*
*
*I get the following error*
*illegal key.path.element.type: __Stat_Ns_Kind_CompositeIndex__*

Any pointers will be appreciated.

-Aswath

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Error while Deleting all entities in the namespace

2012-09-18 Thread Jeff Schnitzer
Don't try to delete anything with __ at the beginning; those are GAE
special administrative kinds.

Jeff

On Tue, Sep 18, 2012 at 6:59 AM, Aswath Satrasala
aswath.satras...@gmail.com wrote:
 Hi,
 I am struggling to clear up my unused namespaces.  The datastore admin
 console does not provide this feature.

 I am using the following code.  This is assumed that the namespace has few
 entities, and hopefully will execute with in the 1min appengine time limit.

 String oldNamespace = NamespaceManager.get();
 try {
   NamespaceManager.set(namespaceToDelete);
   DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
   Query q = new Query().setKeysOnly();

   final ArrayListcom.google.appengine.api.datastore.Key keys =
 new ArrayListcom.google.appengine.api.datastore.Key();

   for (final Entity entity: ds.prepare(q).asIterable()) {
keys.add(entity.getKey());
   }
   ds.delete(keys);
 } finally {
   NamespaceManager.set(oldNamespace);
 }



 I get the following error
 illegal key.path.element.type: __Stat_Ns_Kind_CompositeIndex__

 Any pointers will be appreciated.

 -Aswath

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine group.
 To post to this group, send email to google-appengine@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.