Google Database Design

I am designing a simple list-based project. the idea is to define tasks for the project (without a workflow - just “task completed” or not). In a girarhic way. that is, each task has several tasks, and this task can have another multiple task. we can say that the project is completed if all the tasks for this project are completed., I tried to use refrenceproeperty to create a hirarchy, but could not find an easy way (which does not take more than 30 seconds to find all the children of the project and check the weather that it was completed or not). to determine if the project is completed or not. How to create a database for such work? and also, if I need to copy a project to define another project, how to copy hierarchical data?

+3
source share
2 answers

The primary philosophy behind the App Engine data warehouse, like other nosql databases, is to do your writing work, not reading. With this in mind, you can use the relationship with your parents, as Adam suggests, and save an “incomplete account” on each node, which counts the number of urgent children who are not yet completed. When you mark node complete, decrease its parent counter node; if it makes him complete, go to his parents, etc. With a structure like this, you can immediately show whether the task is completed or not.

+3
source

, , , .

, , , ANCESTOR.

, , , - :

all_done = db.Query().ancestor(project_entity).filter('complete = ', False).count()
if all_done > 0:
    #Not all done
else:
    #All done
0

Source: https://habr.com/ru/post/1741659/


All Articles