Is there something like `ForeignKey` in the Google App Engine` webapp`?

I use Google App Engine with my webapp infrastructure. Is there something like Django ForeigKey in webapp ? that is, I have a model, and I want it to have a property / field that points to another model. Is it possible?

+6
python google-app-engine web-applications foreign-keys
source share
2 answers

There is db.ReferenceProperty . You should be aware of two things when using it: automatic dereferencing (which is another RPC call to the data store), and the referenced entity does not have to exist (so you will need to manually verify it).

When using db.ReferenceProperty, make sure you use Appstats to avoid fetching objects in sequential order. Nick Johnson has an article explaining how to get links to objects in advance.

+7
source share

I just looked at it myself; db.ReferenceProperty is definitely the way to go.

I have found a worthy explanation here; Modeling entity relationships

+4
source share

All Articles