Emulating a "OR" condition in Datastore.
Posted
by Jelle
on Stack Overflow
See other posts from Stack Overflow
or by Jelle
Published on 2010-05-14T08:44:48Z
Indexed on
2010/05/14
15:04 UTC
Read the original article
Hit count: 278
google-app-engine
|google-datastore
Hello again,
I'm using the Google App Engine with Python (Django).
How to emulate "SELECT * FROM bla WHERE touser = common.userstats("key") OR fromuser = common.userstats("key") ORDER BY date ASC"
?
I was thinking of something like this, but I can't get it in the order I want.
recievedlist = models.P1.all()
recievedlist.filter("touser =", common.userstats("key"))
plus1list = recievedlist.fetch(50)
sendlist = models.P1.all()
sendlist.filter("fromuser =", common.userstats("key"))
plus1list += sendlist.fetch(50)
# order plus1list
© Stack Overflow or respective owner