In a GQL query what ANCESTOR IS :1 exactly means?

2019-09-02 20:30发布

I have come across with GQL queries containing ANCESTOR IS :1. So, what the ancestor is and what :1 stands for?

query = db.GqlQuery("SELECT * "
                     "FROM my_db "
                     "WHERE ANCESTOR IS :1 AND answer > :3 AND ch = :4 "
                     "ORDER BY answer",
                     my_db_key('name'),
                     x,
                     ch)

e.g in the query above what this line "WHERE ANCESTOR IS :1 AND answer > :3 AND ch = :4 " is suppose to do?

1条回答
Rolldiameter
2楼-- · 2019-09-02 21:31

An ancestor query returns descendants of the given ancestor entity; that is, entities that list the ancestor as their parent, or whose parent does, etc.

:1, :2, etc. are placeholders that are replaced by the following parameters to GqlQuery().

查看更多
登录 后发表回答