Guest User

Untitled

a guest
Apr 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. > t = Transaction.all().filter("client_email =", "some_email").filter("application_id =", "foo").fetch(100)
  2. > len(t)
  3. # => 4
  4.  
  5. > min = datetime.datetime(2009, 2, 3, 0, 0)
  6. > max = datetime.datetime(2009, 11, 4, 0, 0)
  7.  
  8. > len(Transaction.gql("WHERE client_email =:1 AND date >:2 AND date <=:3 AND application_id =:4",
  9. "some_email", min, max, "foo").fetch(100))
  10. # => 2
  11.  
  12. > map(lambda x: x.date, t)
  13. # => [datetime.datetime(2009, 10, 2, 22, 43, 51), datetime.datetime(2009, 10, 5, 2, 5, 24), datetime.datetime(2009, 10, 7, 16, 51, 5), datetime.datetime(2009, 10, 7, 16, 6, 53)]
  14.  
  15. > trans = filter(lambda x: x.date < max and x.date >= min, t)
  16. > len(trans)
  17. # => 4
Add Comment
Please, Sign In to add comment