Nijin Narayanan
Nijin Narayanan

Reputation: 2279

"Not Start With" query in Appengine

How to implement "not startwith" query in appengine more efficently?

it should be something like this:

Select * from Table A where name not like 'CON%'.

Datastore contains around 100K entity and 40% of entities are startwith CON. Performing an iteration on this table to get the each entity name and adding some task for them. And i need to ignore those entity name startwith CON.

Upvotes: 0

Views: 70

Answers (1)

falsetru
falsetru

Reputation: 369424

Using filter with <, >=:

import itertools
objs = itertools.chain(
    Model.all().filter('name <', 'CON'),
    Model.all().filter('name >=', 'COO')
)
for obj in objs:
    # do something with obj

Upvotes: 1

Related Questions