Skip to content

Instantly share code, notes, and snippets.

@chidakiyo
Created February 16, 2017 04:05
Show Gist options
  • Save chidakiyo/bcf6115e4d5ba6849693afc0f6c81568 to your computer and use it in GitHub Desktop.
Save chidakiyo/bcf6115e4d5ba6849693afc0f6c81568 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gcloud import datastore
import os
project = os.environ.get('GAE_PROJECT')
print "target : " + project
client = datastore.Client(project)
query = client.query(kind='')
query.keys_only()
task = query.fetch()
for entity in task:
key = entity.key
if key._path[0]['kind'].startswith('__') == False: # meta系のレコードは消さない
print "delete at : " + key._path[0]['kind'] + " : " + key._path[0]['name']
client.delete(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment