Search code examples
pythongoogle-cloud-platformgoogle-cloud-datastore

How to use nesting similar to firestore for google datastore?


I've worked with firestore previously, we can keep documents inside collection, and collections inside documents. For google datastore kind is similar to collection and entity similar to documents, how can we keep kind inside kind?

For firestore

collection
   - document
     - collection
       - document
         .... so on

How to achieve this for Google Datastore?

kind
   - entity
     - kind
       - entity
         .... so on

Solution

  • The documentation for Datastore is pretty good

    Start with the documentation on Ancestor paths to learn about parent and children entities.

    Be careful on ensuring you're aware of the tradeoffs that exist in Datastore as you build your database. See Limits

    Depending on your language|runtime, there are tools like ndb for Python3 that provide abstractions upon Datastore. I've not used any of these but ndb used to be very popular with App Engine developers (using Datastore) and these may abstract some of the complexity in dealing with Entities in Datastore.