I have a table in Google app engine datastore. It has 3 columns A,B and C. I need to retrieve all the rows that contain val in either column A, B or C. I am writing a standard sql query like select * from table where A = val or B = val or C = val
. But it gives an error. Is there any work around for this? I am using python
Asked
Active
Viewed 93 times
0

Mark Parnell
- 9,175
- 9
- 31
- 36

user3043728
- 33
- 3
-
normally if you are asking about problems that have errors, you should include the error and the actual offending code, not some "like" – Tim Hoffman Nov 29 '13 at 02:38
1 Answers
0
GQL is not SQL and does not support OR. See docs https://developers.google.com/appengine/docs/python/datastore/gqlreference
You can do such a query using the Query object, e.g.
query = SomeModel.query().filter(
ndb.OR(SomeModel.A == val,
SomeModel.B == val,
SomeModel.C == val)
)

Tim Hoffman
- 12,976
- 1
- 17
- 29