about

update Google App Engine PolyModel inheritance tree - 07 Feb 2015

search

It is perfectly possible to alter a PolyModel inheritance tree and then migrate the existing entities to the new tree. Without running a migration, the data will get deserialized from bigtable with just the fields of the class which is the parent of the changes.

In the following example code, I will alter the tree from GrandParent -> Child to GrandParent -> Parent -> Child, and add the intermediary Parent class to the class_ field where the inheritance path is tracked. If I did not run the migration, then we would just see those fields that exist on GrandParent.

View GitHub Gist.


112 words. Post tags: database, model, Google App Engine, PolyModel, inheritance, migrate, and python.

Post content is written by Jason Zerbe and licensed CC BY-NC 3.0.