0

Say I query the datastore with:

query = self.request.get('q')
query = db.GqlQuery("SELECT * FROM UserProfile WHERE username = :query", query=query)

The UserProfile table has an entry:

userid    username
1         Ron

So when I query with username="Ron" it return the object but not with the query username="ron". Is it possible to query the datastore keeping the query case-insensitive?

Also, does Google Datastore has query similar to Django's as below?

c = Col.objects.filter(name__istartswith = request.GET['term'])[:3]
Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
toothie
  • 1,019
  • 4
  • 20
  • 47
  • 1
    store it in lower case, convert it to lowercase when you search. Or store the lower case version also, then search for that after converting the search term also. – Paul Collingwood Jan 11 '15 at 13:32
  • 1
    THe easiest way to store the duplicate normalized case form of the property is use a ComputedProperty https://cloud.google.com/appengine/docs/python/ndb/properties#computed – Tim Hoffman Jan 11 '15 at 14:35

0 Answers0