Skip to content

Instantly share code, notes, and snippets.

@hello-josh
Created May 12, 2015 18:18
Show Gist options
  • Save hello-josh/1f8749b447c61c99e53c to your computer and use it in GitHub Desktop.
Save hello-josh/1f8749b447c61c99e53c to your computer and use it in GitHub Desktop.
Google App Engine - Deleting entities from your local dev_appserver.py

Delete entities from your local google app engine datastore

First you need to shut down any app that is using the datastore. The app holds the file in memory while running and flushes it to disk when it shuts down. This means any writes you do while the app is running will be undone when you shut down the app.

Next, find the datastore file and connect to it using sqlite.

user@host:path$ sqlite3 my-app.sqlite3

Check out which tables exist. You will see your app's data stored in a table that is prefixed with dev~<project_id>.

sqlite> .tables
Apps
IdSeq
Namespaces
ScatteredIdCounters
dev~<project_id>!!Entities
dev~<project_id>!!EntitiesByProperty

Get a list of which Kinds exist in your application

select distinct kind from "dev~<project_id>!!Entities";

Delete the Kinds you want removed!

delete from "dev~<project_id>!!Entities" where kind IN ('Kind1', 'Kind2', 'Kind3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment