Storing hierarchical data in Google App Engine Datastore?

前端 未结 3 1370
故里飘歌
故里飘歌 2020-12-04 11:40

Can someone illustrate how I can store and easily query hierarchical data in google app engine datastore?

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 12:23

    Well, you should try to keep your data as linear as possible. If you need to quickly query a tree structure of data, you would either have to store it pickled in the database (or JSON-encoded if you prefer) if that is possible for your data, or you would have to generate tree indices that can be used to quickly query a piece of a tree structure. I'm not sure how Google App Engine would perform when updating those indices, however.

    When it comes to Google App Engine, your main concern should be to reduce the number of queries you need to make, and that your queries return as little rows as possible. Operations are expensive, but storage is not, so redundancy should not be seen as a bad thing.

    Here are some thoughts on the subject I found by googling (although for MySQL, but you can get the general idea from it): Managing Hierarchical Data in MySQL

    Ah and here's a discussion for Google App Engine: Modeling Hierarchical Data

提交回复
热议问题