擅长:python、mysql、java
<p>为此,我建议使用<a href="https://cloud.google.com/appengine/docs/standard/python/ndb/queries#iterators" rel="nofollow noreferrer">^{<cd1>}</a>作为学生模型的属性来引用给定的教授。在</p>
<pre class="lang-python prettyprint-override"><code>class Professor(ndb.Model):
name = ndb.StringProperty()
class Student(ndb.Model):
name = ndb.StringProperty()
prof = ndb.KeyProperty()
</code></pre>
<p>有了上述实体类型,就可以使用只键查询来查询所有名为“Snape”的教授,然后查询prof为<a href="https://cloud.google.com/appengine/docs/standard/python/ndb/queries#neq_and_in" rel="nofollow noreferrer">one of the retrieved keys</a>的所有学生。在</p>
^{pr2}$