1

I have some custom user model, and I count the number of users with name Joe:

c = UserModel.all().filter('name =', 'Joe').count()

Even though I know there is a Joe in the datastore, there is some mistake witch makes c == 0.

This is a problem I'm dealing with, however the biggest problem is that I don't know how to debug this.

I would like to get some query and visualise it somehow, so that I can understand what is there and why Joe is not there:

v = magically_visualise_contents_of(UserModel.all().filter('name =','Joe'))

handler.response.out.write(v)
3
  • 3
    Have you tried running the query directly in the datastore viewer by GQL? That usually helps identify minor issues
    – Nick Gotch
    Feb 15, 2011 at 21:24
  • ie: SELECT * FROM UserModel WHERE name = 'Joe'
    – Nick Gotch
    Feb 15, 2011 at 21:25
  • @Nick you should add this as an answer because, imho, it's a valid answer Feb 16, 2011 at 7:45

1 Answer 1

1

Try running the query directly in the datastore viewer by GQL.
That usually helps identify minor issues, for example:

 SELECT * FROM UserModel WHERE name = 'Joe'

Also, one common mistake with string matching is whitespace characters in the data, like "Joe ".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.