在Appengine数据存储区中运行筛选器查询

时间:2012-06-08 15:19:15

标签: google-app-engine

我想运行查询

SELECT * FROM users WHERE uname='foo' AND passwd='bar'

这总是返回None.My表具有与查询匹配的条目。 我觉得必须使用索引做一些事情。我将index.yaml编辑为

indexes:

- kind: users
  ancestor: no
  properties:
  - name: uname
    direction: asc
  - name: passwd
    direction: asc

但是当我定义uname=db.TextProperty(required=True,indexed=True)时,它会返回一个奇怪的错误

<class 'google.appengine.ext.db.ConfigurationError'>: indexed must be False. 
      args = ('indexed must be False.',) 
      message = 'indexed must be False.'

我称之为奇怪,因为当我谷歌错误时,没有完全匹配。

我缺少什么?

1 个答案:

答案 0 :(得分:4)

您是否尝试在管理控制台的数据存储区查看器中运行查询。它建议您创建索引的内容。

但是,文本属性不可索引。根据{{​​3}}

  

与StringProperty不同,TextProperty值的长度可超过500个字符。但是,TextProperty值未编入索引,因此无法在过滤器或排序顺序中使用。