App Engine: Difference between NDB and Datastore

2019-07-21 02:29发布

I have been going through the Google App Engine documentation (Python) now and found two different types of storage.

  1. NDB Datastore
  2. DB Datastore

Both quota limits (free) seem to be same, and their database design too. However NDB automatically cache data in Memcache!

I am actually wondering when to use which storage? What are the general practices regarding this?

Can I completely rely on NDB and ignore DB? How should it be done?

I have been using Django for a while and read that in Django-nonrel the JOIN operations can be somehow done in NDB! and rest of the storage is used in DB! Why is that? Both storages are schemaless and pretty well use same design.. How is that someone can tweak JOIN in NDB and not in DB?

1条回答
淡お忘
2楼-- · 2019-07-21 03:10

In simple words these are two versions of datastore . db being the older version and ndb the newer one. The difference is in the models, in the datastore these are the same thing. NDB provides advantages like handling caching (memcache) itself. and ndb is faster than db. so you should definitely go with ndb. to use ndb datastore just use ndb.Model while defining your models

查看更多
登录 后发表回答