Google App EngineのDatastoreの中身を全部消す

ウェブのインターフェイス上では"Delete from Tuser"のようなGQL文は発行できない.コマンドラインであくせすして100件ぐらいちまちま消す必要がある.というわけで,GoogleAppEngineでremote_apiを使う s_thx>tmatsuo - When it’s ready.http://code.google.com/intl/en/appengine/articles/remote_api.htmlに従ってappengine_console.pyを作成.

~/Documents/gae/favotter $ python appengine_console.py favotter
App Engine interactive console for favotter
>>> from models import Tuser
>>> from google.appengine.ext import db
>>> while True:
...     try:
...             for i in range(0, 1000):
...                     db.delete(Tuser.all().fetch(100))
...                     print("%d deleted" % ((i+1) * 100))
...     except Exception, e:
...             print(str(e))
...     time.sleep(5)

Username:myemail@gmail.com
Password:

で今30万件ぐらい消しているところ...GoogleのDatastoreは何件がデータベースにはいっているかを知ることができないので,いつ終わるかわかりません:)