views:

40

answers:

2

I made a very minor mod to the GqlQuery to retrieve only specified records using the 'where' keyword. The output, however, displays all entries from the guestbook db! (I need to filter the data by author)

Guestbook5_datastore code:

#greetings = db.GqlQuery("SELECT * FROM Greeting ORDER BY date DESC LIMIT 10")
greetings = db.GqlQuery("SELECT * FROM Greeting where greeting.author='mike'")

index.html code:

{% for greeting in greetings %}
  {% if greeting.author %}
    <b>{{ greeting.author.nickname }}</b> wrote:
  {% else %}
   An Anonymous person wrote:
  {% endif %}
  <blockquote>{{ greeting.content|escape }}</blockquote>
{% endfor %}
+1  A: 

Your author property is not a string, so I don't think you can do

greeting.author='mike'

I'm surprised that you wouldn't get an error telling you that though, rather than it returning them all!

Danny Tuppeny
A: 

You're attempting to filter based on a property of another entity, which would require a join. This isn't supported in App Engine.

Nick Johnson